Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

RSA and LINUX Issue

by m2mcgui (Initiate)
on Jan 18, 2013 at 13:49 UTC ( #1014058=perlquestion: print w/replies, xml ) Need Help??
m2mcgui has asked for the wisdom of the Perl Monks concerning the following question:

I have a script which uses a RSA digital signature as one of the records in a report. We are transitioning from a UNIX environment to a LINUX environment. When the private key is read, it produces the following output:
PARI: *** incorrect type in a transcendental function. at /opt/sta +ndard_perl/perl5881/lib/5.8.8/x86_64-linux/Math/ line 994.

Here is the code that I am trying to execute:

$private_key = new Crypt::RSA::Key::Private; $pkey = $private_key->read(Filename => $private_file); $RSA_tmp = $RSA_object->sign(Message => $PI_string, Key => $pkey);

In tracing through the code using the debugger it was discovered in LINUX that the data being loaded for the HASH table was the following: This is producing the values:

TEST = $VAR1 = bless( { 'Version' => '1.91', 'Cipher' => 'Blowfish' }, 'Crypt::RSA::Key::Private' ); HASH{_dq } => 0000000000000003 HASH{_d } => 0000000000000003 HASH{_n } => 0000000000000003 HASH{_q } => 0000000000000003 HASH{_e } => 0000000000000003 HASH{_p } => 0000000000000003 HASH{_dp } => 0000000000000003

This should reveal a very long number not just 3 for every value. So there seems to be something within the read. At this point, I tried to create a new key and received the following error:

PARI: *** incorrect type in gfloor. at /opt/standard_perl/perl5881 +/lib/5.8.8/Crypt/ line 580.

This is the only code running for that error:

#!/opt/standard_perl/perl5881/bin/perl -w use Crypt::RSA; my $keychain = new Crypt::RSA::Key; my ($public, $private) = $keychain->generate ( Identity => "test", Size => 1024, Verbosity => 1) or die $keychain->errstr(); $private->write( Filename => 'spi4500eb.private'); $public->write( Filename => 'spi4500eb.public');

I tried adding password to the file as seen in some of the other responses within this web site, but that did not work either. We are using Perl And here is the modules being utilized:

use Digest::MD5; use Crypt::RSA; use Crypt::RSA::Key::Private; use Crypt::RSA::Key::Public; use Crypt::RSA::SS::PKCS1v15;

My question is has anyone seen this before? And if so, what did you do to fix it? Any help is greatly appreciated. Thanks in advance.

Replies are listed 'Best First'.
Re: RSA and LINUX Issue
by davido (Archbishop) on Jan 18, 2013 at 17:28 UTC

    Well the good news is that there seems to be an effort under way to eliminate the Math::Pari dependency from Crypt::RSA, and to make as much of the tool chain pure Perl as possible. See This mail archive.

    The bad news is that having posted your private key publically, you have bigger problems to work on... at least until the boss finds out.


Re: RSA and LINUX Issue
by tobyink (Abbot) on Jan 18, 2013 at 14:13 UTC

    Is it wise to publish your RSA private key on a public website?

    I think not.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
    div class=

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1014058]
Approved by vinoth.ree
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2018-03-17 11:27 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (224 votes). Check out past polls.