1

I have a PGP public key and I need to get the fingerprint for it.

My Public key is as such:

-----BEGIN PGP PUBLIC KEY BLOCK-----
mQlDBF4w............................
.
.
.
=uYgH
-----END PGP PUBLIC KEY BLOCK-----

I tried using the command gpg --with-fingerprint key.txt but it gives me the following output and there is no fingerprint in it:

gpg: WARNING: no command supplied.  Trying to guess what you mean ...
pub   rsa4096 2020-01-28 [SC]
uid           cko_key <something@something.com>
sub   rsa4096 2020-01-28 [E]

Can someone please help me?

Mervin Hemaraju
  • 105
  • 2
  • 13

2 Answers2

2

The --with-fingerprint is an option, not a command. This option modifies the output of the --list-keys (for keys in the keyring) or --show-keys (for keys in files) command to include the fingerprint.

So the command you are looking for is

gpg --show-keys --with-fingerprint key.txt

If you need to process this further, e.g. from a script, you can also use the --with-colons option to get machine-readable output.

Note that there can be multiple keys in the output, and for the colon-separated output, multiple fingerprints even for a single key, because that also shows the fingerprints of subkeys.

Simon Richter
  • 3,209
  • 17
  • 17
1

Found this answer for you and I believe it's the same issue you are having:

https://unix.stackexchange.com/a/448986/350132

Cerberton
  • 126
  • 4