From: W. Trevor King Date: Fri, 20 Dec 2013 23:02:08 +0000 (-0800) Subject: Add signature creation time signature subpacket parsing to PGPPacket X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9f7b198ea846d02b37a7e2934f26f61a87af4d76;p=gpg-migrate.git Add signature creation time signature subpacket parsing to PGPPacket 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 --- diff --git a/gpg-migrate.py b/gpg-migrate.py index 6abc19e..47ea115 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -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)