-1

I came across a PGP public key that seems invalid. The key is a secp256k1 public key that supported by GPG. In fact, GPG allows importing that key even if it has an invalid secp256k1 public key inside.

Running --list-packets on the key shows that the pkey starts with a 46 prefix. All other secp256k1 public keys I generated or found online start with 02 if they are compressed and 04 if they are not. Starting with these two prefixes is in line with the sec-1 standard but there's nothing about a 46 prefix.

# gpg --list-packets --verbose public_key_invalid.gpg

gpg: enabled compatibility flags:
# off=0 ctb=98 tag=6 hlen=2 plen=79
:public key packet:
        version 4, algo 19, created 0, expires 0
        pkey[0]: 052B8104000A secp256k1 (1.3.132.0.10)
        pkey[1]: 4615813D2D31329D51E5A8E7C8EAA65637E9AD5DE00EA3FA65B2F1325ACED0A527B6D28E1818E1F3D797D37F3C7C8256FF5F711756255A25F422224540966ED708
        keyid: F50C012FB632C4B9
# off=81 ctb=b4 tag=13 hlen=2 plen=35
:user ID packet: "Drew Carey Buglione <drew@drewb.ug>"
# gpg --allow-non-selfsigned-uid --import public_key_invalid.gpg

gpg: key F50C012FB632C4B9: accepted non self-signed user ID "Drew Carey Buglione <drew@drewb.ug>"
gpg: key F50C012FB632C4B9: public key "Drew Carey Buglione <drew@drewb.ug>" imported
gpg: Total number processed: 1
gpg:               imported: 1

For reference here's the hex dumb of the key in question:

# xxd public_key_invalid.gpg

00000000: 984f 0400 0000 0013 052b 8104 000a 0207  .O.......+......
00000010: 4615 813d 2d31 329d 51e5 a8e7 c8ea a656  F..=-12.Q......V
00000020: 37e9 ad5d e00e a3fa 65b2 f132 5ace d0a5  7..]....e..2Z...
00000030: 27b6 d28e 1818 e1f3 d797 d37f 3c7c 8256  '...........<|.V
00000040: ff5f 7117 5625 5a25 f422 2245 4096 6ed7  ._q.V%Z%.""E@.n.
00000050: 08b4 2344 7265 7720 4361 7265 7920 4275  ..#Drew Carey Bu
00000060: 676c 696f 6e65 203c 6472 6577 4064 7265  glione <drew@dre
00000070: 7762 2e75 673e                           wb.ug>
Andreas Tzionis
  • 1,019
  • 9
  • 17

0 Answers0