diff options
author | NavaL <ayoyo@thoughtworks.com> | 2016-11-18 20:22:14 +0100 |
---|---|---|
committer | Ruben Pollan <meskio@sindominio.net> | 2017-12-03 20:43:30 +0100 |
commit | e5c567d79557eecbd708f4fabe8d04c92cf66ea1 (patch) | |
tree | 107f3835eb76b0d1e907e00363699eb75681d1dc /src/leap/bitmask/keymanager/__init__.py | |
parent | 3eab1813bfb9efeea65ab3ad9798b8e8dba6d163 (diff) |
[feat] first phase of key regeneration
- if current key pair is expired, it'll be extended for a day first
- new key pair will be signed by the old key
Diffstat (limited to 'src/leap/bitmask/keymanager/__init__.py')
-rw-r--r-- | src/leap/bitmask/keymanager/__init__.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/bitmask/keymanager/__init__.py b/src/leap/bitmask/keymanager/__init__.py index 03ade634..483c7e51 100644 --- a/src/leap/bitmask/keymanager/__init__.py +++ b/src/leap/bitmask/keymanager/__init__.py @@ -330,6 +330,25 @@ class KeyManager(object): d.addCallback(signal_finished) return d + def regenerate_key(self): + """ + Regenerate a key bound to the user's address. + + :return: A Deferred which fires with the generated EncryptionKey. + :rtype: Deferred + """ + + def signal_finished(key): + emit_async( + catalog.KEYMANAGER_FINISHED_KEY_GENERATION, self._address) + return key + self.log.info('Regenerating key for %s.' % self._address) + emit_async(catalog.KEYMANAGER_STARTED_KEY_GENERATION, self._address) + + d = self._openpgp.regenerate_key(self._address) + d.addCallback(signal_finished) + return d + # # Setters/getters # |