Unexpected CRLF end of line in S/MIME signed messages on Windows
#23,886 创建于 2024年3月18日
仓库指标
- Star
- (30,157 star)
- PR 合并指标
- (30 天内没有已合并 PR)
描述
Description
When signing an S/MIME message using openssl-smime on Windows (with OpenSSL 3.2.1), the resulting output file uses CRLF end of lines. This contradicts the documentation, which says:
-crlfeol Normally the output file uses a single LF as end of line. When this option is present CRLF is used instead.
So I would have expected the normal output (without passing the -crlfeol flag) to use LF.
How to reproduce
# (on Windows, using Powershell)
echo "message" > message.txt
openssl req -x509 -newkey rsa:4096 -keyout signer_key.pem -out signer.pem -sha256 -days 365 -nodes -subj "/C=US/ST=AAA/L=BBB/O=CCC/CN=www.example.com"
openssl smime -sign -in message.txt -text -signer signer.pem -inkey signer_key.pem -out out.txt
The resulting file looks like this (note the CRLF endings):
Whereas if I run it passing the -crlfeol flag, it seems as if an extra CR is added to the above result, but only in some parts of the message:
Note how when passing -crlfeol, the line endings are CRCRLF except on the signature itself, which is CRLF.