Skip to content

Improve use of PAL's RawData for X509Certificate#103828

Merged
vcsjones merged 2 commits into
dotnet:mainfrom
vcsjones:x509-pal-allocs
Jun 22, 2024
Merged

Improve use of PAL's RawData for X509Certificate#103828
vcsjones merged 2 commits into
dotnet:mainfrom
vcsjones:x509-pal-allocs

Conversation

@vcsjones
Copy link
Copy Markdown
Member

This change pushes down the memoization of RawData from X509Certificate2 to X509Certificate (so we don't have it memoized twice). This is because the RawData property on the ICertificatePal may allocate, such as the case of the OpenSSL PAL.

Since the memoized value is available in the base X509Certificate, use it where appropriate such as creating the hash of a certificate. This also makes a small optimization of using the stack for the intermediate bytes between the hash and the hex value.

See #103814 for some background.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

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.

2 participants