ML-KEM: X509Certificate2.GetMLKemPublicKey#114657
Merged
vcsjones merged 5 commits intodotnet:mainfrom Apr 15, 2025
Merged
Conversation
|
Note regarding the |
1 similar comment
|
Note regarding the |
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces an in-box implementation of X509Certificate2.GetMLKemPublicKey(), exposing the new ML-KEM API and adding the corresponding reflection metadata and unit tests.
- Implements GetMLKemPublicKey with proper XML documentation and experimental attributes.
- Updates the reference assembly to expose the new API.
- Adds unit tests and test data for various ML-KEM certificate scenarios.
Reviewed Changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs | Adds the new GetMLKemPublicKey() implementation with experimental support. |
| src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs | Updates the public contract to include GetMLKemPublicKey(). |
| src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/MLKemCertTests.cs | Provides tests for the new ML-KEM API under different conditions. |
| src/libraries/Common/tests/System/Security/Cryptography/MLKemTestData.cs | Adds test data including certificate PEM strings for ML-KEM certificates. |
Files not reviewed (1)
- src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj: Language not supported
....Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509Certificate2.cs
Show resolved
Hide resolved
bartonjs
reviewed
Apr 14, 2025
src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/MLKemCertTests.cs
Outdated
Show resolved
Hide resolved
bartonjs
approved these changes
Apr 14, 2025
Member
bartonjs
left a comment
There was a problem hiding this comment.
One question about a test, otherwise LGTM
vcsjones
commented
Apr 14, 2025
src/libraries/Common/tests/System/Security/Cryptography/X509Certificates/MLKemCertTests.cs
Outdated
Show resolved
Hide resolved
This was referenced Apr 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This provides an in-box implementation of
X509Certificate2.GetMLKemPublicKey().Originally, this change included the
X509CertificateKeyAccessorsfor Microsoft.Bcl.Cryptography. However, we cannot meaningfully test this until there is a Windows / .NET Framework implementation ofMLKem. The unit tests run for either NetCoreAppCurrent, which is .NET 10 and the implementation ofX509CertificateKeyAccessorswill be "Just call the one on X509Certificate2". The other target for the unit tests is .NET Framework, which would use the downlevel implementation, but we lack a functionMLKemon Windows at the moment.Instead of including a big chunk of untestable code, I decided to hold off on that part, for now.