Having an issue with trying to encrypt and sign a message using Crypt::OpenPGP
Here is my code
my $ct = $pgp->encrypt( Filename => 'plain.txt', Recipients => $key, C
+ipher => 'DES3', SignKeyID => $signkey, SignPassphrase => $GPG_PP ) o
+r die "Encryption failed: ", $pgp->errstr;
if ($ct) {
open( my $fh, '>', 'encrypted.gpg' );
print $fh $ct;
close $fh;
} else {
#print "gpg failed: $pgp->errstr\n";
$err = Crypt::OpenPGP->errstr;
print "gpg failed: $err\n";
}
Here is the error message I get:
Data too large for key size at /opt/perl-5.26.0/lib/site_perl/5.26.0/C
+rypt/OpenPGP/Key/Secret/DSA.pm line 33.
If I look at Crypt/DSA.pm I can see the error message here
my $dlen = length $dgst;
my $i = bitsize($key->q) / 8;
croak "Data too large for key size"
if $dlen > $i || $dlen > 50;
If I comment out the croak and following if line I can execute the code with no issues.
Is there a better workaround then this?