diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-11-16 16:53:48 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-12-03 20:43:24 +0100 |
commit | 3eab1813bfb9efeea65ab3ad9798b8e8dba6d163 (patch) | |
tree | af519eaf21e15edeb0211e0e1ad1b4b6c3301e18 /src/leap/bitmask/keymanager/__init__.py | |
parent | 10a8b732576aa6a21ca01f265967f9e09560c2cf (diff) |
[feat] add key expiry date extension in keymanager
- extends key pair (unlocked from soledad)
- extension period is counted from key creation date
Diffstat (limited to 'src/leap/bitmask/keymanager/__init__.py')
-rw-r--r-- | src/leap/bitmask/keymanager/__init__.py | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/leap/bitmask/keymanager/__init__.py b/src/leap/bitmask/keymanager/__init__.py index e3ff3b87..03ade634 100644 --- a/src/leap/bitmask/keymanager/__init__.py +++ b/src/leap/bitmask/keymanager/__init__.py @@ -38,7 +38,6 @@ from leap.bitmask.keymanager.openpgp import OpenPGPScheme class KeyManager(object): - # # server's key storage constants # @@ -110,7 +109,7 @@ class KeyManager(object): leap_ca_bundle = ca_bundle.where() if self._ca_cert_path == leap_ca_bundle: - return self._ca_cert_path # don't merge file with itself + return self._ca_cert_path # don't merge file with itself elif not self._ca_cert_path: return leap_ca_bundle @@ -711,6 +710,26 @@ class KeyManager(object): pubkey.validation = validation yield self.put_key(pubkey) + @defer.inlineCallbacks + def extend_key(self, validity='1y', passphrase=None): + """ + extend the expiration date of the key pair bound to the user's address + by the validity period, from the key's creation date. + + :param validity: new validity from creation date 'n','nw','nm' or 'ny' + where n is a number + :type validity: str + + :return: The updated secret key, with new expiry date + :rtype: OpenPGPKey + + :raise KeyExpiryExtensionError: if invalid validity period + """ + my_secret_key = yield self.get_key(self._address, private=True) + renewed_key = yield self._openpgp.extend_key(my_secret_key, validity, + passphrase) + defer.returnValue(renewed_key) + def _split_email(address): """ |