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

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