diff options
| author | J08nY | 2017-06-22 20:03:26 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-22 20:03:26 +0200 |
| commit | 263577d4826630e6871b35c73fe3dd114ee70e22 (patch) | |
| tree | 20613916e85536d16fe803a6e73a6126a7866bcb /src/mailman_pgp/pgp/wrapper.py | |
| parent | 90529b7058362d2a43625f95bcd3afc8b9733203 (diff) | |
| download | mailman-pgp-263577d4826630e6871b35c73fe3dd114ee70e22.tar.gz mailman-pgp-263577d4826630e6871b35c73fe3dd114ee70e22.tar.zst mailman-pgp-263577d4826630e6871b35c73fe3dd114ee70e22.zip | |
Diffstat (limited to 'src/mailman_pgp/pgp/wrapper.py')
| -rw-r--r-- | src/mailman_pgp/pgp/wrapper.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/mailman_pgp/pgp/wrapper.py b/src/mailman_pgp/pgp/wrapper.py index 9a004c4..c6d8dff 100644 --- a/src/mailman_pgp/pgp/wrapper.py +++ b/src/mailman_pgp/pgp/wrapper.py @@ -57,7 +57,7 @@ class PGPWrapper(): """ if self.is_mime_signed(): return self.mime.verify(key) - else: + elif self.is_inline_signed(): return self.inline.verify(key) def is_mime_encrypted(self): @@ -80,5 +80,19 @@ class PGPWrapper(): """ if self.is_mime_encrypted(): return self.mime.decrypt(key) - else: + elif self.is_inline_encrypted(): return self.inline.decrypt(key) + + def has_keys(self): + return self.mime.has_keys() or self.inline.has_keys() + + def keys(self): + """ + Get the collection of keys in this message. + + :return: A collection of keys. + """ + if self.mime.has_keys(): + yield from self.mime.keys() + elif self.inline.has_keys(): + yield from self.inline.keys() |
