Skip to content

Scaffold CompositeMLDsa and CompositeMLDsaAlgorithm #116926

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

PranavSenthilnathan
Copy link
Member

This PR adds the public API skeleton for CompositeMLDsa and CompositeMLDsaAlgorithm. The goal of this PR is to get a consensus on src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs so we can start adding implementations.

It also has a rough (and probably buggy) implementation of the API to show its feasibility, but the intent is that all this code is subject to change in future PRs when we actually start thorough implementation and testing. All entry points will eventually throw PNSE to ensure this class can't be used yet, but I'm also fine with removing the extra implementation code if we want to keep the PR scoped to just the API.

@PranavSenthilnathan PranavSenthilnathan added this to the 10.0.0 milestone Jun 23, 2025
@PranavSenthilnathan PranavSenthilnathan self-assigned this Jun 23, 2025
@Copilot Copilot AI review requested due to automatic review settings June 23, 2025 18:55
Copy link
Contributor

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

Pull Request Overview

This PR introduces the initial public API and skeleton implementation for CompositeMLDsa and CompositeMLDsaAlgorithm to support future post-quantum cryptography work. Key changes include adding new API definitions in the reference assembly, providing rough implementation stubs that throw PNSE, and adding associated tests and resource strings.

Reviewed Changes

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

Show a summary per file
File Description
src/libraries/System.Security.Cryptography/tests/System.Security.Cryptography.Tests.csproj Added compile entry for CompositeMLDsaFactoryTests
src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/AsymmetricAlgorithmHelpers.Der.cs Removed implementation of DER helper methods; these are now provided from the common shared source
src/libraries/System.Security.Cryptography/src/System.Security.Cryptography.csproj Added compile entries for new CompositeMLDSA files
src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs Added public API signatures for CompositeMLDsa and CompositeMLDsaAlgorithm
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaFactoryTests.cs Added tests to verify that CompositeMLDsa APIs are not yet supported
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs Introduced the CompositeMLDsaAlgorithm class with several static instances
src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaImplementation.cs Added stub implementations for CompositeMLDsa methods that throw PNSE
src/libraries/Common/src/System/Security/Cryptography/AsymmetricAlgorithmHelpers.Der.cs Added shared DER helper methods
Comments suppressed due to low confidence (1)

src/libraries/Common/src/System/Security/Cryptography/CompositeMLDsaAlgorithm.cs:63

  • The algorithm name for MLDsa44WithRSA2048Pkcs15 appears to be incorrect; the string literal should likely be "MLDSA44-RSA2048-PKCS15-SHA256" to match the variable name and intended algorithm.
        public static CompositeMLDsaAlgorithm MLDsa44WithRSA2048Pkcs15 =        new("MLDSA44-RSA2048-PSS-SHA256",

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.

PranavSenthilnathan and others added 2 commits June 25, 2025 19:45
Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
Co-authored-by: Krzysztof Wicher <mordotymoja@gmail.com>
@PranavSenthilnathan
Copy link
Member Author

I left the min/max calculations as TODOs for the future PRs. As far as the public API goes though, MaxSignatureSizeInBytes is the only one currently exposed. The minimum size of key/signature doesn't provide much value as a public API and maximum size of public keys is not constant for all traditional algos. So the only remaining public API decision is whether we want to expose CompositeMLDsaAlgorithm.MaxPrivateKeySizeInBytes.

@PranavSenthilnathan PranavSenthilnathan merged commit 27b118e into dotnet:main Jun 28, 2025
81 of 87 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants