T
Taylor Venable
Hello,
I've read in an RSA private key from a PEM-encoded file and I'm trying to
use the Crypt::OpenSSL::RSA module to decrypt some data. But when I
actually call the decrypt() function on the key object, I get the following
error:
panic: sv_setpvn called with negative strlen
A bit of Googling shows that this has happened before, but never in the same
context, sometimes with a supposed fix (even supposedly in the Perl core
itself) but usually without much mention as to the cure. My current plan
is to just send everything to the command-line implementation of OpenSSL,
but it would be nicer to be able to handle it from the Perl module.
For context, the bit of code that causes the fault is this:
my $rsa = Crypt::OpenSSL::RSA->new_private_key($$data{'private-key'});
$rsa->use_pkcs1_padding();
my $response = $rsa->decrypt($$data{'challenge'});
Where $$data{'private-key'} holds the exact contents of the PEM-encoded
private key file.
Thanks for any ideas!
I've read in an RSA private key from a PEM-encoded file and I'm trying to
use the Crypt::OpenSSL::RSA module to decrypt some data. But when I
actually call the decrypt() function on the key object, I get the following
error:
panic: sv_setpvn called with negative strlen
A bit of Googling shows that this has happened before, but never in the same
context, sometimes with a supposed fix (even supposedly in the Perl core
itself) but usually without much mention as to the cure. My current plan
is to just send everything to the command-line implementation of OpenSSL,
but it would be nicer to be able to handle it from the Perl module.
For context, the bit of code that causes the fault is this:
my $rsa = Crypt::OpenSSL::RSA->new_private_key($$data{'private-key'});
$rsa->use_pkcs1_padding();
my $response = $rsa->decrypt($$data{'challenge'});
Where $$data{'private-key'} holds the exact contents of the PEM-encoded
private key file.
Thanks for any ideas!