Crypt::OpenSSL::RSA - "panic: sv_setpvn called with negative strlen"

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top