#!/usr/local/bin/perl -w use Crypt::OpenPGP; # slurp in file of ciphertext: open( my $fh, "/home/nobody/tools/crypt/cipher.txt") or die "flaming death\n"; my $Data = do { local( $/ ) ; <$fh> } ; my $pgp = Crypt::OpenPGP->new ( "SecRing" => "/home/nobody/.keys/secring.skr" ); my $plaintext = $pgp->decrypt ( "Compat" => "PGP5", "Data" => $Data, "Passphrase" => "no, you cant have it" ); die "Decryption Failed: ", $pgp->errstr unless $plaintext; print "plain text:\n" . $plaintext . "\n";