The Computer Oracle

How to make GnuPG display full 8-byte/64-bit key ID?

Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn

--

Music by Eric Matyas
https://www.soundimage.org
Track title: Cosmic Puzzle

--

Chapters
00:00 Question
00:54 Accepted answer (Score 89)
01:11 Answer 2 (Score 21)
01:32 Answer 3 (Score 13)
01:53 Answer 4 (Score 9)
02:39 Thank you

--

Full question
https://superuser.com/questions/619145/h...

Answer 1 links:
[You can see the long key ID using the option ]: http://www.gnupg.org/documentation/manua...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#gnupg

#avk47



ACCEPTED ANSWER

Score 92


Alternatively you can use:

gpg --keyid-format LONG -k 0xDEADBEEF

Or:

gpg --keyid-format 0xLONG -k 0xDEADBEEF



ANSWER 2

Score 21


You can see the long key ID using the option --with-colons (yes, very intuitive).

To print only the long key ID, use something like:

$ gpg --list-keys --with-colons XXXXXXXX | awk -F: '/^pub:/ { print $5 }'



ANSWER 3

Score 14


Just to point out a sanely named option to remember,

GnuPG 2.2.13 on macOS Catalina 10.15.4, --list-signatures option displays the key ID as well:

$ gpg --list-signatures



ANSWER 4

Score 9


gpg --version                              

# gpg (GnuPG) 2.2.19
# libgcrypt 1.8.5

To get the Short KeyId of the existing keys. In the example below there is only 1 key and the short keyid is 567C9ABC, displayed after rsa4096

gpg --list-keys --keyid-format SHORT

#~/.gnupg/pubring.kbx
#pub   rsa4096/567C9ABC 2021-03-06 [SC]

The Long KeyId = 32FA0BE4567C9ABC

gpg --list-keys --keyid-format LONG
#pub   rsa4096/32FA0BE4567C9ABC 2021-03-06 [SC]

EDIT: the keyId could be obtained using either gpg --list-keys or gpg --list-secret-keys