0

For an experiment, I'm trying to open a 2048-bit RSA encrypted mail on a image. Using this fresh image, I made a memory dump and analysed the dump for RSA keys.

Now, several RSA keys have been found.

An example;

FOUND PRIVATE KEY AT 1048fb83
version = 
11 8e 48 04 06 11 
modulus = 
02 01 00 02 02 00 02 03 00 02 04 00 02 05 00 02 
06 00 02 07 00 02 08 00 02 09 00 02 0a 00 02 0b 
00 02 0c 00 02 0d 00 02 0e 00 02 0f 00 02 11 00 
02 12 00 02 13 00 02 14 00 02 15 00 02 16 00 02 
17 00 02 00 e0 02 01 e0 06 20 03 08 
publicExponent = 
0e 08 00 04 08 0e 03 08 
privateExponent = 
04 06 11 8e 54 07 20 01 
prime1 = 
12 8e 40 0d 00 04 11 8e 48 1d 0e 1d 0e 1d 
prime2 = 
0e 09 00 02 11 8e 48 1d 0e 1d 0e 06 00 01 11 8e 
48 08 07 00 02 02 1d 0e 1d 0e 05 00 01 
exponent1 = 
0e 0c 20 03 01 11 80 c8 11 80 c8 11 84 50 04 06 
11 8e 5c 05 06 0f 11 8e 68 05 06 0f 11 
exponent2 = 
06 00 00 1d 12 8f d0 06 00 01 12 8e 60 08 06 00 
00 0f 11 8e 68 06 00 00 0f 11 8e 6c 08 00 03 0f 
05 0e 08 10 18 04 06 12 8e 70 05 00 00 12 8e 70 
08 00 01 12 8e 70 12 8b 1c 07 00 01 0f 01 12 8b 
1c 08 00 02 0f 05 12 8b 1c 0e 05 08 00 12 8e 70 
04 0f 27 00 00 04 06 11 8e 78 05 00 00 12 8d c0 
06 20 01 01 11 8e 78 05 20 00 11 8e 
coefficient = 
20 02 08 0a 08 

How does one continue from here?

I got a encrypted OpenPGP message; and I need to decode it with my own private key.

I've read about CRT formats, etc. I'm looking to convert these RSA parameter values to a value that OpenGPG can read. (One block of text).

1

From the example you show, you don't continue far -- what is shown is not a valid RSA key pair, only something which superficially looked like one in the eyes of the tool you used.

Assuming you actually obtain a valid RSA key (you don't, apparently, but let's suppose that you find one), then your best bet would probably be to assemble the key with a small custom program invoking OpenSSL (the library) or Bouncy Castle. Or using the inherent capabilities of Java or .NET (both more or less know how to import and export private keys in PKCS#8 format).

I don't know of any good, easy to use ASN.1 DER encoding/decoding tools, except the ones I wrote (that was professionally, I cannot publish them as free software until I rewrite them from scratch, which I may do some day, but certainly not in the next few weeks).

  • Hi Tom, thanks for the answer. The tool found several possibilities. How could we identify a possible valid key pair quickly? – MichaelP Apr 2 '14 at 19:02
  • A valid key pair should have a long enough modulus (below 1024 bits = 128 bytes is improbable), a short public modulus (usually equal to 65537, almost always fitting on 4 bytes), and long enough prime integers. Both primes must be primes, therefore odd, and their product must be equal to the modulus, which should therefore be odd too. In-memory format of big integers in ASN.1 DER is big-endian, so the even/odd status can be seen on the last byte. Last but not least, a normal RSA keys "looks randomish"; it should not have that many zeros. – Tom Leek Apr 2 '14 at 19:17
  • 1
    Also, rsakeyfind looks for ASN.1/DER-structured private keys, and OpenPGP does not use ASN.1, so it is unclear whether what you are trying to do may ever work at all. – Tom Leek Apr 2 '14 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.