diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-11-25 10:50:21 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-11-25 10:50:21 -0300 |
commit | d6448f679b793efbc6c3352e11024d13b31aaef3 (patch) | |
tree | e3a5b05b40bf8a6ecf5dca4aff852d40e8676d59 /src/leap | |
parent | 8cf21f1ba5679bf576f7bb4ed1e61e384a1263fa (diff) | |
parent | dea149b6f5175a8082c81f32ee34ce4e4d878e0e (diff) |
Merge remote-tracking branch 'drebs/bug/fix-error-returns' into develop
Diffstat (limited to 'src/leap')
-rw-r--r-- | src/leap/keymanager/__init__.py | 3 | ||||
-rw-r--r-- | src/leap/keymanager/openpgp.py | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/leap/keymanager/__init__.py b/src/leap/keymanager/__init__.py index dbc54891..6cfbf710 100644 --- a/src/leap/keymanager/__init__.py +++ b/src/leap/keymanager/__init__.py @@ -425,6 +425,9 @@ class KeyManager(object): :type data: str :param privkey: The key used to decrypt. :type privkey: OpenPGPKey + :param passphrase: The passphrase for the secret key used for + decryption. + :type passphrase: str :param verify: The key used to verify a signature. :type verify: OpenPGPKey diff --git a/src/leap/keymanager/openpgp.py b/src/leap/keymanager/openpgp.py index cb46371c..5781d67b 100644 --- a/src/leap/keymanager/openpgp.py +++ b/src/leap/keymanager/openpgp.py @@ -341,6 +341,7 @@ class OpenPGPScheme(EncryptionScheme): leap_assert(match is not None, 'No user address in key data.') address = match.group(1) + openpgp_privkey = None if privkey is not None: match = re.match(mail_regex, privkey['uids'].pop()) leap_assert(match is not None, 'No user address in key data.') @@ -374,6 +375,7 @@ class OpenPGPScheme(EncryptionScheme): """ leap_assert_type(key_data, (str, unicode)) + openpgp_privkey = None try: openpgp_pubkey, openpgp_privkey = self.parse_ascii_key(key_data) except (errors.KeyAddressMismatch, errors.KeyFingerprintMismatch) as e: @@ -524,6 +526,9 @@ class OpenPGPScheme(EncryptionScheme): :type data: str :param privkey: The key used to decrypt. :type privkey: OpenPGPKey + :param passphrase: The passphrase for the secret key used for + decryption. + :type passphrase: str :param verify: The key used to verify a signature. :type verify: OpenPGPKey @@ -549,7 +554,7 @@ class OpenPGPScheme(EncryptionScheme): verify.fingerprint != result.pubkey_fingerprint: raise errors.InvalidSignature( 'Failed to verify signature with key %s: %s' % - (verify.key_id, stderr)) + (verify.key_id, result.stderr)) # XXX: this is the encoding used by gpg module # https://github.com/isislovecruft/python-gnupg/\ @@ -612,7 +617,7 @@ class OpenPGPScheme(EncryptionScheme): if result.fingerprint is None: raise errors.SignFailed( 'Failed to sign with key %s: %s' % - (privkey['keyid'], stderr)) + (privkey['keyid'], result.stderr)) leap_assert( result.fingerprint == kfprint, 'Signature and private key fingerprints mismatch: ' |