Add signature creation time signature subpacket parsing to PGPPacket
authorW. Trevor King <wking@tremily.us>
Fri, 20 Dec 2013 23:02:08 +0000 (15:02 -0800)
committerW. Trevor King <wking@tremily.us>
Mon, 23 Dec 2013 02:32:14 +0000 (18:32 -0800)
From RFC 4880 [1]:

  (4-octet time field)

  The time the signature was made.

  MUST be present in the hashed area.

[1]: http://tools.ietf.org/search/rfc4880#section-5.2.3.4

gpg-migrate.py

index 6abc19ece1759916d165a46a7943ab1a5ebfbe94..47ea115904569695299a043a8a47af1421645ee2 100755 (executable)
@@ -289,6 +289,9 @@ class PGPPacket (dict):
                 lines.append('    {}'.format(subpacket['type']))
         return lines
 
+    def _str_signature_creation_time_signature_subpacket(self, subpacket):
+        return str(subpacket['signature-creation-time'])
+
     def _str_issuer_signature_subpacket(self, subpacket):
         return subpacket['issuer'][-8:].upper()
 
@@ -573,6 +576,10 @@ class PGPPacket (dict):
         offset += 2
         self['signature'] = data[offset:]
 
+    def _parse_signature_creation_time_signature_subpacket(
+            self, data, subpacket):
+        subpacket['signature-creation-time'] = _struct.unpack('>I', data)[0]
+
     def _parse_issuer_signature_subpacket(self, data, subpacket):
         subpacket['issuer'] = ''.join('{:02x}'.format(byte) for byte in data)