aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/pgp/mime.py
diff options
context:
space:
mode:
authorJ08nY2017-06-19 19:53:07 +0200
committerJ08nY2017-06-19 19:53:07 +0200
commitc3f78a30bb73b28fdf6b1e95e5083adfc9e7f29c (patch)
treec0481dfb7bc1d68eb55057a1c47127bbf4fac7a7 /src/mailman_pgp/pgp/mime.py
parent01d1c164eb5b1734ffe03ff642e46707ffdce3df (diff)
downloadmailman-pgp-c3f78a30bb73b28fdf6b1e95e5083adfc9e7f29c.tar.gz
mailman-pgp-c3f78a30bb73b28fdf6b1e95e5083adfc9e7f29c.tar.zst
mailman-pgp-c3f78a30bb73b28fdf6b1e95e5083adfc9e7f29c.zip
Diffstat (limited to 'src/mailman_pgp/pgp/mime.py')
-rw-r--r--src/mailman_pgp/pgp/mime.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py
index 08bd111..5617c19 100644
--- a/src/mailman_pgp/pgp/mime.py
+++ b/src/mailman_pgp/pgp/mime.py
@@ -18,9 +18,13 @@ class PGPMIMEWrapper:
Whether the whole message is MIME signed as per RFC3156 section 5.
:return:
"""
+ if not self._is_mime():
+ return False
+ second_type = self.msg.get_payload(1).get_content_type()
protocol_param = collapse_rfc2231_value(self.msg.get_param('protocol'))
content_subtype = self.msg.get_content_subtype()
- return self._is_mime() and \
+
+ return second_type == 'application/pgp-signature' and \
content_subtype == 'signed' and \
protocol_param == 'application/pgp-signature'
@@ -29,9 +33,14 @@ class PGPMIMEWrapper:
Whether the whole message is MIME encrypted as per RFC3156 section 4.
:return:
"""
+ if not self._is_mime():
+ return False
+ first_type = self.msg.get_payload(0).get_content_type()
+ second_type = self.msg.get_payload(1).get_content_type()
content_subtype = self.msg.get_content_subtype()
protocol_param = collapse_rfc2231_value(self.msg.get_param('protocol'))
- return self._is_mime() and \
+ return first_type == 'application/pgp-encrypted' and \
+ second_type == 'application/octet-stream' and \
content_subtype == 'encrypted' and \
protocol_param == 'application/pgp-encrypted'