Add embedded signature subpacket parsing to PGPPacket
authorW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 21:34:42 +0000 (13:34 -0800)
committerW. Trevor King <wking@tremily.us>
Mon, 23 Dec 2013 02:32:13 +0000 (18:32 -0800)
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

gpg-migrate.py

index 92a03db2e9b565f845dae1690af586a0b2b4363c..cd0a95d60a353fff080593e44f9ede37dc303459 100755 (executable)
@@ -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')