Bonjour,

Le 17/08/2012 09:33, kiran Palli a écrit :

Hi,

I generated an rsa 2048 key-pair with these commands:

openssl.exe genrsa -F4 -out key.pem 2048

openssl.exe rsa -text -in key.pem > key.txt

Now I lost the key.pem file and also lost the key.txt in its original format.


That's sad. 2 files lost at the same time? And you weren't taught to take care of these? They weren't important, were they? Why don't you just throw that key away and pick a new one?

But I have private exponent and public exponent from the text file. Those were enough for my tool suite to sign a binary file and then verify. Now I need to test something with openSSL signing, but how do I recover the private key in .pem format (key.pem)?


Looks like homework. Did you ask Google?

This is the left over portion of key.txt(example, but a valid key-pair):

Private-Key: (2048 bit)

modulus:

|00:f3:5a:8f:46:08:11:d8:f7:65:eb:26:8f:e6:fe:
[...]
d2:61
|

publicExponent: 65537 (0x10001)

privateExponent:

|73:e4:bd:f4:e1:24:f6:ca:23:7c:90:99:d9:ad:9c:
[...]
11|

Using bc you can quickly get p, q, dp and dq. qinv is harder to get, but it's possible.

--
Erwann ABALEA

Reply via email to