Zippy1970 has asked for the wisdom of the Perl Monks concerning the following question:
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.cerAs 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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: AES support for Crypt::OpenSSL::RSA?
by Anonymous Monk on Feb 04, 2014 at 05:31 UTC | |
by Zippy1970 (Novice) on Feb 04, 2014 at 12:01 UTC | |
by Zippy1970 (Novice) on Feb 04, 2014 at 22:43 UTC | |
|
Re: AES support for Crypt::OpenSSL::RSA?
by kschwab (Vicar) on Feb 04, 2014 at 04:10 UTC | |
by Zippy1970 (Novice) on Feb 04, 2014 at 10:28 UTC | |
|
Re: AES support for Crypt::OpenSSL::RSA?
by Mr. Muskrat (Canon) on Feb 05, 2014 at 21:26 UTC | |
by Zippy1970 (Novice) on Feb 06, 2014 at 00:47 UTC |