Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Unexpected CRLF end of line in S/MIME signed messages on Windows #23886

Description

@facutuesca

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):
image

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:

image

Note how when passing -crlfeol, the line endings are CRCRLF except on the signature itself, which is CRLF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlog fixThe issue was closed as part of the backlog reduction initiative.branch: 3.0Applies to openssl-3.0 branchbranch: 3.4Applies to openssl-3.4branch: 3.5Applies to openssl-3.5branch: 3.6Applies to openssl-3.6branch: 4.0Applies to openssl-4.0branch: masterApplies to master branchhelp wantedtriaged: bugThe issue/pr is/fixes a bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions