in reply to Crypt::RSA Cant load private key

It looks like you have a typo (use strict and warnings):
$keyFile = shift; $key = new Crypt::RSA::Key::Private ( Filename => $keyFilkeyFile }
Try:
$keyFile = shift; $key = new Crypt::RSA::Key::Private ( Filename => $keyFile }

Replies are listed 'Best First'.
Re^2: Crypt::RSA Cant load private key
by ulisescastillo (Initiate) on Jan 09, 2012 at 19:31 UTC
    Now getting this error
    RSA.xs:146: OpenSSL error: no start line at decryption.pl line 40.
    when trying:
    $stringKey = encode_base64(readKey($keyFIle)); $rsa_priv = Crypt::OpenSSL::RSA->new_private_key($stringKey); sub readKey{ $llave = shift; open (FILE, $llave); binmode(FILE); while (read(FILE, $buff, 1024)) { #4)) { $key.= $buff; } close FILE; return $key; }
    I use encode_base64 because Crypt::OpenSSL::RSA->new_private_key needs a string, or what is the correct way to do this?
        This is the result of executing the script you suggested:
        1..43 # Running under perl version 5.008008 for MSWin32 # Win32::BuildNumber 817 # Current time local: Mon Jan 9 18:36:07 2012 # Current time GMT: Tue Jan 10 00:36:07 2012 # Using Test.pm version 1.25 ok 1 ok 2 ok 3 ok 4 ok 5 ok 6 ok 7 ok 8 ok 9 ok 10 ok 11 ok 12 ok 13 ok 14 ok 15 ok 16 ok 17 ok 18 ok 19 ok 20 ok 21 Can't locate auto/Crypt/OpenSSL/RSA/is_private.al in @INC (@INC contai +ns: C:/Perl/lib C:/Perl/site/lib .) at Test.pl line 95

        But my actually my problem is to load the private key from a file, or if string (with openSSL, how do I?)