Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^3: Private keys in Crypt::RSA

by traveler (Parson)
on Mar 07, 2007 at 22:12 UTC ( #603732=note: print w/replies, xml ) Need Help??

in reply to Re^2: Private keys in Crypt::RSA
in thread Private keys in Crypt::RSA

The key is not a scalar. It is an object. The private key is an object of type Crypt::RSA::Key::Private. When you store it do you serialize the object and then unserialize it on retrieval? If not, you are probably not saving and restoring the object itself.

From the error (and checking the code) it seems that you are trying to treat the key as though it were just the raw key value iteslf (a scalar), which it is not.

Replies are listed 'Best First'.
Re^4: Private keys in Crypt::RSA
by dchoksi (Initiate) on Jun 26, 2007 at 15:08 UTC
    Hi, I am trying to use deserialize i get an error every time "n is not a number". I have generated a set of keys and dont want to store private key any where. Currently as I am testing my code I have stored the serialize key as variable. It does not error when i pass it to $private->deserialize but errors when I call $rsa->decrypt. Can you please help me. thanks

      I realize this is an ancient thread, but I ran across the same error and finally figured out the problem.

      After de-serializing the private key (I just used the Crypt::RSA::Key::Private->read method) you MUST use the 'reveal' method and give it the password you originally used to generate the keypair.

      my $rsa_private = new Crypt::RSA::Key::Private; my $private = $rsa_private->read(Filename => "id_rsa"); ## This is vital if you want the loaded private key to work. $private->reveal(Password => "originalkeypairpassword");

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://603732]
[holli]: meh, silent night
[holli]: also sad
[shmem]: halluzination beats newspaper in realism, sometimes

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2017-09-22 20:57 GMT
Find Nodes?
    Voting Booth?
    During the recent solar eclipse, I:

    Results (269 votes). Check out past polls.