Is there some tool to write out the actual content of a GnuPG public key in a way a human can unserstand? I mean not only ascii-armor which a human can read and type, but something which really breaks down the data into large decimal numbers for the crypto part, strings for the UIDs, and so on? I'd really like to see what's in there.

Actual application today: I've two keys from the same person, created at the same date, but differing in fingerprint. The assumption is that one of them was created from the other by some kind of conversion, probably by importing the older key into a keychaing using recent software. I'd like to see what actually changed. Perhaps it's only the fingerprinting algorithm which changed, but perhaps there is more to it.

  • I found all the suggested answers before getting to this question. Unfortunately, this still sucks in being "human readable", espcially when the key has many signatures. I really expected gpg2 to readily give this information in some kind of show-key command :-( – Bluehorn Nov 9 '18 at 9:29


gpg --list-packets --verbose < pubkey.asc

It doesn't dump the key data, but it shows all the other details. To dump additional raw data parts you need debug flag 2, so add --debug 0x02, this will dump the keys and other data in hex. This works in GPG versions 1.2 and 1.4, but sadly not in 2.0 as support for dumping bignum (MPI) data is not enabled (see DBG_MPI in g10/parse-packet.c) for some reason.

Also try pgpdump:

pgpdump < pubkey.asc
| improve this answer | |
  • Looks good, but it still omits some data: some things are abbreviated as [1024 bits] or the likes. I'd like to see those bits. I know you wrote that those aren't included. – MvG Jan 4 '14 at 14:39
  • 1
    Found it, debug flag 2, updated. – mr.spuratic Jan 4 '14 at 15:25
  • That debug flag doesn't work for me, for some reason. It prints a message abozt the flag being enabled, but does not print debugging info for it. Will probably have to dig through sources to find out why… @grawity: pgpdump looks very much like what I had in mind, thank you. Any particular reason you chose to edit an existing answer instead of posting a new one. After all, both are different suggestions, each with its own merits and drawbacks, so users might want to vote independently. – MvG Jan 4 '14 at 16:03
  • 3
    This debug flag is for MPI (bignum) debugging (DBG_MPI), it works as indicated in GPG 1.2/1.4, but it's not properly supported in GPG 2.0.x (it's commented out in g10/parse-packet.c) with a "FIXME" beside it... @grawity thanks for the tip on pgpdump, looks useful. – mr.spuratic Jan 6 '14 at 21:34

While waiting for answers, I read RFC4880 (OpenPGP) and came up with some code of my own to parse and print the relevant portion of an exported packet stream. Far from complete, but it might be useful to others, so I'm posting this as well. Right now I see little benefit over that pgpdump suggested by @grawity, but who knows…

| improve this answer | |

I've used pgpdump It works well, and shows nice human-readable output. It doesn't yet print Elliptic Curve keys, but it will at least tell you it is an EC key. If you select the "dump literals" option, it will show you the actual key data.

| improve this answer | |
  • pastebin.com/pRezWQfP is an example of the output using my public key. – Brian Minton Sep 22 '14 at 18:32
  • 1
    Seems that site is gone, just some domain squatters there now... – npostavs May 17 '18 at 0:16
  • Yes, it seems that way. – Brian Minton May 18 '18 at 12:26

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.