aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/pgp/inline.py
diff options
context:
space:
mode:
authorJ08nY2017-07-17 18:11:45 +0200
committerJ08nY2017-07-17 18:11:45 +0200
commit1ffc41fdca212bf157d3272cfe33e864d33ed067 (patch)
treefa334cb5de59aeb2295f3d28a60060ad7a2d1446 /src/mailman_pgp/pgp/inline.py
parent603c4b1acdbbb512056a0caaa76ee56b118bcd49 (diff)
downloadmailman-pgp-1ffc41fdca212bf157d3272cfe33e864d33ed067.tar.gz
mailman-pgp-1ffc41fdca212bf157d3272cfe33e864d33ed067.tar.zst
mailman-pgp-1ffc41fdca212bf157d3272cfe33e864d33ed067.zip
Diffstat (limited to 'src/mailman_pgp/pgp/inline.py')
-rw-r--r--src/mailman_pgp/pgp/inline.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mailman_pgp/pgp/inline.py b/src/mailman_pgp/pgp/inline.py
index 458cc26..ccc8176 100644
--- a/src/mailman_pgp/pgp/inline.py
+++ b/src/mailman_pgp/pgp/inline.py
@@ -137,32 +137,32 @@ class InlineWrapper:
return any(self._walk(self._has_keys))
def _keys(self, part):
- try:
- # TODO: potentially return all things returned from from_blob?
- key, _ = PGPKey.from_blob(part.get_payload())
- return key
- except:
- pass
+ # TODO: potentially return all things returned from from_blob?
+ key, _ = PGPKey.from_blob(part.get_payload())
+ return key
def keys(self):
"""
Get the collection of keys in this message.
:return: A collection of keys.
+ :rtype: Generator[pgpy.PGPKey]
"""
- yield from self._walk(self._keys)
+ for part in walk(self.msg):
+ if not part.is_multipart() and self._has_keys(part):
+ try:
+ key = self._keys(part)
+ except:
+ continue
+ yield key
def _verify(self, part, key):
- try:
- message = PGPMessage.from_blob(part.get_payload())
- return key.verify(message)
- except:
- pass
- return False
+ message = PGPMessage.from_blob(part.get_payload())
+ return key.verify(message)
def verify(self, key):
"""
- Verify the signature of this message with key.
+ Verify the signatures of this message with key.
:param key: The key to verify with.
:type key: pgpy.PGPKey