diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/mailman_pgp/pgp/inline.py | 28 |
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 |
