Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reduce defensive copying in PublicKey#97108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
stephentoub merged 1 commit intodotnet:mainfromvcsjones:pubkey-alloc
Jan 20, 2024

Conversation

vcsjones
Copy link
Member

The bypasses a few more defensive copies inPublicKey.

AsnEncodedData(AsnEncodedData) makes a defensive copy of the data for itself, which the constructor ofPublicKey uses. However, there are a few factory methods inPublicKey that create anAsnEncodedData solely for the purpose of transferring toPublicKey. In that circumstance, we can bypass the copy since the creation of theAsnEncodedData already made the defensive copy.

Likewise forX509Certificate2.PublicKey. This shaves several hundred bytes in allocation, scaling with the key size.

@ghost
Copy link

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

Issue Details

The bypasses a few more defensive copies inPublicKey.

AsnEncodedData(AsnEncodedData) makes a defensive copy of the data for itself, which the constructor ofPublicKey uses. However, there are a few factory methods inPublicKey that create anAsnEncodedData solely for the purpose of transferring toPublicKey. In that circumstance, we can bypass the copy since the creation of theAsnEncodedData already made the defensive copy.

Likewise forX509Certificate2.PublicKey. This shaves several hundred bytes in allocation, scaling with the key size.

Author:vcsjones
Assignees:vcsjones
Labels:

area-System.Security

Milestone:-

@stephentoubstephentoub merged commit23eaf25 intodotnet:mainJan 20, 2024
tmds pushed a commit to tmds/runtime that referenced this pull requestJan 23, 2024
@vcsjonesvcsjones added this to the9.0.0 milestoneJan 24, 2024
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 24, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@filipnavarafilipnavarafilipnavara approved these changes

@stephentoubstephentoubstephentoub approved these changes

@bartonjsbartonjsbartonjs approved these changes

Assignees

@vcsjonesvcsjones

Projects
None yet
Milestone
9.0.0
Development

Successfully merging this pull request may close these issues.

4 participants
@vcsjones@filipnavara@stephentoub@bartonjs

[8]ページ先頭

©2009-2025 Movatter.jp