1

Let's say I have various keys, some adhering to PGP 5, others to PGP 2, and maybe some were made with the original PGP. How should I go about discerning this?

Alex V
  • 111
  • Anyone who reads this: the answer posted here is wrong. It gives you the packet version, which is not at all the PGP version (see the comment on the answer for more info). So this question is still in search of an answer. – Alex V Sep 09 '20 at 22:55

1 Answers1

1

Using the command gpg -v [my-key-file] gives you the relevant information. (using -vv instead of -v gives even more info). The gpg command will try to guess what you mean and assumes you want to print the key info. For example, if I run

gpg -vv E82ED48BE6BC6DDAFC89509D62464EEB7E00F58D.asc

I get

gpg: WARNING: no command supplied.  Trying to guess what you mean ...
gpg: armor: BEGIN PGP PUBLIC KEY BLOCK
# off=0 ctb=99 tag=6 hlen=3 plen=525
:public key packet:
    version 4, algo 1, created 1593060860, expires 0
    pkey[0]: [4096 bits]
    pkey[1]: [17 bits]
    keyid: 62464EEB7E00F58D
# off=528 ctb=b4 tag=13 hlen=2 plen=5
:user ID packet: "Babba"
# off=535 ctb=89 tag=2 hlen=3 plen=590
:signature packet: algo 1, keyid 62464EEB7E00F58D
    version 4, created 1593060860, md5len 0, sigclass 0x13
    digest algo 8, begin of digest af c1
    hashed subpkt 33 len 21 (issuer fpr v4 E82ED48BE6BC6DDAFC89509D62464EEB7E00F58D)
    hashed subpkt 2 len 4 (sig created 2020-06-25)
    hashed subpkt 27 len 1 (key flags: 03)
    hashed subpkt 11 len 4 (pref-sym-algos: 9 8 7 2)
    hashed subpkt 21 len 5 (pref-hash-algos: 10 9 8 11 2)
    hashed subpkt 22 len 3 (pref-zip-algos: 2 3 1)
    hashed subpkt 30 len 1 (features: 01)
    hashed subpkt 23 len 1 (keyserver preferences: 80)
    subpkt 16 len 8 (issuer key ID 62464EEB7E00F58D)
    data: [4095 bits]
# off=1128 ctb=b9 tag=14 hlen=3 plen=525
:public sub key packet:
    version 4, algo 1, created 1593060860, expires 0
    pkey[0]: [4096 bits]
    pkey[1]: [17 bits]
    keyid: 7116EC30AC0012C2
# off=1656 ctb=89 tag=2 hlen=3 plen=566
:signature packet: algo 1, keyid 62464EEB7E00F58D
    version 4, created 1593060860, md5len 0, sigclass 0x18
    digest algo 8, begin of digest c6 68
    hashed subpkt 33 len 21 (issuer fpr v4 E82ED48BE6BC6DDAFC89509D62464EEB7E00F58D)
    hashed subpkt 2 len 4 (sig created 2020-06-25)
    hashed subpkt 27 len 1 (key flags: 0C)
    subpkt 16 len 8 (issuer key ID 62464EEB7E00F58D)
    data: [4093 bits]
pub   rsa4096 2020-06-25 [SC]
      E82ED48BE6BC6DDAFC89509D62464EEB7E00F58D
uid           Babba
sig        62464EEB7E00F58D 2020-06-25   [selfsig]
sub   rsa4096 2020-06-25 [E]
sig        62464EEB7E00F58D 2020-06-25   [keybind]
Serpent27
  • 141
  • 1
    See https://www.gnupg.org/gph/en/pgp2x.html and https://stackoverflow.com/questions/22136029/how-to-display-gpg-key-details-without-importing-it – Serpent27 Sep 09 '20 at 20:18
  • The version listed there refers to packet versions: https://tools.ietf.org/html/rfc4880#section-5.5.2

    eg, version 4 packets are from pgp 5, whereas version 3 packets originate in pgp 2

    So while that indirectly could hint at the pgp version of key, in and of itself it's not the same

    – Alex V Sep 09 '20 at 20:36