diff options
| author | J08nY | 2017-06-20 23:56:30 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-20 23:56:30 +0200 |
| commit | 907b4d1d974d419e4d289a0101b7e5b05f6d1918 (patch) | |
| tree | 1c667065c49ab2cc653f3b8ba38723538f076f39 /src/mailman_pgp | |
| parent | cf0e6ef48e707a072d4ebde252b2bed5eb38b807 (diff) | |
| download | mailman-pgp-907b4d1d974d419e4d289a0101b7e5b05f6d1918.tar.gz mailman-pgp-907b4d1d974d419e4d289a0101b7e5b05f6d1918.tar.zst mailman-pgp-907b4d1d974d419e4d289a0101b7e5b05f6d1918.zip | |
Diffstat (limited to 'src/mailman_pgp')
| -rw-r--r-- | src/mailman_pgp/pgp/mime.py | 14 | ||||
| -rw-r--r-- | src/mailman_pgp/runners/incoming.py | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py index 67a10aa..d593525 100644 --- a/src/mailman_pgp/pgp/mime.py +++ b/src/mailman_pgp/pgp/mime.py @@ -15,7 +15,7 @@ # You should have received a copy of the GNU General Public License along with # this program. If not, see <http://www.gnu.org/licenses/>. -"""""" +"""RFC1847 and RFC3156 compliant message wrapped.""" from email.message import Message from email.utils import collapse_rfc2231_value @@ -35,7 +35,7 @@ class PGPMIMEWrapper: return is_multipart and payloads == 2 - def is_mime_signed(self): + def is_signed(self): """ Whether the whole message is MIME signed as per RFC3156 section 5. :return: @@ -47,10 +47,10 @@ class PGPMIMEWrapper: content_subtype = self.msg.get_content_subtype() return second_type == PGPMIMEWrapper._signed_subtype and \ - content_subtype == 'signed' and \ - protocol_param == PGPMIMEWrapper._signed_subtype + content_subtype == 'signed' and \ + protocol_param == PGPMIMEWrapper._signed_subtype - def is_mime_encrypted(self): + def is_encrypted(self): """ Whether the whole message is MIME encrypted as per RFC3156 section 4. :return: @@ -78,9 +78,7 @@ class PGPMIMEWrapper: clear_text = str(self.msg.get_payload(0)) sig_text = self.msg.get_payload(1).get_payload() signature = PGPSignature.from_blob(sig_text) - verification = key.verify(clear_text, - signature) - return signature in [v.signature for v in verification.good_signatures] + return key.verify(clear_text, signature) def decrypt(self, key: PGPKey): pass diff --git a/src/mailman_pgp/runners/incoming.py b/src/mailman_pgp/runners/incoming.py index 3c9c3b2..aae6bda 100644 --- a/src/mailman_pgp/runners/incoming.py +++ b/src/mailman_pgp/runners/incoming.py @@ -45,15 +45,15 @@ class IncomingRunner(Runner): # Is the message encrypted? mime = PGPMIMEWrapper(msg) inline = PGPInlineWrapper(msg) - if mime.is_mime_signed(): + if mime.is_signed(): # only signed. pass - elif mime.is_mime_encrypted(): + elif mime.is_encrypted(): # definitely encrypted, might still be signed pass - elif inline.is_inline_signed(): + elif inline.is_signed(): pass - elif inline.is_inline_encrypted(): + elif inline.is_encrypted(): pass else: # not encrypted or signed |
