RFC 3156 compliance: Don't base64-encode PGP/MIME messages

This commit is contained in:
s3lph 2022-04-23 01:41:30 +02:00
parent c54d86412d
commit ca7ddd205d
2 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,18 @@
# EasyWKS Changelog
<!-- BEGIN RELEASE v0.1.10 -->
## Version 0.1.10
Bugfix release
### Changes
<!-- BEGIN CHANGES 0.1.10 -->
- RFC 3156 compliance: Don't base64-encode PGP/MIME messages
<!-- END CHANGES 0.1.10 -->
<!-- END RELEASE v0.1.10 -->
<!-- BEGIN RELEASE v0.1.9 -->
## Version 0.1.9

View file

@ -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'