Hi, First of all, I'm very new to OpenSSL (not so new to Perl) so if I do nooby stuff it's because I am. ;) I'm currently trying to implement iDEAL (an online payment method developed by banks) for a website and I'm trying to do it in Perl (which is my preferred choice of programming language). Now all publicly available code (and APIs) for this is in PHP. So far I haven't found a single line of code for Perl. Anyway, one of the things I need to do is sign XML. For this purpose I need to create a private/public key pair like this:
 openssl genrsa -aes128 -out priv.pem -passout pass:[privatePassKey] 2048

 openssl req -x509 -sha256 -new -key priv.pem -passin pass:[privatePassKey] -days 1825 -out cert.cer
As said, I need to sign XML using my private key. I do that as follows:
  use Crypt::OpenSSL::RSA;

  my $key_string = _SlurpFile( "priv.pem" );
  my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key( $key_string );
  $rsa_priv->use_pkcs1_padding();
  $rsa_priv->use_sha256_hash();
  my $signature = $rsa_priv->sign( $XMLToSign );
The problem is that this generates the following error
  RSA.xs:178: OpenSSL error: unsupported encryption at test.pl line 160.
and line 160 being
  my $rsa_priv = Crypt::OpenSSL::RSA->new_private_key( $key_string );
After some searching, I found out that I could get rid of this error by including this:
  use Net::SSLeay;
  Net::SSLeay::OpenSSL_add_all_algorithms();
Now I no longer get the error but when I run the code, it now prompts me with this:
  Enter PEM pass phrase:
Since this is going to be an unattended cgi script, I want it to use my privatePassKey automatically, obviously. So is there another way to get rid of the (unsupported encryption) error? If not, is there a way I can get it to accept a password automatically?

In reply to AES support for Crypt::OpenSSL::RSA? by Zippy1970

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.