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