Ignore unrecognized signature versions

As new versions of OpenPGP signatures are defined, implementations may
provide multiple signatures, one of an older version for legacy
clients and one of a new version for clients that can read the new
signature form.

PGPy should skip over any signature whose version is not recognized.
This commit is contained in:
Daniel Kahn Gillmor
2022-11-09 07:47:13 -05:00
parent 473d3651e2
commit 82614f8019

View File

@@ -577,9 +577,12 @@ class PGPSignature(Armorable, ParentRef, PGPObject):
# load *one* packet from data
pkt = Packet(data)
if pkt.header.tag == PacketTag.Signature and not isinstance(pkt, Opaque):
self._signature = pkt
if pkt.header.tag == PacketTag.Signature:
if isinstance(pkt, Opaque):
# this is an unrecognized version.
pass
else:
self._signature = pkt
else:
raise ValueError('Expected: Signature. Got: {:s}'.format(pkt.__class__.__name__))