[H-GEN] Problem transporting signed emails

Edwin Groothuis edwin at mavetju.org
Sat May 8 21:55:45 EDT 2004


I've been playing with signed emails (S/MIME, OpenSSL etc) but am
running into an annoying problem: "openssl smime -sign" signs the
text, but it adds ^M's at the end of the lines of the original text.
When piping it through to the MTA, somewhere the ^M's are lost and
the signature of the file including becomes invalid.

[~/openssl] edwin at k7>cat test.txt
This is a test.
This is a text.

[~/openssl] edwin at k7>openssl smime -sign -text -signer mycert.pem -in test.txt > test.msg
Enter pass phrase for mycert.pem:

And then in vi:

============ 8< ====================
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg
=sha1; boundary="----259958A68922550377544CEFAD9013E9"

This is an S/MIME signed message

Content-Type: text/plain^M
This is a test.^M
This is a text.^M

============ 8< ====================

Piping this through sendmail (postfix) for delivery on the same
machine gives me the same text with the ^M's. Piping this through
sendmail for delivery on a different machine gives me the text
without the ^M's, which invalidates the signature on the email.

My questions are... has somebody else ever fought with signed emails
like this and did they see the same behaviour? And how did you
overcome this problem.


Edwin Groothuis      |            Personal website: http://www.mavetju.org
edwin at mavetju.org    |          Weblog: http://weblog.barnet.com.au/edwin/

More information about the General mailing list