@@ -24,7 +24,6 @@ namespace System.Security.Cryptography
24
24
/// cryptographic libraries.
25
25
/// </para>
26
26
/// </remarks>
27
- [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
28
27
public abstract partial class MLKem : IDisposable
29
28
{
30
29
private static readonly string [ ] s_knownOids = [ Oids . MlKem512 , Oids . MlKem768 , Oids . MlKem1024 ] ;
@@ -633,6 +632,7 @@ public byte[] ExportEncapsulationKey()
633
632
/// <exception cref="CryptographicException">
634
633
/// An error occurred while exporting the key.
635
634
/// </exception>
635
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
636
636
public bool TryExportSubjectPublicKeyInfo ( Span < byte > destination , out int bytesWritten )
637
637
{
638
638
ThrowIfDisposed ( ) ;
@@ -651,6 +651,7 @@ public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesW
651
651
/// <exception cref="CryptographicException">
652
652
/// An error occurred while exporting the key.
653
653
/// </exception>
654
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
654
655
public byte [ ] ExportSubjectPublicKeyInfo ( )
655
656
{
656
657
ThrowIfDisposed ( ) ;
@@ -671,6 +672,7 @@ public byte[] ExportSubjectPublicKeyInfo()
671
672
/// <exception cref="CryptographicException">
672
673
/// An error occurred while exporting the key.
673
674
/// </exception>
675
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
674
676
public string ExportSubjectPublicKeyInfoPem ( )
675
677
{
676
678
ThrowIfDisposed ( ) ;
@@ -700,6 +702,7 @@ public string ExportSubjectPublicKeyInfoPem()
700
702
/// <exception cref="CryptographicException">
701
703
/// An error occurred while exporting the key.
702
704
/// </exception>
705
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
703
706
public bool TryExportPkcs8PrivateKey ( Span < byte > destination , out int bytesWritten )
704
707
{
705
708
ThrowIfDisposed ( ) ;
@@ -729,6 +732,7 @@ public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritte
729
732
/// <exception cref="CryptographicException">
730
733
/// An error occurred while exporting the key.
731
734
/// </exception>
735
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
732
736
public byte [ ] ExportPkcs8PrivateKey ( )
733
737
{
734
738
ThrowIfDisposed ( ) ;
@@ -747,6 +751,7 @@ public byte[] ExportPkcs8PrivateKey()
747
751
/// <exception cref="CryptographicException">
748
752
/// An error occurred while exporting the key.
749
753
/// </exception>
754
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
750
755
public string ExportPkcs8PrivateKeyPem ( )
751
756
{
752
757
ThrowIfDisposed ( ) ;
@@ -773,6 +778,7 @@ public string ExportPkcs8PrivateKeyPem()
773
778
/// <exception cref="CryptographicException">
774
779
/// An error occurred while exporting the key.
775
780
/// </exception>
781
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
776
782
protected abstract bool TryExportPkcs8PrivateKeyCore ( Span < byte > destination , out int bytesWritten ) ;
777
783
778
784
/// <summary>
@@ -811,6 +817,7 @@ public string ExportPkcs8PrivateKeyPem()
811
817
/// <para>-or-</para>
812
818
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
813
819
/// </exception>
820
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
814
821
public bool TryExportEncryptedPkcs8PrivateKey (
815
822
ReadOnlySpan < char > password ,
816
823
PbeParameters pbeParameters ,
@@ -864,6 +871,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
864
871
/// <para>-or-</para>
865
872
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
866
873
/// </exception>
874
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
867
875
public bool TryExportEncryptedPkcs8PrivateKey (
868
876
string password ,
869
877
PbeParameters pbeParameters ,
@@ -910,6 +918,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
910
918
/// <para>-or-</para>
911
919
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
912
920
/// </exception>
921
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
913
922
public bool TryExportEncryptedPkcs8PrivateKey (
914
923
ReadOnlySpan < byte > passwordBytes ,
915
924
PbeParameters pbeParameters ,
@@ -954,6 +963,7 @@ public bool TryExportEncryptedPkcs8PrivateKey(
954
963
/// <para>-or-</para>
955
964
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
956
965
/// </exception>
966
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
957
967
public byte [ ] ExportEncryptedPkcs8PrivateKey ( ReadOnlySpan < byte > passwordBytes , PbeParameters pbeParameters )
958
968
{
959
969
ArgumentNullException . ThrowIfNull ( pbeParameters ) ;
@@ -994,6 +1004,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, P
994
1004
/// <para>-or-</para>
995
1005
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
996
1006
/// </exception>
1007
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
997
1008
public byte [ ] ExportEncryptedPkcs8PrivateKey ( ReadOnlySpan < char > password , PbeParameters pbeParameters )
998
1009
{
999
1010
ArgumentNullException . ThrowIfNull ( pbeParameters ) ;
@@ -1034,6 +1045,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbePar
1034
1045
/// <para>-or-</para>
1035
1046
/// <para><paramref name="pbeParameters"/> does not represent a valid password-based encryption algorithm.</para>
1036
1047
/// </exception>
1048
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1037
1049
public byte [ ] ExportEncryptedPkcs8PrivateKey ( string password , PbeParameters pbeParameters )
1038
1050
{
1039
1051
ArgumentNullException . ThrowIfNull ( password ) ;
@@ -1068,6 +1080,7 @@ public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeP
1068
1080
/// <para>-or-</para>
1069
1081
/// <para>An error occurred while exporting the key.</para>
1070
1082
/// </exception>
1083
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1071
1084
public string ExportEncryptedPkcs8PrivateKeyPem ( ReadOnlySpan < byte > passwordBytes , PbeParameters pbeParameters )
1072
1085
{
1073
1086
ArgumentNullException . ThrowIfNull ( pbeParameters ) ;
@@ -1109,6 +1122,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes
1109
1122
/// <para>-or-</para>
1110
1123
/// <para>An error occurred while exporting the key.</para>
1111
1124
/// </exception>
1125
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1112
1126
public string ExportEncryptedPkcs8PrivateKeyPem ( ReadOnlySpan < char > password , PbeParameters pbeParameters )
1113
1127
{
1114
1128
ArgumentNullException . ThrowIfNull ( pbeParameters ) ;
@@ -1150,6 +1164,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, Pbe
1150
1164
/// <para>-or-</para>
1151
1165
/// <para>An error occurred while exporting the key.</para>
1152
1166
/// </exception>
1167
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1153
1168
public string ExportEncryptedPkcs8PrivateKeyPem ( string password , PbeParameters pbeParameters )
1154
1169
{
1155
1170
ArgumentNullException . ThrowIfNull ( password ) ;
@@ -1182,6 +1197,7 @@ public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters p
1182
1197
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
1183
1198
/// to determine if the platform supports ML-KEM.
1184
1199
/// </exception>
1200
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1185
1201
public static MLKem ImportSubjectPublicKeyInfo ( ReadOnlySpan < byte > source )
1186
1202
{
1187
1203
Helpers . ThrowIfAsnInvalidLength ( source ) ;
@@ -1208,6 +1224,7 @@ static void SubjectPublicKeyReader(ReadOnlyMemory<byte> key, in AlgorithmIdentif
1208
1224
/// <exception cref="ArgumentNullException">
1209
1225
/// <paramref name="source" /> is <see langword="null" />
1210
1226
/// </exception>
1227
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1211
1228
public static MLKem ImportSubjectPublicKeyInfo ( byte [ ] source )
1212
1229
{
1213
1230
ArgumentNullException . ThrowIfNull ( source ) ;
@@ -1244,6 +1261,7 @@ public static MLKem ImportSubjectPublicKeyInfo(byte[] source)
1244
1261
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
1245
1262
/// to determine if the platform supports ML-KEM.
1246
1263
/// </exception>
1264
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1247
1265
public static MLKem ImportPkcs8PrivateKey ( ReadOnlySpan < byte > source )
1248
1266
{
1249
1267
Helpers . ThrowIfAsnInvalidLength ( source ) ;
@@ -1258,6 +1276,7 @@ public static MLKem ImportPkcs8PrivateKey(ReadOnlySpan<byte> source)
1258
1276
/// <exception cref="ArgumentNullException">
1259
1277
/// <paramref name="source" /> is <see langword="null" />
1260
1278
/// </exception>
1279
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1261
1280
public static MLKem ImportPkcs8PrivateKey ( byte [ ] source )
1262
1281
{
1263
1282
ArgumentNullException . ThrowIfNull ( source ) ;
@@ -1302,6 +1321,7 @@ public static MLKem ImportPkcs8PrivateKey(byte[] source)
1302
1321
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
1303
1322
/// to determine if the platform supports ML-KEM.
1304
1323
/// </exception>
1324
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1305
1325
public static MLKem ImportEncryptedPkcs8PrivateKey ( ReadOnlySpan < byte > passwordBytes , ReadOnlySpan < byte > source )
1306
1326
{
1307
1327
Helpers . ThrowIfAsnInvalidLength ( source ) ;
@@ -1347,6 +1367,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBy
1347
1367
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
1348
1368
/// to determine if the platform supports ML-KEM.
1349
1369
/// </exception>
1370
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1350
1371
public static MLKem ImportEncryptedPkcs8PrivateKey ( ReadOnlySpan < char > password , ReadOnlySpan < byte > source )
1351
1372
{
1352
1373
Helpers . ThrowIfAsnInvalidLength ( source ) ;
@@ -1395,6 +1416,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password,
1395
1416
/// The platform does not support ML-KEM. Callers can use the <see cref="IsSupported" /> property
1396
1417
/// to determine if the platform supports ML-KEM.
1397
1418
/// </exception>
1419
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1398
1420
public static MLKem ImportEncryptedPkcs8PrivateKey ( string password , byte [ ] source )
1399
1421
{
1400
1422
ArgumentNullException . ThrowIfNull ( password ) ;
@@ -1441,6 +1463,7 @@ public static MLKem ImportEncryptedPkcs8PrivateKey(string password, byte[] sourc
1441
1463
/// </list>
1442
1464
/// </para>
1443
1465
/// </remarks>
1466
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1444
1467
public static MLKem ImportFromPem ( ReadOnlySpan < char > source )
1445
1468
{
1446
1469
ThrowIfNotSupported ( ) ;
@@ -1458,6 +1481,7 @@ public static MLKem ImportFromPem(ReadOnlySpan<char> source)
1458
1481
/// <exception cref="ArgumentNullException">
1459
1482
/// <paramref name="source" /> is <see langword="null" />
1460
1483
/// </exception>
1484
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1461
1485
public static MLKem ImportFromPem ( string source )
1462
1486
{
1463
1487
ArgumentNullException . ThrowIfNull ( source ) ;
@@ -1519,6 +1543,7 @@ public static MLKem ImportFromPem(string source)
1519
1543
/// </para>
1520
1544
/// <para>This method supports the <c>ENCRYPTED PRIVATE KEY</c> PEM label.</para>
1521
1545
/// </remarks>
1546
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1522
1547
public static MLKem ImportFromEncryptedPem ( ReadOnlySpan < char > source , ReadOnlySpan < char > password )
1523
1548
{
1524
1549
return PemKeyHelpers . ImportEncryptedFactoryPem < MLKem , char > (
@@ -1577,6 +1602,7 @@ public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySp
1577
1602
/// </para>
1578
1603
/// <para>This method supports the <c>ENCRYPTED PRIVATE KEY</c> PEM label.</para>
1579
1604
/// </remarks>
1605
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1580
1606
public static MLKem ImportFromEncryptedPem ( ReadOnlySpan < char > source , ReadOnlySpan < byte > passwordBytes )
1581
1607
{
1582
1608
return PemKeyHelpers . ImportEncryptedFactoryPem < MLKem , byte > (
@@ -1589,6 +1615,7 @@ public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySp
1589
1615
/// <exception cref="ArgumentNullException">
1590
1616
/// <paramref name="source" /> or <paramref name="password" /> is <see langword="null" />
1591
1617
/// </exception>
1618
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1592
1619
public static MLKem ImportFromEncryptedPem ( string source , string password )
1593
1620
{
1594
1621
ArgumentNullException . ThrowIfNull ( source ) ;
@@ -1601,6 +1628,7 @@ public static MLKem ImportFromEncryptedPem(string source, string password)
1601
1628
/// <exception cref="ArgumentNullException">
1602
1629
/// <paramref name="source" /> or <paramref name="passwordBytes" /> is <see langword="null" />
1603
1630
/// </exception>
1631
+ [ Experimental ( Experimentals . PostQuantumCryptographyDiagId , UrlFormat = Experimentals . SharedUrlFormat ) ]
1604
1632
public static MLKem ImportFromEncryptedPem ( string source , byte [ ] passwordBytes )
1605
1633
{
1606
1634
ArgumentNullException . ThrowIfNull ( source ) ;
0 commit comments