Alt-Crypt-RSA-BigInt
view release on metacpan or search on metacpan
Changes.old view on Meta::CPAN
* Fixed a bug in ::ES::PKCS1v15 caused by inclusion of null characters
in the padding string. Null chars are used as delimiters in PKCS #1
v1.5 encoding. Thanks to Ganèche <gramanoudjame@promonetic.com>
for reporting this bug.
1.36 April 10, 2001
* Modified Crypt::RSA::encrypt() to return an error when the keysize is
too small for use with the selected scheme.
* Modified Crypt::RSA ::ES::* and ::SS::* to work with keysizes
that are not multiples of 8.
* Wrote ::DataFormat::octet_len() to computes the octet length of
an integer.
* Wrote exportable ::Debug::debuglevel(). Use debuglevel(1) to turn on
debugging.
lib/Crypt/RSA/Key.pm view on Meta::CPAN
$params{Size} % 2;
my $size = int($params{Size}/2);
my $verbosity = $params{Verbosity} || 0;
# Switch from Maurer prime to nbit prime, then add some more primality
# testing. This is faster and gives us a wider set of possible primes.
# We really ought to consider the distribution. See:
# https://crocs.fi.muni.cz/_media/public/papers/usenixsec16_1mrsakeys_trfimu_201603.pdf
# for comments on p/q selection.
while (1) {
my $p = random_nbit_prime($size);
my $q = random_nbit_prime($size);
$p = Math::BigInt->new("$p") unless ref($p) eq 'Math::BigInt';
$q = Math::BigInt->new("$q") unless ref($q) eq 'Math::BigInt';
# For unbiased rejection sampling, generate both p/q if size too small.
next unless bitsize($p * $q) == $params{Size};
( run in 1.138 second using v1.01-cache-2.11-cpan-49f99fa48dc )