Skip to content

Conversation

@vcsjones
Copy link
Member

This is a place I missed when adopting the new callback-based Encode on AsnWriter in #106728. This avoids a rent and a copy of data.

@vcsjones vcsjones self-assigned this Feb 17, 2025
Copilot AI review requested due to automatic review settings February 17, 2025 22:02
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.

PR Overview

This pull request updates the DSAKeyFormatHelper to use the new callback-based Encode API on AsnWriter instead of renting a buffer and copying data.

  • Replaces direct buffer renting and TryEncode with a callback that writes a BitString directly to the writer
  • Removes obsolete error handling via Debug.Fail and exception throwing on buffer encoding failure

Changes

File Description
src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs Converted buffer-based encoding to use AsnWriter's callback-based Encode, eliminating CryptoPool usage

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

src/libraries/Common/src/System/Security/Cryptography/DSAKeyFormatHelper.cs:277

  • Ensure that the updated callback properly handles encoding failures. In the previous code, an explicit Debug.Fail and exception were triggered when TryEncode failed; please verify that inner.Encode will throw an exception or otherwise signal failure if encoding does not succeed.
inner.Encode(writer, static (writer, encoded) => {

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

@dotnet-policy-service
Copy link
Contributor

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

@vcsjones vcsjones merged commit e75eb9c into dotnet:main Feb 19, 2025
82 of 86 checks passed
@vcsjones vcsjones deleted the no-rent-dsa-asn branch February 19, 2025 01:59
@github-actions github-actions bot locked and limited conversation to collaborators Mar 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants