Crypt-PGP2

 view release on metacpan or  search on metacpan

PGP2.pm  view on Meta::CPAN

# Date   : 2001 01 22
# Version: see $VERSION
# Purpose: generate PGP ciphertext using external pgp utility
# Env    : Perl5 and IPC::Open3
# Usage  : my ($ciphertext, $msg, $error) = Crypt::PGP2::encrypt($plaintext,'my secret text','at');
# Returns: list with 3 elements (see POD for details)
# Notes  : see the POD documentation also
#          - Perl signals should not be used to monitor the pipes as they are unsafe
#            However, the $msg return will give the pgp status code, if available.
#          - Only 3 files are needed to encrypt a file with a public key:
#            pubring.pgp, randseed.bin, and config.txt (chmod 400 *) ?
#          - permissions on tmp, .pgp must be set correctly (chmod 100 .pgp) ?
#          - PGP generates temp files. The names of these files can be seen when +verbose=3
#          - You must use more than 512 bit keys to be secure.

sub encrypt {
   # retrieve arguments
   my ($plaintext, $key, $options) = @_;

   return ('', '', PGP_ERR_MISSING_KEY) if not defined $key or $key eq '';
   return ('', '', PGP_ERR_MISSING_TEXT) if not defined $plaintext or $plaintext eq '';



( run in 0.257 second using v1.01-cache-2.11-cpan-8d75d55dd25 )