ASP Code
  Home arrow ASP Code arrow How-to PGP(Pretty Good Privacy) when sendi...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP CODE

How-to PGP(Pretty Good Privacy) when sending encrypted emails
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    1999-11-26

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


     

     

    How-to send PGP encrypted emails (Pretty Good Privacy)
    This is something I hacked a while back for some PGP encrypted emails that I needed to process. Its working nicely for me. I know its ugly but its damn unique! I haven't seen anything out there that does what this code does. I hope you can use it somehow as I'm sure I wasn't the only one looking for an easy way to decrypt/encrypt PGP.

    This is the following example uses the DOS based PGP encryption/decryption program
    availble from http://www.pgpi.org/ Configure the software with your PGP key by following the directions in the included files.


     
    A self made component or a third part component like ASPExec from
    http://www.serverobjects.com can be used to execute the PGP decryption
    execututable.

    An example VB component to do this task would contain the following code in
    a Class Module.

    Dim sTest, i As Integer
    Dim sCommand As String
    Dim sPGPTXT As String


    Public Property Let Command(temp As Variant)
    sCommand = temp
    End Property
    Public Property Get Command() As Variant
    Command = sCommand
    End Property
    Public Property Let PGPTXT(temp As Variant)
    sPGPTXT = temp
    End Property
    Public Property Get PGPTXT() As Variant
    PGPTXT = sPGPTXT
    End Property

    Public Sub PGPDecrypt()
    sTest = Shell(sCommand, vbMinimizedNoFocus)
    sTest = ""
    i = 0
    Do While Not sTest = "Exit"
    i = i + 1
    If i > 30 Then
    sTest = "Exit"
    End If
    If GetFileAttributes(sPGPTXT) <> -1 Then sTest = "Exit"
    Sleep (500)

    Loop
    End Sub

    To call this component from within ASP:

    Set oFS = CreateObject("Scripting.FileSystemObject")
    Response.Write "Decyrypting"
    Set oPGP = Server.CreateObject("NWCRPGP.PGP")
    oPGP.Command = "C:\inetpub\wwwroot\pgp\pgp.bat"
    oPGP.PGPTXT = "C:\Inetpub\wwwroot\pgp\ASP.TXT"
    Response.Write ".."
    If oFS.FileExists("C:\Inetpub\wwwroot\pgp\asp.txt") Then
    Set oFSTemp = oFS.GetFile("C:\Inetpub\wwwroot\pgp\asp.txt")
    oFSTemp.Delete
    Set oFSTemp = Nothing
    Response.Write "."
    End If
    If oFS.FileExists("C:\Inetpub\wwwroot\pgp\asp.pgp") Then
    Set oFSTemp = oFS.GetFile("C:\Inetpub\wwwroot\pgp\asp.pgp")
    oFSTemp.Delete
    Set oFSTemp = Nothing
    Response.Write "."
    End If
    Set oFSTemp = oFS.CreateTextFile("C:\Inetpub\wwwroot\pgp\asp.pgp", True)
    Response.Write ".."
    oFSTemp.Write sTemp
    oFSTemp.Close
    Set oFSTemp = Nothing
    Response.Write ".."
    oPGP.PGPDecrypt
    Response.Write "...."
    Set oFSTemp = oFS.OpenTextFile("C:\Inetpub\wwwroot\pgp\ASP.TXT")
    Response.Write oFSTemp.ReadAll
    oFSTemp.Close
    Set oFSTemp = Nothing
    Set oFSTemp = oFS.GetFile("C:\Inetpub\wwwroot\pgp\asp.txt")
    oFSTemp.Delete
    Set oFSTemp = Nothing
    Set oFSTemp = oFS.GetFile("C:\Inetpub\wwwroot\pgp\asp.pgp")
    oFSTemp.Delete
    Set oFSTemp = Nothing
    Set oFS = Nothing
    Set oPGP = Nothing

    Contained in the pgp.bat file is:
    c: CD \inetpub\wwwroot\pgp
    pgp -v -o asp.txt -z password asp.pgp

    This code is in no way in a condition for production use.

    Things to think about:

    Decrypting to a file is insecure because your unencrypted message will be
    saved, even if temporarily, to the HD which could allow access to it.
    Sending the PGP encrypted message directly and receiving to/from the program
    would be much more secure. If multiple instances of this ran they would conflict since its using the
    same file names.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More ASP Code Articles
    More By aspfree

     

    IBM® developerWorks developerWorks - FREE Tools!


    Check out the new Jazz space on developerWorks

    <a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts.
    FREE! Go There Now!


    NEW! Discovering the value of WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!


    NEW! Hello World: WebSphere Service Registry and Repository

    Manage, govern, and share services across your organization by using WebSphere Service Registry and Repository. Follow the hands-on exercises to learn how to navigate the Web interface to publish, find, reuse, and update services.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! IBM Rational AppScan Standard Edition V7.7

    Secure your Web applications with IBM Rational AppScan Standard Edition V7.7, previously known as Watchfire AppScan. This Web application security testing tool automates vulnerability assessments and scans and tests for common Web application vulnerabilities. Visit IBM developerWorks to download a free trial of IBM Rational AppScan Standard Edition V7.7.
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered!
    FREE! Go There Now!


    NEW! Rational Talks to You: Scott Ambler on being agile in a global development environment

    Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    ASP CODE ARTICLES

    - ASP Forms
    - ASP: The Beginning
    - Getting Remote Files With ASP Continued
    - Inbox and Outbox Manipulation in ASP
    - Relational DropDownList Using VB.NET
    - Ad Tracking URL Hits
    - Use ViewState to display one record per page...
    - Send Email using ASP.NET formatted in HTML
    - ASP File Explorer
    - ASP/XML Interview questions by Srivatsan Sri...
    - Various methods of setting Date values to a ...
    - Conditional DataGrid Item and using checkbox...
    - Fill .NET Listbox with SQL DataReader
    - Filling Dropdown box using Code-Behinds in C#
    - FLAMES code sample written in .NET What is F...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek