| 1 |
=pod |
| 2 |
|
| 3 |
=encoding utf-8 |
| 4 |
|
| 5 |
=head1 NAME |
| 6 |
|
| 7 |
Crypt::RSA::Parse - Parse RSA keys |
| 8 |
|
| 9 |
=head1 SYNOPSIS |
| 10 |
|
| 11 |
#General-purpose, native RSA or PKCS8 (DER or PEM) |
| 12 |
my $public_rsa = Crypt::RSA::Parse::public($key_str); |
| 13 |
my $private_rsa = Crypt::RSA::Parse::private($private_key_str); |
| 14 |
|
| 15 |
$public_rsa->exponent(); #alias E() |
| 16 |
$public_rsa->modulus(); #isa Math::BigInt, alias N() |
| 17 |
$public_rsa->size(); #i.e., the modulus length in bits |
| 18 |
|
| 19 |
$private_rsa->version(); #usually 0 |
| 20 |
$private_rsa->modulus(); #isa Math::BigInt, alias N() |
| 21 |
$private_rsa->size(); #i.e., the modulus length in bits |
| 22 |
|
| 23 |
$private_rsa->publicExponent(); #same as public “exponent”, alias E() |
| 24 |
$private_rsa->privateExponent(); #isa Math::BigInt, alias D() |
| 25 |
$private_rsa->prime1(); #isa Math::BigInt, alias P() |
| 26 |
$private_rsa->prime2(); #isa Math::BigInt, alias Q() |
| 27 |
$private_rsa->exponent1(); #isa Math::BigInt, alias DP() |
| 28 |
$private_rsa->exponent2(); #isa Math::BigInt, alias DQ() |
| 29 |
$private_rsa->coefficient(); #isa Math::BigInt, alias QINV() |
| 30 |
|
| 31 |
#Only checks PKCS8 (DER or PEM) |
| 32 |
$public_rsa = Crypt::RSA::Parse::public_pkcs8($pkcs8_str); |
| 33 |
$private_rsa = Crypt::RSA::Parse::private_pkcs8($pkcs8_str); |
| 34 |
|
| 35 |
{ |
| 36 |
#If, for whatever reason, you don’t like MIME::Base64, |
| 37 |
#then customize this. The module must have a decode() function. |
| 38 |
# |
| 39 |
local $Crypt::RSA::Parse::BASE64_MODULE = '..'; |
| 40 |
|
| 41 |
Crypt::RSA::Parse::... |
| 42 |
} |
| 43 |
|
| 44 |
=head1 DESCRIPTION |
| 45 |
|
| 46 |
Not much else to say: it parses RSA keys for useful information! |
| 47 |
|
| 48 |
The public keys are represented via the C<Crypt::RSA::Parse::Public> |
| 49 |
class, while private keys are represented via C<Crypt::RSA::Parse::Private>. |
| 50 |
|
| 51 |
=head1 AUTHOR |
| 52 |
|
| 53 |
Felipe M. L. Gasper |
| 54 |
CPAN ID: FELIPE |
| 55 |
|
| 56 |
=head1 REPOSITORY |
| 57 |
|
| 58 |
https://github.com/FGasper/p5-Crypt-RSA-Parse |
| 59 |
|
| 60 |
=head1 COPYRIGHT |
| 61 |
|
| 62 |
This program is free software; you can redistribute |
| 63 |
it and/or modify it under the same terms as Perl itself. |
| 64 |
|
| 65 |
The full text of the license can be found in the |
| 66 |
LICENSE file included with this module. |
| 67 |
|