From 9f7b198ea846d02b37a7e2934f26f61a87af4d76 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 20 Dec 2013 15:02:08 -0800 Subject: [PATCH] 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 --- gpg-migrate.py | 7 +++++++ 1 file changed, 7 insertions(+) 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) -- 2.26.2