gpg – Help Understanding gpg –list-keys Output

gpg

when I run gpg --list-keys I get the following output.

/home/yax/.gnupg/pubring.kbx
----------------------------
pub   rsa2048 2020-10-09 [SC]
      4424C645C99A4C29E540C26AAD7DB850AD9CFFAB
uid           [ultimate] yaxley peaks <epiclycoolgaemer@gmail.com>
sub   rsa2048 2020-10-09 [E]

what is my actual key in this block of text?

How do i get my key id?

what does the [SC] and the [E] mean and what does sub mean?

Here's some info regarding the key.

  1. it was generated with gpg --full-generate-key and i chose the rsa rsa option.
  2. Its 2048 bytes long

Best Answer

what is my actual key in this block of text?

It's not shown. Since this is, as you (correctly) said, an RSA 2048-bit key, your actual public key (which is what --list-keys shows) in hex would be over 500 characters -- about 7 full lines on a typical terminal. Your private key, which for hysterical raisins PGP and GPG calls 'secret', shown by --list-secret-keys, would be even longer, and in addition showing it on a terminal where in some cases a bad person might be able to get a copy of it is extremely bad for security.

How do i get my key id?

4424C645C99A4C29E540C26AAD7DB850AD9CFFAB is the fingerprint. There are two keyids, and except for v3 keys which are long obsolete, both are derived from the fingerprint. The 'short' keyid is the low 32 bits, or last 8 hex digits, of the fingerprint and thus is AD9CFFAB. The 'long' keyid is the low 64 bits, or last 16 hex digits, of the fingerprint and thus is AD7DB850AD9CFFAB. Historically the short keyid was used for almost everything, and most websites, blogs, and much documentation that you find will use and show them, but in the last few years short keyids have been successfully attacked so modern programs now default to either the long keyid or (as here) the fingerprint, but you can add them by specifying --keyid-format=long or --keyid-format=short or the equivalent option in some config file, probably .gnupg/config .

The 2048R/0B2B9B37 you found somewhere is an example of the format used by old versions of GPG. It used a single letter R for RSA, because in the old days there were really one three types of keys (and algorithms) to distinguish while now there are more; and it used the short keyid of 8 hexits.

Related Question