Reviews by Antti Lankila

cpanratings
 

RSS

Crypt-RSA (1.58) ****

It is possible to use "openssl rsa -in foo.cert.pem -text -noout" to dump the keys. Alternatively, you could probably parse them yourself with Convert::ASN1. It's nontrivial, though, ASN.1 being what it is, I guess. Besides, there is no proper x509v3 reader for Perl. (I have some certs here which Convert::ASN1's x509 example can not read.)

So just use openssl.

The parameters you want are called modulus, private exponent and public exponent. They go by the names N, D and E. Use N and D for privkey and N and E for pubkey.

There is a bug in Crypt::RSA::Key::Private, and this doesn't work:

my $key = Crypt::RSA::Key::Private->new();
$key->n($n); # where $n is "0x12345678", the hexdigits dumped by openssl without space or colons.

You have to do:

$key->n(Math::Pari::_hex_cvt($n))

until it is fixed. Public key accessor methods n() and e() do work, though. I have already reported this issue, but no new version exists as of this date.