diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman_pgp/commands/eml_key.py | 6 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/wrapper.py | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py index e792fa4..5bb2bd8 100644 --- a/src/mailman_pgp/commands/eml_key.py +++ b/src/mailman_pgp/commands/eml_key.py @@ -56,7 +56,7 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results): wrapped = PGPWrapper(msg) if wrapped.is_encrypted(): - decrypted = wrapped.decrypt(pgp_list.key) + decrypted = wrapped.try_decrypt(pgp_list.key) wrapped = PGPWrapper(decrypted) if not wrapped.has_keys(): @@ -134,7 +134,7 @@ def _cmd_confirm(pgp_list, mlist, msg, msgdata, arguments, results): wrapped = PGPWrapper(msg) if wrapped.is_encrypted(): - decrypted = wrapped.decrypt(pgp_list.key) + decrypted = wrapped.try_decrypt(pgp_list.key) wrapped = PGPWrapper(decrypted) if not wrapped.is_signed(): @@ -195,7 +195,7 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results): wrapped = PGPWrapper(msg) if wrapped.is_encrypted(): - decrypted = wrapped.decrypt(pgp_list.key) + decrypted = wrapped.try_decrypt(pgp_list.key) wrapped = PGPWrapper(decrypted) if not wrapped.has_keys(): diff --git a/src/mailman_pgp/pgp/wrapper.py b/src/mailman_pgp/pgp/wrapper.py index 42b51b9..f506c2e 100644 --- a/src/mailman_pgp/pgp/wrapper.py +++ b/src/mailman_pgp/pgp/wrapper.py @@ -188,6 +188,7 @@ class PGPWrapper(): :param key: The key to decrypt with. :type key: pgpy.PGPKey :return: The decrypted message. + :raises: pgpy.errors.PGPError :rtype: mailman.email.message.Message """ if self.mime.is_encrypted(): @@ -199,9 +200,12 @@ class PGPWrapper(): def try_decrypt(self, key): """ + Try decrypting the message with given key. - :param key: - :return: + :param key: The key to decrypt with. + :type key: pgpy.PGPKey + :return: The decrypted message, if successfully decrypted, + else original message. :rtype: mailman.email.message.Message """ try: |
