How do I obtain non-encrypted private key data (p,q,u,d) of RSA in GnuPG?

1

I didn't find anyway to see and save primers p and q (non-encrypted)in GnuPG. I decided to change the source code of GnuPG (rsa.c) to give me p and q. But it wasn't logical. However, I think there is a way, or instruction to obtain p and q (and u ,d), because I have the private key in GnuPG. Actually I made one RSA key in GnuPG. I could find the instructions to obtain the public and private key in GnuPG, But I couldn't obtain p, q, u, d.

The questions are: How to obtain p,q,u,d in GnuPG?

nmhd

Posted 2017-06-05T15:21:22.603

Reputation:

Answers

2

GnuPG until 2.0 can export the key without passphrase protection (I'm not sure if this feature was added again for GnuPG 2.1 up to now, at least the version I've installed does not know the flag). After exporting the key, you can display the private packets integers using pgpdump.

First of all, verify gpg is still GnuPG 1.4 or GnuPG 2.0, it might also be called gpg1 by now, or you have to install it additionally:

gpg --version

Then, export the key and have pgpdump print private packages (-p) and the bare integers (-i):

gpg --export-options export-reset-subkey-passwd,export-minimal --export-secret-subkeys a4ff2279 | pgpdump -pi

For understanding the exact package structure, digging through RFC 4880, OpenPGP is recommended.

Jens Erat

Posted 2017-06-05T15:21:22.603

Reputation: 14 141