Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

Is it possible to extract userid from GPG public key?

I got public key only and want to know to whom it might belong. I find one possible workaround — to publish this information on keyserver — it decodes information and reveals it to public. But I'm not sure, I should do this.

Is it possible to extract userid using command line gpg?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Use gpg --list-packets [filename] to list all data packets, then grep for user IDs. For example:

$ gpg --export 0xDED9B508F4E10DB2 | gpg --list-packets | Egrep '^:user ID packet'
:user ID packet: "John Doe <john@example.org>"

An alternative would be to use pgpdump

$ gpg --export 0xDED9B508F4E10DB2 | pgpdump | Egrep '^[[:space:]]*User ID'
    User ID - John Doe <john@example.org>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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