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

Discussion in 'Perl Misc' started by Taylor Venable, Oct 4, 2007.

  1. 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!
    Taylor Venable, Oct 4, 2007
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AdrianK
    Replies:
    0
    Views:
    1,534
    AdrianK
    Jul 9, 2003
  2. John Bergstrom
    Replies:
    0
    Views:
    1,223
    John Bergstrom
    Aug 3, 2003
  3. Cosmia Luna
    Replies:
    4
    Views:
    327
    Cosmia Luna
    Mar 11, 2012
  4. John Bergstrom
    Replies:
    0
    Views:
    99
    John Bergstrom
    Aug 3, 2003
  5. Jerry Krinock
    Replies:
    1
    Views:
    366
    Jerry Krinock
    Aug 20, 2008
Loading...

Share This Page