From ca7ddd205d29b5a20c2cfb02be5286247d1a7d7d Mon Sep 17 00:00:00 2001 From: s3lph <1375407-s3lph@users.noreply.gitlab.com> Date: Sat, 23 Apr 2022 01:41:30 +0200 Subject: [PATCH] RFC 3156 compliance: Don't base64-encode PGP/MIME messages --- CHANGELOG.md | 13 +++++++++++++ easywks/types.py | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a625947..d48a5ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,18 @@ # EasyWKS Changelog + +## Version 0.1.10 + +Bugfix release + +### Changes + + +- RFC 3156 compliance: Don't base64-encode PGP/MIME messages + + + + ## Version 0.1.9 diff --git a/easywks/types.py b/easywks/types.py index d9d5001..7207f28 100644 --- a/easywks/types.py +++ b/easywks/types.py @@ -1,5 +1,6 @@ from datetime import datetime +from email.encoders import encode_noop from email.policy import default from email.utils import format_datetime from email.mime.multipart import MIMEMultipart @@ -185,8 +186,8 @@ class PublishResponse: to_encrypt = PGPMessage.new(mpplain.as_string(policy=default)) encrypted: PGPMessage = self.key.encrypt(to_encrypt) encrypted |= pgp_sign(self.domain, encrypted) - payload = MIMEApplication(str(encrypted), _subtype='octet-stream') - mpenc = MIMEApplication('Version: 1\r\n', _subtype='pgp-encrypted') + payload = MIMEApplication(str(encrypted), _subtype='octet-stream', _encoder=encode_noop) + mpenc = MIMEApplication('Version: 1\r\n', _subtype='pgp-encrypted', _encoder=encode_noop) email = MIMEMultipart(_subtype='encrypted', _subparts=[mpenc, payload], policy=default, protocol='application/pgp-encrypted') email['Subject'] = 'Your key has been published'