I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2007-01-22 17:40:57-08 by dbrems
Decryption problem - decryption too short
Hi, When a try to decrypt a file with Crypt::OpenPGP, the plaintext is limited to 13276 chars. The same file decrypted with PGP generate a plain text file of 73921 KB. Here is the code I use for decryption:
use Crypt::OpenPGP; print "Trying OpenPGP\n"; my $pgp = Crypt::OpenPGP->new( SecRing=>"C:/Program Files/Network Associates/PGPNT/PGP Keyrings/secring.skr", PubRing=>"C:/Program Files/Network Associates/PGPNT/PGP Keyrings/pubring.pkr" ); open( OUTFILE, ">C:/test/test.txt"); binmode(OUTFILE); my $cmp=0; my $pt; until ($pt) { $cmp=+1; print "Rotation : $cmp - "; $pt = $pgp->decrypt( Filename => "C:/test/test.pgp", Passphrase => "PASSPHRASE", ); print "Decrypt length: ". length($pt). "\n"; unless ($pt) { if ($pgp->errstr =~ /Bad checksum/) { print "Error: Bad passphrase.\n\n"; } else { die $pgp->errstr; } } } # Write decrypted to file print OUTFILE $pt; close(OUTFILE); print "File Written\n";
The output:
Trying OpenPGP Rotation : 1 - Decrypt length: 13276 File Written
Any idea ? Thanks
Direct Responses: Write a response