From: W. Trevor King Date: Fri, 20 Dec 2013 21:34:42 +0000 (-0800) Subject: Add embedded signature subpacket parsing to PGPPacket X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a7e1c9239485acfc2d327413169dc0c302be2757;p=gpg-migrate.git Add embedded signature subpacket parsing to PGPPacket From RFC 4880 [1]: (1 signature packet body) This subpacket contains a complete Signature packet body as specified in Section 5.2 above. It is useful when one signature needs to refer to, or be incorporated in, another signature. [1]: http://tools.ietf.org/search/rfc4880#section-5.2.3.26 --- diff --git a/gpg-migrate.py b/gpg-migrate.py index 92a03db..cd0a95d 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -282,6 +282,9 @@ class PGPPacket (dict): def _str_issuer_signature_subpacket(self, subpacket): return subpacket['issuer'][-8:].upper() + def _str_embedded_signature_signature_subpacket(self, subpacket): + return subpacket['embedded']['signature-type'] + def _str_user_id_packet(self): return self['user'] @@ -534,6 +537,10 @@ class PGPPacket (dict): def _parse_issuer_signature_subpacket(self, data, subpacket): subpacket['issuer'] = ''.join('{:02x}'.format(byte) for byte in data) + def _parse_embedded_signature_signature_subpacket(self, data, subpacket): + subpacket['embedded'] = PGPPacket() + subpacket['embedded']._parse_signature_packet(data=data) + def _parse_user_id_packet(self, data): self['user'] = str(data, 'utf-8')