CZ-NIC / envelope

Insert a message and attachments and send e-mail / sign / encrypt contents by a single line.
Other
171 stars 12 forks source link

S/MIME signed mails have signature issues in outlook and apple mail with specific subject length #32

Open k3mpaxl opened 3 months ago

k3mpaxl commented 3 months ago

Hi,

I just figured out that the s/mime signature seems to be wrong if the email-subject has got a length >= 70 and <= 77 characters.

How to reproduce?

msg = Envelope("a nice and beautiful <strong><p>body</p></strong>")
msg = msg.smime()
msg = msg.signature(key=email_smime_private_key_as_string, cert=email_smime_certificate_as_string)
msg = msg.subject("1111111111111111111111111111111111111111111111111111111111111111111111")
msg.smtp(host='my host.com')
msg.send()

However, S/MIME encrypted mails don't seem to have this issue.

Do you have any clue what is wrong here? I guess is must be something with the maximum characters allowed and line breaks in SMTP communication?

Have a nice day!

e3rd commented 3 months ago

Thanks for the investigation! I won't have to to dive into in the following days but I'm definitely interested into solving this.

k3mpaxl commented 3 months ago

Just a side note.. M2Crypto seems to be without maintenance and they are proposing a migration path: https://m2crypto.readthedocs.io/en/latest/howto.migration.html#

maybe it might make sense to tackle the issue by migrating to the modern lib?