From 467eb1ba367a5956ee10f870db5824a82b39d6e3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 20 Dec 2013 15:05:11 -0800 Subject: [PATCH] Add key expiration time subpacket parsing to PGPPacket From RFC 4880 [1]: (4-octet time field) The validity period of the key. This is the number of seconds after the key creation time that the key expires. If this is not present or has a value of zero, the key never expires. This is found only on a self-signature. [1]: http://tools.ietf.org/search/rfc4880#section-5.2.3.6 --- gpg-migrate.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/gpg-migrate.py b/gpg-migrate.py index 47ea115..30b80b4 100755 --- a/gpg-migrate.py +++ b/gpg-migrate.py @@ -295,6 +295,9 @@ class PGPPacket (dict): def _str_issuer_signature_subpacket(self, subpacket): return subpacket['issuer'][-8:].upper() + def _str_key_expiration_time_signature_subpacket(self, subpacket): + return str(subpacket['key-expiration-time']) + def _str_preferred_symmetric_algorithms_signature_subpacket( self, subpacket): return ', '.join( @@ -583,6 +586,10 @@ class PGPPacket (dict): def _parse_issuer_signature_subpacket(self, data, subpacket): subpacket['issuer'] = ''.join('{:02x}'.format(byte) for byte in data) + def _parse_key_expiration_time_signature_subpacket( + self, data, subpacket): + subpacket['key-expiration-time'] = _struct.unpack('>I', data)[0] + def _parse_preferred_symmetric_algorithms_signature_subpacket( self, data, subpacket): subpacket['preferred-symmetric-algorithms'] = [ -- 2.26.2