diff options
author | drebs <drebs@leap.se> | 2013-05-21 17:22:14 -0300 |
---|---|---|
committer | drebs <drebs@leap.se> | 2013-05-21 17:22:14 -0300 |
commit | b16437ac68a72b128e3771e0847f376237f649a3 (patch) | |
tree | c6a57678f9d43c2b32200f3232260311bff9e0dc /src/leap/common/keymanager | |
parent | c2b8ebb38a72acd2f60659241883a146cc384aec (diff) |
Remove openpgp symmetric encryption.
Diffstat (limited to 'src/leap/common/keymanager')
-rw-r--r-- | src/leap/common/keymanager/__init__.py | 1 | ||||
-rw-r--r-- | src/leap/common/keymanager/openpgp.py | 78 |
2 files changed, 0 insertions, 79 deletions
diff --git a/src/leap/common/keymanager/__init__.py b/src/leap/common/keymanager/__init__.py index ad9bb3b..7aaeddf 100644 --- a/src/leap/common/keymanager/__init__.py +++ b/src/leap/common/keymanager/__init__.py @@ -39,7 +39,6 @@ from leap.common.keymanager.keys import ( from leap.common.keymanager.openpgp import ( OpenPGPKey, OpenPGPScheme, - encrypt_sym, ) diff --git a/src/leap/common/keymanager/openpgp.py b/src/leap/common/keymanager/openpgp.py index e60833b..d53afd6 100644 --- a/src/leap/common/keymanager/openpgp.py +++ b/src/leap/common/keymanager/openpgp.py @@ -271,70 +271,6 @@ class TempGPGWrapper(object): # @with_temporary_gpg -def encrypt_sym(data, passphrase=None, sign=None): - """ - Encrypt C{data} with C{passphrase} and sign with C{sign} private key. - - @param data: The data to be encrypted. - @type data: str - @param passphrase: The passphrase used to encrypt C{data}. - @type passphrase: str - @param sign: The private key used for signing. - @type sign: OpenPGPKey - - @return: The encrypted data. - @rtype: str - """ - leap_assert_type(passphrase, str) - if sign is not None: - leap_assert_type(sign, OpenPGPKey) - leap_assert(sign.private is True) - - # Here we cannot assert for correctness of sig because the sig is in - # the ciphertext. - # result.ok - (bool) indicates if the operation succeeded - # result.data - (bool) contains the result of the operation - - return lambda gpg: gpg.encrypt( - data, None, - sign=sign.key_id if sign else None, - passphrase=passphrase, symmetric=True) - - -@with_temporary_gpg -def decrypt_sym(data, passphrase=None, verify=None): - """ - Decrypt C{data} with C{passphrase} and verify with C{verify} public - key. - - @param data: The data to be decrypted. - @type data: str - @param passphrase: The passphrase used to decrypt C{data}. - @type passphrase: str - @param verify: The key used to verify a signature. - @type verify: OpenPGPKey - - @return: The decrypted data. - @rtype: str - - @raise InvalidSignature: Raised if unable to verify the signature with - C{verify} key. - """ - leap_assert_type(passphrase, str) - if verify is not None: - leap_assert_type(verify, OpenPGPKey) - leap_assert(verify.private is False) - - # result.ok - (bool) indicates if the operation succeeded - # result.valid - (bool) indicates if the signature was verified - # result.data - (bool) contains the result of the operation - # result.pubkey_fingerpring - (str) contains the fingerprint of the - # public key that signed this data. - return lambda gpg: gpg.decrypt( - data, passphrase=passphrase) - - -@with_temporary_gpg def encrypt_asym(data, key, passphrase=None, sign=None): """ Encrypt C{data} using public @{key} and sign with C{sign} key. @@ -408,20 +344,6 @@ def is_encrypted(data): @with_temporary_gpg -def is_encrypted_sym(data): - """ - Return whether C{data} was encrypted using a public OpenPGP key. - - @param data: The data we want to know about. - @type data: str - - @return: Whether C{data} was encrypted using this wrapper. - @rtype: bool - """ - return lambda gpg: gpg.is_encrypted_sym(data) - - -@with_temporary_gpg def is_encrypted_asym(data): """ Return whether C{data} was asymmetrically encrypted using OpenPGP. |