Skip to content

ML-KEM: Change public API surface from API review - #114710

Merged
vcsjones merged 1 commit into
dotnet:mainfrom
vcsjones:ml-kem-api-changes
Apr 16, 2025
Merged

ML-KEM: Change public API surface from API review#114710
vcsjones merged 1 commit into
dotnet:mainfrom
vcsjones:ml-kem-api-changes

Conversation

@vcsjones

Copy link
Copy Markdown
Member

The reacts to the API changes made in #114453 (so far)

Diff:

- public void Decapsulate(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret, out int sharedSecretBytesWritten);- public byte[] Encapsulate(System.Span<byte> sharedSecret);- Encapsulate(Span<byte> ciphertext, Span<byte> sharedSecret, out int ciphertextBytesWritten, out int sharedSecretBytesWritten);- protected void ThrowIfDisposed();- public byte[] Encapsulate(out byte[] sharedSecret);+ public void Encapsulate(out byte[] ciphertext, out byte[] sharedSecret);

Contributes to #113508

@vcsjonesvcsjones added this to the 10.0.0 milestone Apr 15, 2025
@vcsjones
vcsjones requested a review from bartonjsApril 15, 2025 19:57
@vcsjonesvcsjones self-assigned this Apr 15, 2025
CopilotAI review requested due to automatic review settings April 15, 2025 19:57
@ghost

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

1 similar comment
@ghost

Copy link
Copy Markdown

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the public API for the ML-KEM implementation to reflect recent API review recommendations.

  • Removed several overloads for Decapsulate and Encapsulate.
  • Introduced a new signature for Encapsulate that returns both ciphertext and shared secret via out parameters.
  • Updated tests across libraries to use the new API surface.

Reviewed Changes

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

FileDescription
src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.csUpdated public API signatures for ML-KEM.
src/libraries/Common/tests/System/Security/Cryptography/MLKemContractTests.csRemoved tests for removed overloads; added tests for the new API.
src/libraries/Common/tests/System/Security/Cryptography/MLKemBaseTests.csUpdated tests to align with the revised API, removing references to obsolete overloads.
src/libraries/Common/src/System/Security/Cryptography/MLKem.csRefactored implementation of Encapsulate and ThrowIfDisposed to support the new API.

@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 freeto 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.

3 participants

@vcsjones@bartonjs