Uh oh!
There was an error while loading. Please reload this page.
ML-KEM: X509Certificate2.GetMLKemPublicKey - #114657
Conversation
ghost
commented
Apr 14, 2025
Note regarding the |
1 similar comment
ghost
commented
Apr 14, 2025
Note regarding the |
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
bartonjs
left a comment
There was a problem hiding this comment.
One question about a test, otherwise LGTM
Uh oh!
There was an error while loading. Please reload this page.
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.