summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/leap/bitmask/mail/outgoing/service.py3
-rw-r--r--src/leap/bitmask/mail/rfc3156.py9
2 files changed, 8 insertions, 4 deletions
diff --git a/src/leap/bitmask/mail/outgoing/service.py b/src/leap/bitmask/mail/outgoing/service.py
index a3b8d005..86fb63c2 100644
--- a/src/leap/bitmask/mail/outgoing/service.py
+++ b/src/leap/bitmask/mail/outgoing/service.py
@@ -26,6 +26,7 @@ import re
from StringIO import StringIO
from copy import deepcopy
from email.parser import Parser
+from email.encoders import encode_7or8bit
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@@ -385,7 +386,7 @@ class OutgoingMail(object):
def create_encrypted_message(res):
newmsg, encstr = res
encmsg = MIMEApplication(
- encstr, _subtype='octet-stream', _encoder=lambda x: x)
+ encstr, _subtype='octet-stream', _encoder=encode_7or8bit)
encmsg.add_header('content-disposition', 'attachment',
filename='msg.asc')
# create meta message
diff --git a/src/leap/bitmask/mail/rfc3156.py b/src/leap/bitmask/mail/rfc3156.py
index cb592689..7f719f63 100644
--- a/src/leap/bitmask/mail/rfc3156.py
+++ b/src/leap/bitmask/mail/rfc3156.py
@@ -24,6 +24,7 @@ from StringIO import StringIO
from twisted.logger import Logger
+from email.encoders import encode_7or8bit
from email.mime.application import MIMEApplication
from email.mime.multipart import MIMEMultipart
from email import errors
@@ -361,7 +362,8 @@ class PGPEncrypted(MIMEApplication):
def __init__(self, version=1):
data = "Version: %d" % version
- MIMEApplication.__init__(self, data, 'pgp-encrypted')
+ MIMEApplication.__init__(self, data, 'pgp-encrypted',
+ _encoder=encode_7or8bit)
class PGPSignature(MIMEApplication):
@@ -375,7 +377,7 @@ class PGPSignature(MIMEApplication):
"""
def __init__(self, _data, name='signature.asc'):
MIMEApplication.__init__(self, _data, 'pgp-signature',
- _encoder=lambda x: x, name=name)
+ _encoder=encode_7or8bit, name=name)
self.add_header('Content-Description', 'OpenPGP Digital Signature')
@@ -390,4 +392,5 @@ class PGPKeys(MIMEApplication):
"""
def __init__(self, _data):
- MIMEApplication.__init__(self, _data, 'pgp-keys')
+ MIMEApplication.__init__(self, _data, 'pgp-keys',
+ _encoder=encode_7or8bit)