my $PGP_Verschluesselung = Crypt::OpenPGP->new(); my %attrib = ( 'Type' => 'RSA' , 'Size' => '1024' , 'Identity' => 'Administrator Administrator@meinedomain.de', 'Passphrase' => 'password' , 'Cipher' => 'DES3' , 'Verbosity' => '1' , 'Compat' => 'PGP5' , ); my ( $pubkey, $privkey ) = $PGP_Verschluesselung -> keygen( %attrib ) or die $PGP_Verschluesselung -> errstr; my $public = $pubkey -> save; open( PUBLIC , "> test.public" ) or die "COULD NOT OPEN Public Key" , "\n"; print PUBLIC $public; close( PUBLIC ); my $private = $privkey -> save; open( PRIVATE , "> test.private" ) or die "COULD NOT OPEN Private Key" , "\n"; print PRIVATE $private; close( PRIVATE ); my $pgp = Crypt::OpenPGP->new ( "PubRing" => 'test.public' )or die Crypt::OpenPGP->errstr; my $ciphertext = $pgp->encrypt ( "Compat" => 'PGP5', "Data" => 'this is a test', "Recipients" => 'Administrator Administrator@meinedomain.de', "Armour" => 1, ); die "Encryption failed: ", $pgp->errstr unless $ciphertext; print $ciphertext;