in reply to Re: Crypt::RSA without Pari
in thread Crypt::RSA without Pari

My perl instances seems to be using Math::BigInt::GMP
#/opt/perl/bin/perl -E 'use Crypt::RSA::Key; my($pari,$big) = ($Math:: +Pari::VERSION, $Math::BigInt::VERSION); my $lib = Math::BigInt->confi +g()->{lib} if $big; printf "Using %s\n", $pari ? "Pari $pari" : $big +? "BigInt with $lib" : "???";' Using BigInt with Math::BigInt::GMP
However, when run the following using an RSA public key
my $ct = $pgp->encrypt( Filename => 'plain.txt', Recipients => $key, C +ipher => 'DES3' ) or die "Encryption failed: ", $pgp->errstr;
I see Pari library being opened.
#truss ./encrypt_openpgp.pl 2>&1 | grep open | grep Pari open64("/opt/perl-5.26.0/lib/site_perl/5.26.0/sun4-solaris-thread-mult +i/Math/Pari.pm", O_RDONLY) = 4 open("/opt/perl-5.26.0/lib/site_perl/5.26.0/sun4-solaris-thread-multi/ +auto/Math/Pari/Pari.so", O_RDONLY) = 4
And when I see my code hanging it always has this file open: /opt/perl-5.26.0/lib/site_perl/5.26.0/Crypt/Random.pm

If I remove Math::Pari he program fails with
./encrypt_openpgp.pl No random source available! at /opt/perl-5.26.0/lib/site_perl/5.26.0/C +rypt/OpenPGP/Util.pm line 111.
sub get_random_bytes { 103 my $length = shift; 104 if (eval 'require Crypt::Random; 1;') { 105 return Crypt::Random::makerandom_octet( Length => +$length); 106 } 107 elsif (eval 'require Bytes::Random::Secure; 1;') { 108 return Bytes::Random::Secure::random_bytes($length +); 109 } 110 else { 111 die "No random source available!"; 112 } 113 }

Replies are listed 'Best First'.
Re^3: Crypt::RSA without Pari
by roperl (Beadle) on Oct 30, 2017 at 20:56 UTC
    I think i figured out what was happening. I didn't have Bytes::Random::Secure, so OpenPGP was still calling Crypt::Random which still uses Pari I removed and rebuilt OpenPGP. Now I don't see any references to the Pari library I'll see if this fixes my hanging issue