From 3b1e29020744870113b45a2e640e1583542144e1 Mon Sep 17 00:00:00 2001 From: Pranav Senthilnathan Date: Tue, 18 Aug 2026 02:15:37 -0700 Subject: [PATCH] Expose Composite ML-DSA CNG identifiers (#132353) Fixes #130052 > [!NOTE] > This PR description was generated with GitHub Copilot. Copilot-Session: 5676db47-d54b-4946-97ec-7fc0a7392c30 (cherry picked from commit 663c457b86ccd35743374676a69de5ed97bc3b14) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs | 7 ------- .../ref/System.Security.Cryptography.cs | 4 ++++ .../src/System/Security/Cryptography/CngAlgorithm.cs | 3 ++- .../src/System/Security/Cryptography/CngAlgorithmGroup.cs | 3 ++- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs index e463cc3915607b..5233a38a5e9f98 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/CompositeMLDsa/CompositeMLDsaTestHelpers.Cng.cs @@ -13,13 +13,6 @@ namespace System.Security.Cryptography.Tests { internal static partial class CompositeMLDsaTestHelpers { - private static readonly CngAlgorithm s_compositeMLDsa = new CngAlgorithm("Composite-ML-DSA"); - - extension (CngAlgorithm) - { - internal static CngAlgorithm CompositeMLDsa => s_compositeMLDsa; - } - private const int NTE_NOT_SUPPORTED = unchecked((int)0x80090029); private static readonly Lazy s_lazyIsCngSupported = new(CheckCngSupport); diff --git a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs index 9e9e74d7baf34f..a31bb9c161c795 100644 --- a/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs +++ b/src/libraries/System.Security.Cryptography/ref/System.Security.Cryptography.cs @@ -336,6 +336,8 @@ public sealed partial class CngAlgorithm : System.IEquatable object that specifies the Composite Module-Lattice-Based /// Digital Signature Algorithm (Composite ML-DSA). /// - internal static CngAlgorithm CompositeMLDsa => + [Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)] + public static CngAlgorithm CompositeMLDsa => field ??= new CngAlgorithm("Composite-ML-DSA"); // BCRYPT_COMPOSITE_MLDSA_ALGORITHM private static CngAlgorithm? s_ecdh; diff --git a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngAlgorithmGroup.cs b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngAlgorithmGroup.cs index 4e1cbe48dc5d0d..39a0c2a08fd010 100644 --- a/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngAlgorithmGroup.cs +++ b/src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/CngAlgorithmGroup.cs @@ -164,7 +164,8 @@ public static CngAlgorithmGroup Rsa /// /// An object that specifies the Composite ML-DSA family of algorithms. /// - internal static CngAlgorithmGroup CompositeMLDsa => + [Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)] + public static CngAlgorithmGroup CompositeMLDsa => field ??= new CngAlgorithmGroup("CompositeMLDSA"); // NCRYPT_COMPOSITE_MLDSA_ALGORITHM_GROUP private static CngAlgorithmGroup? s_dh;