Skip to content

fix(smime): preserve terminal CRLF in detached signed MIME entities - #38

Merged
rathlinus merged 1 commit into
bulwarkmail:mainfrom
StefanSa:fix/smime-detached-crlf
Nov 9, 2026
Merged

rathlinus merged 1 commit into
bulwarkmail:mainfrom
StefanSa:fix/smime-detached-crlf

Conversation

@StefanSa

@StefanSa StefanSa commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

MIME serializers can append CRLF after multipart closing delimiters, changing the bytes covered by a detached S/MIME signature. The original MIME framing is standards-compliant and the original signatures verify cryptographically; reserialization can nevertheless invalidate them.

Terminate newly generated detached MIME entities before CMS signing, retaining a separate outer boundary framing CRLF. Apply the same treatment to nested multipart/alternative inside multipart/mixed. Historical signature verification and opaque/encrypted generation remain unchanged.

Validation: 17 focused tests pass, including OpenSSL S/MIME and exact-entity CMS verification, byte-identical Python MIME serialization round-trips, and boundary framing checks. The plugin build passes. External-client interoperability was manually confirmed after deploying this patch.

@rathlinus
rathlinus merged commit 4150864 into bulwarkmail:main Nov 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants