Skip to content

Commit

Permalink
Merge pull request #273 from dkg/issuer-fingerprint
Browse files Browse the repository at this point in the history
IssuerFingerprint - include spec and update length for v5
  • Loading branch information
Commod0re authored Aug 2, 2019
2 parents da1356b + 7df868e commit 9fc9338
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions pgpy/packet/subpackets/signature.py
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,21 @@ def parse(self, packet):


class IssuerFingerprint(Signature):
'''
(from RFC4880bis-07)
5.2.3.28. Issuer Fingerprint
(1 octet key version number, N octets of fingerprint)
The OpenPGP Key fingerprint of the key issuing the signature. This
subpacket SHOULD be included in all signatures. If the version of
the issuing key is 4 and an Issuer subpacket is also included in the
signature, the key ID of the Issuer subpacket MUST match the low 64
bits of the fingerprint.
Note that the length N of the fingerprint for a version 4 key is 20
octets; for a version 5 key N is 32.
'''
__typeid__ = 0x21

@sdproperty
Expand Down Expand Up @@ -936,9 +951,9 @@ def parse(self, packet):
if self.version == 4:
fpr_len = 20
elif self.version == 5: # pragma: no cover
fpr_len = 25
fpr_len = 32
else: # pragma: no cover
fpr_len = self.header.length - 1

self.issuer_fingerprint = packet[:fpr_len]
del packet[:fpr_len]
del packet[:fpr_len]

0 comments on commit 9fc9338

Please sign in to comment.