diff options
| author | J08nY | 2017-06-26 22:57:21 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-26 22:57:43 +0200 |
| commit | d181f52e6f406317416959378153531cce6c5a3a (patch) | |
| tree | 9132bd81a1e670c5307c418e46c163d7b8538cb0 /src/mailman_pgp | |
| parent | bdb0ec76d9b7b9a7e6956af5fe15d05c4c73ada4 (diff) | |
| download | mailman-pgp-d181f52e6f406317416959378153531cce6c5a3a.tar.gz mailman-pgp-d181f52e6f406317416959378153531cce6c5a3a.tar.zst mailman-pgp-d181f52e6f406317416959378153531cce6c5a3a.zip | |
Add some usual headers to messages from MIMEWrapper.encrypt.
Diffstat (limited to 'src/mailman_pgp')
| -rw-r--r-- | src/mailman_pgp/pgp/mime.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py index 22ebd65..751b9e5 100644 --- a/src/mailman_pgp/pgp/mime.py +++ b/src/mailman_pgp/pgp/mime.py @@ -172,6 +172,7 @@ class MIMEWrapper: micalg = self._micalg(signature.hash_algorithm) out = MIMEMultipart('signed', micalg=micalg, protocol=MIMEWrapper._signed_type) + out.preamble = 'This is an OpenPGP/MIME signed message (RFC 4880 and 3156)' second_part = MIMEApplication(_data=str(signature), _subtype=MIMEWrapper._signature_subtype, @@ -223,14 +224,25 @@ class MIMEWrapper: pmsg = key.encrypt(pmsg, cipher=cipher, session_key=session_key) del session_key + out = MIMEMultipart('encrypted', protocol=MIMEWrapper._encrypted_type) + out.preamble = 'This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156)' + first_part = MIMEApplication(_data='Version: 1', _subtype=MIMEWrapper._encryption_subtype, _encoder=encode_7or8bit) + first_part.add_header('content-description', + 'PGP/MIME version identification') + second_part = MIMEApplication(_data=str(pmsg), _subtype='octet-stream', - _encoder=encode_7or8bit) + _encoder=encode_7or8bit, + name='encrypted.asc') + second_part.add_header('content-description', + 'OpenPGP encrypted message') + second_part.add_header('content-disposition', 'inline', + filename='encrypted.asc') out.attach(first_part) out.attach(second_part) copy_headers(self.msg, out) |
