Crypt::Perl::RSA::Generate - RSA key generation
use Crypt::Perl::RSA::Generate (); #$prkey is a Crypt::Perl::RSA::PrivateKey instance. my $prkey = Crypt::Perl::RSA::Generate::create(2048);
Unfortunately, this is quite slow in Perl—too slow, in fact, if you don’t have either Math::BigInt::GMP or Math::BigInt::Pari. The logic here will still run under pure Perl, but it’ll take too long to be practical.
The current Math::ProvablePrime backend is slated to be replaced with Math::Prime::Util; once that happens, pure-Perl operation should be much more feasible.
openssl
my $rsa_pem = qx/openssl genrsa/
NOTE: As of December 2016, Crypt::PK::RSA is NOT suitable for key generation because it can only generate keys with up to a 512-bit modulus.
To install Crypt::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crypt::Perl
CPAN shell
perl -MCPAN -e shell install Crypt::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.