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

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,739
    AdrianK
    Jul 9, 2003
  2. John Bergstrom
    Replies:
    0
    Views:
    1,517
    John Bergstrom
    Aug 3, 2003
  3. alex
    Replies:
    1
    Views:
    962
    Dieter D'Hoker
    Jun 25, 2004
  4. gg
    Replies:
    0
    Views:
    3,113
  5. Cosmia Luna
    Replies:
    4
    Views:
    558
    Cosmia Luna
    Mar 11, 2012
  6. John Bergstrom
    Replies:
    0
    Views:
    251
    John Bergstrom
    Aug 3, 2003
  7. asg

    de-crypt... crypt

    asg, Dec 23, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    277
  8. Jerry Krinock
    Replies:
    1
    Views:
    559
    Jerry Krinock
    Aug 20, 2008
Loading...