|
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 |