From cc55676ffa2ccd361cc38d19435c1506109bfc34 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 20 Dec 2013 13:27:57 -0800 Subject: [PATCH] Add issuer signature subpacket parsing to PGPPacket From RFC 4880 [1]: (8-octet Key ID) The OpenPGP Key ID of the key issuing the signature. [1]: http://tools.ietf.org/search/rfc4880#section-5.2.3.5 --- gpg-migrate.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gpg-migrate.py b/gpg-migrate.py index b5eafaa..92a03db 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -279,6 +279,9 @@ class PGPPacket (dict): lines.append(' {}'.format(subpacket['type'])) return '\n'.join(lines) + def _str_issuer_signature_subpacket(self, subpacket): + return subpacket['issuer'][-8:].upper() + def _str_user_id_packet(self): return self['user'] @@ -528,6 +531,9 @@ class PGPPacket (dict): offset += 2 self['signature'] = data[offset:] + def _parse_issuer_signature_subpacket(self, data, subpacket): + subpacket['issuer'] = ''.join('{:02x}'.format(byte) for byte in data) + def _parse_user_id_packet(self, data): self['user'] = str(data, 'utf-8') -- 2.26.2