- Notifications
You must be signed in to change notification settings - Fork5.1k
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ghost commentedJan 17, 2024
Tagging subscribers to this area: @dotnet/area-system-security,@bartonjs,@vcsjones Issue DetailsThe bypasses a few more defensive copies in
Likewise for
|
The bypasses a few more defensive copies in
PublicKey
.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 for
X509Certificate2.PublicKey
. This shaves several hundred bytes in allocation, scaling with the key size.