29

Upon executing apt-key list, I see a key which I wish to remove.

...
pub   rsa2048 2017-11-24 [SC]
      3241 413F 3CE0 B919 E82F  DCA0 6239 92CF C9A9 7C2C
uid           [ unknown] John Doe <[email protected]>
sub   rsa2048 2017-11-24 [E]
...

man apt-key tells me that I may delete a key by executing apt-key del keyid. It also tells me that list (aka finger) will list trusted keys with fingerprints, so I am assuming that 3241 413F 3CE0 B919 E82F DCA0 6239 92CF C9A9 7C2C is the fingerprint and not the keyid. I've messed around with gpg --list-keys and gpg --list-public-keys, however, it doesn't list any keys but creates ~/.gnupg/ with various non-text files which do not display the key IDs.

How can I identify the keyid so I may delete the key?

PS. Before asking this question, I searched for a solution, and some recommend not using "short key ids". If I should not be deleting keys by the keyid as described by man apt-key, please provide the appropriate way.

user1032531
  • 1,877
  • 6
  • 29
  • 35

1 Answers1

46

The keyid is the last 8 characters of the gpg key's fingerprint, which is that long hex-code under pub

In your case it is: sudo apt-key del C9A97C2C

Reference:

Rob Truxal
  • 153
  • 1
  • 5
mja
  • 1,335
  • 1
  • 14
  • 25