Skip to content

Commit 1766659

Browse files
authored
Remove ExperimentalAttribute from ML-KEM where applicable
1 parent fdfd4c4 commit 1766659

File tree

8 files changed

+58
-18
lines changed

8 files changed

+58
-18
lines changed

src/libraries/Common/src/System/Security/Cryptography/MLKem.cs

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace System.Security.Cryptography
2424
/// cryptographic libraries.
2525
/// </para>
2626
/// </remarks>
27-
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
2827
public abstract partial class MLKem : IDisposable
2928
{
3029
private static readonly string[] s_knownOids = [Oids.MlKem512, Oids.MlKem768, Oids.MlKem1024];
@@ -633,6 +632,7 @@ public byte[] ExportEncapsulationKey()
633632
/// <exception cref="CryptographicException">
634633
/// An error occurred while exporting the key.
635634
/// </exception>
635+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
636636
public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten)
637637
{
638638
ThrowIfDisposed();
@@ -651,6 +651,7 @@ public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesW
651651
/// <exception cref="CryptographicException">
652652
/// An error occurred while exporting the key.
653653
/// </exception>
654+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
654655
public byte[] ExportSubjectPublicKeyInfo()
655656
{
656657
ThrowIfDisposed();
@@ -671,6 +672,7 @@ public byte[] ExportSubjectPublicKeyInfo()
671672
/// <exception cref="CryptographicException">
672673
/// An error occurred while exporting the key.
673674
/// </exception>
675+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
674676
public string ExportSubjectPublicKeyInfoPem()
675677
{
676678
ThrowIfDisposed();
@@ -700,6 +702,7 @@ public string ExportSubjectPublicKeyInfoPem()
700702
/// <exception cref="CryptographicException">
701703
/// An error occurred while exporting the key.
702704
/// </exception>
705+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
703706
public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten)
704707
{
705708
ThrowIfDisposed();
@@ -729,6 +732,7 @@ public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritte
729732
/// <exception cref="CryptographicException">
730733
/// An error occurred while exporting the key.
731734
/// </exception>
735+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
732736
public byte[] ExportPkcs8PrivateKey()
733737
{
734738
ThrowIfDisposed();
@@ -747,6 +751,7 @@ public byte[] ExportPkcs8PrivateKey()
747751
/// <exception cref="CryptographicException">
748752
/// An error occurred while exporting the key.
749753
/// </exception>
754+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
750755
public string ExportPkcs8PrivateKeyPem()
751756
{
752757
ThrowIfDisposed();
@@ -773,6 +778,7 @@ public string ExportPkcs8PrivateKeyPem()
773778
/// <exception cref="CryptographicException">
774779
/// An error occurred while exporting the key.
775780
/// </exception>
781+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
776782
protected abstract bool TryExportPkcs8PrivateKeyCore(Span<byte> destination, out int bytesWritten);
777783

778784
/// <summary>
@@ -811,6 +817,7 @@ public string ExportPkcs8PrivateKeyPem()
811817
/// <para>-or-</para>
812818
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
813819
/// </exception>
820+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
814821
public bool TryExportEncryptedPkcs8PrivateKey(
815822
ReadOnlySpan<char> password,
816823
PbeParameters pbeParameters,
@@ -864,6 +871,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
864871
/// <para>-or-</para>
865872
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
866873
/// </exception>
874+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
867875
public bool TryExportEncryptedPkcs8PrivateKey(
868876
string password,
869877
PbeParameters pbeParameters,
@@ -910,6 +918,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
910918
/// <para>-or-</para>
911919
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
912920
/// </exception>
921+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
913922
public bool TryExportEncryptedPkcs8PrivateKey(
914923
ReadOnlySpan<byte> passwordBytes,
915924
PbeParameters pbeParameters,
@@ -954,6 +963,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
954963
/// <para>-or-</para>
955964
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
956965
/// </exception>
966+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
957967
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)
958968
{
959969
ArgumentNullException.ThrowIfNull(pbeParameters);
@@ -994,6 +1004,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, P
9941004
/// <para>-or-</para>
9951005
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
9961006
/// </exception>
1007+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
9971008
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters)
9981009
{
9991010
ArgumentNullException.ThrowIfNull(pbeParameters);
@@ -1034,6 +1045,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbePar
10341045
/// <para>-or-</para>
10351046
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
10361047
/// </exception>
1048+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
10371049
public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters)
10381050
{
10391051
ArgumentNullException.ThrowIfNull(password);
@@ -1068,6 +1080,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeP
10681080
/// <para>-or-</para>
10691081
/// <para>An error occurred while exporting the key.</para>
10701082
/// </exception>
1083+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
10711084
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)
10721085
{
10731086
ArgumentNullException.ThrowIfNull(pbeParameters);
@@ -1109,6 +1122,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes
11091122
/// <para>-or-</para>
11101123
/// <para>An error occurred while exporting the key.</para>
11111124
/// </exception>
1125+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
11121126
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters)
11131127
{
11141128
ArgumentNullException.ThrowIfNull(pbeParameters);
@@ -1150,6 +1164,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, Pbe
11501164
/// <para>-or-</para>
11511165
/// <para>An error occurred while exporting the key.</para>
11521166
/// </exception>
1167+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
11531168
public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters pbeParameters)
11541169
{
11551170
ArgumentNullException.ThrowIfNull(password);
@@ -1182,6 +1197,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters p
11821197
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
11831198
/// to determine if the platform supports ML-KEM.
11841199
/// </exception>
1200+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
11851201
public static MLKem ImportSubjectPublicKeyInfo(ReadOnlySpan<byte> source)
11861202
{
11871203
Helpers.ThrowIfAsnInvalidLength(source);
@@ -1208,6 +1224,7 @@ static void SubjectPublicKeyReader(ReadOnlyMemory<byte> key, in AlgorithmIdentif
12081224
/// <exception cref="ArgumentNullException">
12091225
/// <paramref name="source" /> is <see langword="null" />
12101226
/// </exception>
1227+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
12111228
public static MLKem ImportSubjectPublicKeyInfo(byte[] source)
12121229
{
12131230
ArgumentNullException.ThrowIfNull(source);
@@ -1244,6 +1261,7 @@ public static MLKem ImportSubjectPublicKeyInfo(byte[] source)
12441261
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
12451262
/// to determine if the platform supports ML-KEM.
12461263
/// </exception>
1264+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
12471265
public static MLKem ImportPkcs8PrivateKey(ReadOnlySpan<byte> source)
12481266
{
12491267
Helpers.ThrowIfAsnInvalidLength(source);
@@ -1258,6 +1276,7 @@ public static MLKem ImportPkcs8PrivateKey(ReadOnlySpan<byte> source)
12581276
/// <exception cref="ArgumentNullException">
12591277
/// <paramref name="source" /> is <see langword="null" />
12601278
/// </exception>
1279+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
12611280
public static MLKem ImportPkcs8PrivateKey(byte[] source)
12621281
{
12631282
ArgumentNullException.ThrowIfNull(source);
@@ -1302,6 +1321,7 @@ public static MLKem ImportPkcs8PrivateKey(byte[] source)
13021321
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
13031322
/// to determine if the platform supports ML-KEM.
13041323
/// </exception>
1324+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
13051325
public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source)
13061326
{
13071327
Helpers.ThrowIfAsnInvalidLength(source);
@@ -1347,6 +1367,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBy
13471367
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
13481368
/// to determine if the platform supports ML-KEM.
13491369
/// </exception>
1370+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
13501371
public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source)
13511372
{
13521373
Helpers.ThrowIfAsnInvalidLength(source);
@@ -1395,6 +1416,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password,
13951416
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
13961417
/// to determine if the platform supports ML-KEM.
13971418
/// </exception>
1419+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
13981420
public static MLKem ImportEncryptedPkcs8PrivateKey(string password, byte[] source)
13991421
{
14001422
ArgumentNullException.ThrowIfNull(password);
@@ -1441,6 +1463,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(string password, byte[] sourc
14411463
/// </list>
14421464
/// </para>
14431465
/// </remarks>
1466+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
14441467
public static MLKem ImportFromPem(ReadOnlySpan<char> source)
14451468
{
14461469
ThrowIfNotSupported();
@@ -1458,6 +1481,7 @@ public static MLKem ImportFromPem(ReadOnlySpan<char> source)
14581481
/// <exception cref="ArgumentNullException">
14591482
/// <paramref name="source" /> is <see langword="null" />
14601483
/// </exception>
1484+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
14611485
public static MLKem ImportFromPem(string source)
14621486
{
14631487
ArgumentNullException.ThrowIfNull(source);
@@ -1519,6 +1543,7 @@ public static MLKem ImportFromPem(string source)
15191543
/// </para>
15201544
/// <para>This method supports the <c>ENCRYPTED PRIVATE KEY</c> PEM label.</para>
15211545
/// </remarks>
1546+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
15221547
public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password)
15231548
{
15241549
return PemKeyHelpers.ImportEncryptedFactoryPem<MLKem, char>(
@@ -1577,6 +1602,7 @@ public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySp
15771602
/// </para>
15781603
/// <para>This method supports the <c>ENCRYPTED PRIVATE KEY</c> PEM label.</para>
15791604
/// </remarks>
1605+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
15801606
public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes)
15811607
{
15821608
return PemKeyHelpers.ImportEncryptedFactoryPem<MLKem, byte>(
@@ -1589,6 +1615,7 @@ public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySp
15891615
/// <exception cref="ArgumentNullException">
15901616
/// <paramref name="source" /> or <paramref name="password" /> is <see langword="null" />
15911617
/// </exception>
1618+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
15921619
public static MLKem ImportFromEncryptedPem(string source, string password)
15931620
{
15941621
ArgumentNullException.ThrowIfNull(source);
@@ -1601,6 +1628,7 @@ public static MLKem ImportFromEncryptedPem(string source, string password)
16011628
/// <exception cref="ArgumentNullException">
16021629
/// <paramref name="source" /> or <paramref name="passwordBytes" /> is <see langword="null" />
16031630
/// </exception>
1631+
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
16041632
public static MLKem ImportFromEncryptedPem(string source, byte[] passwordBytes)
16051633
{
16061634
ArgumentNullException.ThrowIfNull(source);

src/libraries/Common/src/System/Security/Cryptography/MLKemAlgorithm.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace System.Security.Cryptography
1111
/// </summary>
1212
/// <seealso cref="MLKem" />
1313
[DebuggerDisplay("{Name,nq}")]
14-
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
1514
public sealed class MLKemAlgorithm : IEquatable<MLKemAlgorithm>
1615
{
1716
private MLKemAlgorithm(

src/libraries/Common/src/System/Security/Cryptography/MLKemCng.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace System.Security.Cryptography
2222
/// cryptographic libraries.
2323
/// </para>
2424
/// </remarks>
25-
[Experimental(Experimentals.PostQuantumCryptographyDiagId, UrlFormat = Experimentals.SharedUrlFormat)]
2625
public sealed partial class MLKemCng : MLKem
2726
{
2827
private CngKey _key;

0 commit comments

Comments
 (0)