Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Allow transporting an indefinite-length encoding for content in SignedCms#32704

Merged
bartonjs merged 1 commit intodotnet:masterfrom
bartonjs:signedcms_encode_indefcontent
Oct 9, 2018
Merged

Allow transporting an indefinite-length encoding for content in SignedCms#32704
bartonjs merged 1 commit intodotnet:masterfrom
bartonjs:signedcms_encode_indefcontent

Conversation

@bartonjs
Copy link
Member

@bartonjs bartonjs commented Oct 8, 2018

SignedCms reads BER, because the spec says to, and writes DER, to provide
better interop. If the incoming message used an indefinite length encoding
for SignedData.encapContentInfo.eContent's ANY value the call to Encode
will throw (as will any mutation operations which internally use Encode).

With this change, if writing DER fails then assemble the output in pieces to leave
the encapsulated content as-is while DER-normalizing the rest of the structure.

Fixes #32679

…dCms

SignedCms reads BER, because the spec says to, and writes DER, to provide
better interop.  If the incoming message used an indefinite length encoding
for SignedData.encapContentInfo.eContent's ANY value the call to Encode
will throw (as will any mutation operations which internally use Encode).

With this change, if writing DER fails then assemble the output in pieces to leave
the encapsulated content as-is while DER-normalizing the rest of the structure.
@bartonjs bartonjs added this to the 3.0 milestone Oct 8, 2018
@bartonjs bartonjs self-assigned this Oct 8, 2018
Copy link
Member

@krwq krwq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, can't see any easy way to add more validation

@GrabYourPitchforks
Copy link
Member

I appreciated the Debug.Assert in the code. Clarified the fact that you were mutating just the copy. :)

@bartonjs bartonjs merged commit 4cd30e7 into dotnet:master Oct 9, 2018
@bartonjs bartonjs deleted the signedcms_encode_indefcontent branch October 9, 2018 14:23
@bartonjs bartonjs removed their assignment Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants