summaryrefslogtreecommitdiff
path: root/src/leap/common/keymanager/keys.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-04-23 20:50:02 -0300
committerdrebs <drebs@leap.se>2013-04-23 20:50:02 -0300
commit62b5a7798924188ba915a1c095917d8709e20ae7 (patch)
tree8a9357f100da498cdcdc4152aa35626bdef585c5 /src/leap/common/keymanager/keys.py
parentb3ad976ec8aa64a00cc824dc57aa2135ab41deb6 (diff)
Refactor, fixes, add api, tests.
* Change KeyTypeWrapper to EncryptionScheme * Change OpenPGPWrapper to OpenPGPScheme * Add missing and standardized crypto API. * Add delete_key() * Fix put_key raw so it puts either public or private keys. * Fix gpg's is_encrypted() * Fix openpgp's safe callbacks so they return correctly. * Remove binascii because it generates invalid doc ids. * Add tests.
Diffstat (limited to 'src/leap/common/keymanager/keys.py')
-rw-r--r--src/leap/common/keymanager/keys.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/leap/common/keymanager/keys.py b/src/leap/common/keymanager/keys.py
index bed407c..250c2fa 100644
--- a/src/leap/common/keymanager/keys.py
+++ b/src/leap/common/keymanager/keys.py
@@ -17,7 +17,7 @@
"""
-Abstact key type and wrapper representations.
+Abstact key type and encryption scheme representations.
"""
@@ -86,22 +86,23 @@ class EncryptionKey(object):
#
-# Key wrappers
+# Encryption schemes
#
-class KeyTypeWrapper(object):
+class EncryptionScheme(object):
"""
- Abstract class for Key Type Wrappers.
+ Abstract class for Encryption Schemes.
- A wrapper for a certain key type should know how to get and put keys in
- local storage using Soledad and also how to generate new keys.
+ A wrapper for a certain encryption schemes should know how to get and put
+ keys in local storage using Soledad, how to generate new keys and how to
+ find out about possibly encrypted content.
"""
__metaclass__ = ABCMeta
def __init__(self, soledad):
"""
- Initialize the Key Type Wrapper.
+ Initialize this Encryption Scheme.
@param soledad: A Soledad instance for local storage of keys.
@type soledad: leap.soledad.Soledad
@@ -139,6 +140,16 @@ class KeyTypeWrapper(object):
@param address: The address bound to the key.
@type address: str
+
@return: The key bound to C{address}.
@rtype: EncryptionKey
"""
+
+ @abstractmethod
+ def delete_key(self, key):
+ """
+ Remove C{key} from storage.
+
+ @param key: The key to be removed.
+ @type key: EncryptionKey
+ """