
Crypt::PGPSimple - Interface to PGP for Windows and UNIX. No other mods required.

Object oriented interface to PGP. Requires PGP installed on the server. Allows Perl scripts to encrypt, decrypt and sign messages using PGP for the encyption. Tested with PGP 2.6.2 and PGP 6.5.8 on UNIX and Windows.

use Crypt::PGPSimple;
my ($objPGP) = new Crypt::PGPSimple;
# tell Crypt::PGPSimple about the PGP executable (these are the defaults, by the way,
# so if this matches your system, you don't need to set these.
# PgpTempDir needs to be writable by the account running the script.
$objPGP->Version(2.6.2); # (not currently used, but might be later)
$objPGP->PgpExePath("C:\\Progra~1\\Networ~1\\Pgp\\PGP.exe");
$objPGP->PgpKeyPath("C:\\Progra~1\\Networ~1\\Pgp\\PgpKey~1");
$objPGP->PgpTempDir("C:\\");
# Example 1: Encrypt
$objPGP->PublicKey("myfriend\@herhost.com");
$objPGP->PlainText($plain_text_message);
$objPGP->Encrypt;
my ($encrypted_message) = $objPGP->EncryptedText;
# Example 2: Decrypt
$objPGP->Password("mypassword");
$objPGP->EncryptedText($encrypted_message);
$objPGP->Decrypt;
my ($plain_text_message) = $objPGP->PlainText;
# Example 3: EncryptSign
$objPGP->PublicKey("myfriend\@herhost.com");
$objPGP->PrivateKey("me\@myhost.com");
$objPGP->Password("mypassword");
$objPGP->PlainText($plain_text_message);
$objPGP->EncryptSign;
my ($encrypted_signed_message) = $objPGP->EncryptedText;
# Example 4: Sign
$objPGP->PrivateKey("me\@myhost.com");
$objPGP->Password("mypassword");
$objPGP->PlainText($plain_text_message);
$objPGP->Sign;
my ($signed_message) = $objPGP->SignedText;

See http://www.verysimple.com/scripts/ for more information.

Calling a property with no arguments will return the current value. Calling a property with an argument will change the current value to the value of the argument supplied and return true (1).
EncryptedText
ErrDescription
Password
PgpExePath
PgpKeyPath
PgpTempDir
PgpTimeZone
PgpVersion
PlainText
PrivateKey
PublicKey
Result
SignedText
Version

The PGP-related methods (encrypting, decrypting, etc) will return true (1) if they succeeded or false (0) if not. The PGP result message is available in the Result property. If an error occured, ErrDescription may contain details.
Decrypt
DoPgpCommand($strPgpCommand, $strArguments)
Encrypt
EncryptSign
ErrClear
Reset
Sign
new

0.13 (11/04/00) Updated documentation only.
0.12 (11/03/01) Fixed bug w/ multiple recieients (Thanks Ken Hoover)
0.11 (01/09/00) Original Release

This module may not work properly with PGP 5.x. Version 5 used a slightly different command-line syntax which was apparently dropped for version 6. There are no current plans to test or modify this module for use with PGP 5.

Jason M. Hinkle

Copyright (c) 2001 Jason M. Hinkle. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.