<BLANKLINE>
--boundsep--
"""
- body = message.as_string().encode('us-ascii')
+ body = message.as_string().encode('us-ascii').replace(b'\n', b'\r\n')
+ # use email.policy.SMTP once we get Python 3.3
signature = str(_sign_and_encrypt_bytes(
data=body, signers=signers,
allow_default_signer=allow_default_signer), 'us-ascii')
<BLANKLINE>
--boundsep--
"""
- body = message.as_string().encode('us-ascii')
+ body = message.as_string().encode('us-ascii').replace(b'\n', b'\r\n')
+ # use email.policy.SMTP once we get Python 3.3
if recipients is None:
recipients = [email for name,email in _email_targets(message)]
_LOG.debug('extracted encryption recipients: {}'.format(recipients))
--boundsep--
"""
_strip_bcc(message=message)
- body = message.as_string().encode('us-ascii')
+ body = message.as_string().encode('us-ascii').replace(b'\n', b'\r\n')
+ # use email.policy.SMTP once we get Python 3.3
if recipients is None:
recipients = [email for name,email in _email_targets(message)]
_LOG.debug('extracted encryption recipients: {}'.format(recipients))
>>> message = encodedMIMEText('Hi\nBye')
>>> encrypted = encrypt(message, recipients=['<pgp-mime@invalid.com>'])
>>> decrypted = decrypt(encrypted)
- >>> print(decrypted.as_string()) # doctest: +ELLIPSIS, +REPORT_UDIFF
+ >>> print(decrypted.as_string().replace('\r\n', '\n'))
+ ... # doctest: +ELLIPSIS, +REPORT_UDIFF
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
>>> encrypted = sign_and_encrypt(message, signers=['pgp-mime@invalid.com'],
... always_trust=True)
>>> decrypted,verified,result = verify(encrypted)
- >>> print(decrypted.as_string()) # doctest: +ELLIPSIS, +REPORT_UDIFF
+ >>> print(decrypted.as_string().replace('\r\n', '\n'))
+ ... # doctest: +ELLIPSIS, +REPORT_UDIFF
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
if not isinstance(sig_data, bytes):
sig_data = sig_data.encode('us-ascii')
decrypted,verified,result = _verify_bytes(
- body.as_string().encode('us-ascii'), signature=sig_data)
+ body.as_string().encode('us-ascii').replace(b'\n', b'\r\n'),
+ signature=sig_data)
+ # use email.policy.SMTP once we get Python 3.3
return (_copy.deepcopy(body), verified, result)