diff options
| author | J08nY | 2017-07-28 02:46:01 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-28 02:46:01 +0200 |
| commit | f48c5d7f60e73593f347b346cdf5caedf0c05628 (patch) | |
| tree | c5e1cfd7c949a06cc6ac62f227fe275693dcce00 /src/mailman_pgp/pgp/mime.py | |
| parent | 56b600fb0131b1c3b3ec06d85ec4810026279864 (diff) | |
| parent | f190131409ada6126977965f6607224d4d97aa84 (diff) | |
| download | mailman-pgp-f48c5d7f60e73593f347b346cdf5caedf0c05628.tar.gz mailman-pgp-f48c5d7f60e73593f347b346cdf5caedf0c05628.tar.zst mailman-pgp-f48c5d7f60e73593f347b346cdf5caedf0c05628.zip | |
Diffstat (limited to 'src/mailman_pgp/pgp/mime.py')
| -rw-r--r-- | src/mailman_pgp/pgp/mime.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py index bdb7943..33ec93e 100644 --- a/src/mailman_pgp/pgp/mime.py +++ b/src/mailman_pgp/pgp/mime.py @@ -24,7 +24,7 @@ from email.mime.application import MIMEApplication from email.utils import collapse_rfc2231_value from mailman.email.message import Message, MultipartDigestMessage -from pgpy import PGPKey, PGPMessage, PGPSignature +from pgpy import PGPDetachedSignature, PGPKey, PGPMessage from pgpy.constants import HashAlgorithm, SymmetricKeyAlgorithm from public import public @@ -98,13 +98,14 @@ class MIMEWrapper: """ :return: - :rtype: typing.Generator[pgpy.PGPSignature] + :rtype: typing.Generator[pgpy.PGPDetachedSignature] """ try: - msg = PGPSignature.from_blob(self.msg.get_payload(1).get_payload()) + sig = PGPDetachedSignature.from_blob( + self.msg.get_payload(1).get_payload()) except: return - yield msg + yield sig def is_encrypted(self): """ @@ -229,6 +230,13 @@ class MIMEWrapper: return 'pgp-' + algs[hash_algo] def _wrap_signed(self, msg, signature): + """ + As per RFC1847 and RFC3156. + + :param msg: + :param signature: + :return: + """ micalg = self._micalg(signature.hash_algorithm) out = MultipartDigestMessage('signed', micalg=micalg, protocol=MIMEWrapper._signed_type) |
