Skip to content

Move more things away from PointerMemoryManager#125854

Open
vcsjones wants to merge 2 commits intodotnet:mainfrom
vcsjones:ref-struct-asn-pfx
Open

Move more things away from PointerMemoryManager#125854
vcsjones wants to merge 2 commits intodotnet:mainfrom
vcsjones:ref-struct-asn-pfx

Conversation

@vcsjones
Copy link
Member

A couple of quick things related to PFX that we can ref-struct-ify.

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @bartonjs, @vcsjones, @dotnet/area-system-security
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors PKCS#12/PFX content sniffing on Apple platforms to use stack-only ASN.1 “Value*” ref-struct decoders, reducing reliance on unsafe pinning and PointerMemoryManager.

Changes:

  • Replace PKCS#12 sniffing in Apple certificate content-type detection with ValuePfxAsn.Decode(...).
  • Update ASN.1 schema emission for PfxAsn, MacData, and DigestInfoAsn to generate both classic and Value* ref-struct types (emitType="both").
  • Introduce ValuePfxAsn, ValueMacData, and ValueDigestInfoAsn generated decoders/encoders to support span-based parsing.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Pal.macOS.cs Switch PKCS#12 sniffing to ValuePfxAsn to avoid unsafe pinning/PointerMemoryManager.
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/AppleCertificatePal.ImportExport.iOS.cs Switch PKCS#12 sniffing to ValuePfxAsn for span-based parsing.
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs12/PfxAsn.xml.cs Generated ValuePfxAsn ref-struct implementation (span-based).
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs12/PfxAsn.xml Enable dual emission (emitType="both") and specify valueTypeName mappings.
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs12/MacData.xml.cs Generated ValueMacData ref-struct implementation (span-based).
src/libraries/Common/src/System/Security/Cryptography/Asn1/Pkcs12/MacData.xml Enable dual emission (emitType="both") and specify valueTypeName mappings.
src/libraries/Common/src/System/Security/Cryptography/Asn1/DigestInfoAsn.xml.cs Generated ValueDigestInfoAsn ref-struct implementation (span-based).
src/libraries/Common/src/System/Security/Cryptography/Asn1/DigestInfoAsn.xml Enable dual emission (emitType="both") and specify valueTypeName mappings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants