diff options
author | Ruben Pollan <meskio@sindominio.net> | 2014-11-04 11:53:56 -0600 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2014-11-06 19:43:41 -0600 |
commit | 68565379fe73fb8a07e96925785ab9a733880b4b (patch) | |
tree | 889c511d6b5756e2c55fa2a09d1fab622a315bf5 /keymanager/src/leap/keymanager/openpgp.py | |
parent | fe41ebea35e17abb402b2ba0d786897ac102e760 (diff) |
Use datetime for key expiration
Diffstat (limited to 'keymanager/src/leap/keymanager/openpgp.py')
-rw-r--r-- | keymanager/src/leap/keymanager/openpgp.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/keymanager/src/leap/keymanager/openpgp.py b/keymanager/src/leap/keymanager/openpgp.py index f86b35d8..d3c305e2 100644 --- a/keymanager/src/leap/keymanager/openpgp.py +++ b/keymanager/src/leap/keymanager/openpgp.py @@ -25,6 +25,7 @@ import tempfile import io +from datetime import datetime from gnupg import GPG from gnupg.gnupg import GPGUtilities @@ -178,6 +179,10 @@ def _build_key_from_gpg(address, key, key_data): :return: An instance of the key. :rtype: OpenPGPKey """ + expiry_date = None + if key['expires']: + expiry_date = datetime.fromtimestamp(int(key['expires'])) + return OpenPGPKey( address, key_id=key['keyid'], @@ -185,7 +190,7 @@ def _build_key_from_gpg(address, key, key_data): key_data=key_data, private=True if key['type'] == 'sec' else False, length=key['length'], - expiry_date=key['expires'], + expiry_date=expiry_date, validation=ValidationLevel.Weak_Chain, ) |