Repository navigation
Sign detached signatures over raw bytes with openssl -binary - #20
Merged
Merged
Conversation
15081 The cms -sign invocation in OpenSslOptions omitted -binary, so openssl ran the content through SMIME_crlf_copy and digested a CRLF-rewritten copy rather than the bytes on disk. This is OpenSSL library behaviour, not host behaviour. The manifest is only the visible symptom. Text canonicalization also rewrites every lone LF inside a zip, dll or exe before hashing, so detached signatures over binaries have never covered the shipped bytes either. The verify command documented in Readme.md passes -binary and therefore could not have succeeded against these signatures for any real archive. Two things kept that hidden: the client's HasValidDetachedSignature was reduced to a structural check because the canonicalized digest could not be reproduced in .NET, and the one test that did verify byte-exactly fell back to asserting the .sig merely exists and is non-empty whenever validation failed. Adds -binary to the service and test-harness templates, restores the client check to a real CheckSignature(verifySignatureOnly: true) against the raw bytes, drops the fallback assertion, and adds LF/CRLF cases that fail without the flag. Signatures issued before this change verify only without -binary and ones issued after only with it.
JoshuaPeddle
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
15081
The cms -sign invocation in OpenSslOptions omitted -binary, so openssl ran the content through SMIME_crlf_copy and digested a CRLF-rewritten copy rather than the bytes on disk. This is OpenSSL library behaviour, not host behaviour.
The manifest is only the visible symptom. Text canonicalization also rewrites every lone LF inside a zip, dll or exe before hashing, so detached signatures over binaries have never covered the shipped bytes either. The verify command documented in Readme.md passes -binary and therefore could not have succeeded against these signatures for any real archive. Two things kept that hidden: the client's HasValidDetachedSignature was reduced to a structural check because the canonicalized digest could not be reproduced in .NET, and the one test that did verify byte-exactly fell back to asserting the .sig merely exists and is non-empty whenever validation failed.
Adds -binary to the service and test-harness templates, restores the client check to a real CheckSignature(verifySignatureOnly: true) against the raw bytes, drops the fallback assertion, and adds LF/CRLF cases that fail without the flag. Signatures issued before this change verify only without -binary and ones issued after only with it.