http://qs321.pair.com?node_id=1062044

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi there Monks!
I am trying to encrypt a file using Crypt::OpenPGP, when it runs it does not give me any errors, it just hangs there. Can any one take a look at my code and see where I am missing something.
#!/usr/bin/perl use strict; use warnings; use File::Basename; use Crypt::OpenPGP; my $ring = Crypt::OpenPGP::KeyRing->new( Data => qq^-----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.8 (SunOS) mQGiBFDr..... -----END PGP PUBLIC KEY BLOCK-----^ ); my $datafile = "original.csv"; # Get just name of the original file to name the new encrypted file. my ( $encrypted ) = fileparse( $datafile, "\.[^.]*" ); # $name, $path, + $suffix open( INFILE, "< $datafile" ) or die "Could not open csv file - $!"; my $plaintext = <INFILE>; close INFILE; $ring->read; my $kb = $ring->find_keyblock_by_index(0); my $cert = $kb->encrypting_key; my $pgp = Crypt::OpenPGP->new( Compat => 'GnuPG' ); my $ct = $pgp->encrypt( Key => $cert, Data => $plaintext, Armour => 1 +) or die "ERROR: " . $pgp->errstr; open( OUTFILE, "> $encrypted.pgp" ) or die "Could not open file for en +crypted data - $!"; print OUTFILE $ct; close OUTFILE;
Thanks for looking!