Skip to content

Commit ed8fb94

Browse files
authored
Add breaking change documentation for MLDsa and SlhDsa SecretKey to PrivateKey rename (#48275)
1 parent 00192e9 commit ed8fb94

File tree

3 files changed

+65
-10
lines changed

3 files changed

+65
-10
lines changed

docs/core/compatibility/10.0.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
5555
| [System.Linq.AsyncEnumerable included in core libraries](core-libraries/10.0/asyncenumerable.md) | Source incompatible | Preview 1 |
5656
| [YMM embedded rounding removed from AVX10.2](core-libraries/10.0/ymm-embedded-rounding.md) | Behavioral change | Preview 5 |
5757

58+
## Cryptography
59+
60+
| Title | Type of change | Introduced version |
61+
|-------|-------------------|--------------------|
62+
| [CoseSigner.Key can be null](cryptography/10.0/cosesigner-key-null.md) | Behavioral/source incompatible change | Preview 7 |
63+
| [MLDsa and SlhDsa 'SecretKey' members renamed](cryptography/10.0/mldsa-slhdsa-secretkey-to-privatekey.md) | Source incompatible | RC 1 |
64+
| [OpenSSL cryptographic primitives aren't supported on macOS](cryptography/10.0/openssl-macos-unsupported.md) | Behavioral change | Preview 6 |
65+
| [X500DistinguishedName validation is stricter](cryptography/10.0/x500distinguishedname-validation.md) | Behavioral change | Preview 1 |
66+
| [X509Certificate and PublicKey key parameters can be null](cryptography/10.0/x509-publickey-null.md) | Behavioral/source incompatible change | Preview 3 |
67+
| [Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE](cryptography/10.0/version-override.md) | Behavioral change | Preview 1 |
68+
5869
## Entity Framework Core
5970

6071
[Breaking changes in EF Core 10](/ef/core/what-is-new/ef-core-10.0/breaking-changes)
@@ -74,16 +85,6 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
7485
|-------|-------------------|--------------------|
7586
| [Environment variable renamed to DOTNET_ICU_VERSION_OVERRIDE](globalization/10.0/version-override.md) | Behavioral change | Preview 1 |
7687

77-
## Cryptography
78-
79-
| Title | Type of change | Introduced version |
80-
|-------|-------------------|--------------------|
81-
| [CoseSigner.Key can be null](cryptography/10.0/cosesigner-key-null.md) | Behavioral/source incompatible change | Preview 7 |
82-
| [OpenSSL cryptographic primitives aren't supported on macOS](cryptography/10.0/openssl-macos-unsupported.md) | Behavioral change | Preview 6 |
83-
| [X500DistinguishedName validation is stricter](cryptography/10.0/x500distinguishedname-validation.md) | Behavioral change | Preview 1 |
84-
| [X509Certificate and PublicKey key parameters can be null](cryptography/10.0/x509-publickey-null.md) | Behavioral/source incompatible change | Preview 3 |
85-
| [Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE](cryptography/10.0/version-override.md) | Behavioral change | Preview 1 |
86-
8788
## Interop
8889

8990
| Title | Type of change | Introduced version |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: "Breaking change - MLDsa and SlhDsa 'SecretKey' members renamed"
3+
description: "Learn about the breaking change in .NET 10 where MLDsa and SlhDsa members were renamed from using 'SecretKey' to using 'PrivateKey'."
4+
ms.date: 09/05/2025
5+
ai-usage: ai-assisted
6+
ms.custom: https://github.com/dotnet/docs/issues/47691
7+
---
8+
9+
# MLDsa and SlhDsa 'SecretKey' members renamed
10+
11+
Some methods and properties in the `[Experimental]` post-quantum cryptography (PQC) classes <xref:System.Security.Cryptography.MLDsa?displayProperty=fullName> and <xref:System.Security.Cryptography.SlhDsa?displayProperty=fullName> have been renamed. APIs that involve the `sk` value from their respective specifications now have `PrivateKey` in their names instead of `SecretKey`.
12+
13+
## Version introduced
14+
15+
.NET 10 RC 1
16+
17+
## Previous behavior
18+
19+
Previously, you could call methods like `ImportMLDsaSecretKey` and `ImportSlhDsaSecretKey`, and you could access properties like `SecretKeySizeInBytes`.
20+
21+
## New behavior
22+
23+
Starting in .NET 10 RC 1, you must call methods like `ImportMLDsaPrivateKey` or `ImportSlhDsaPrivateKey`, and access properties like `PrivateKeySizeInBytes`.
24+
25+
## Type of breaking change
26+
27+
This change can affect [source compatibility](../../categories.md#source-compatibility).
28+
29+
## Reason for change
30+
31+
The change was made to align with existing asymmetric cryptography types in .NET and with related members such as <xref:System.Security.Cryptography.MLDsa.ExportPkcs8PrivateKey>.
32+
33+
## Recommended action
34+
35+
Resolve any compile breaks from this change by replacing instances of `SecretKey` with `PrivateKey` in the called member names:
36+
37+
```diff
38+
-int targetSize = key.Algorithm.SecretKeySizeInBytes;
39+
+int targetSize = key.Algorithm.PrivateKeySizeInBytes;
40+
byte[] output = new byte[targetSize];
41+
-key.ExportMLDsaSecretKey(output);
42+
+key.ExportMLDsaPrivateKey(output);
43+
```
44+
45+
## Affected APIs
46+
47+
- <xref:System.Security.Cryptography.MLDsa.ImportMLDsaSecretKey*?displayProperty=fullName>
48+
- <xref:System.Security.Cryptography.MLDsa.ExportMLDsaSecretKey*?displayProperty=fullName>
49+
- <xref:System.Security.Cryptography.MLDsaAlgorithm.SecretKeySizeInBytes?displayProperty=fullName>
50+
- <xref:System.Security.Cryptography.SlhDsa.ImportSlhDsaSecretKey*?displayProperty=fullName>
51+
- <xref:System.Security.Cryptography.SlhDsa.ExportSlhDsaSecretKey*?displayProperty=fullName>
52+
- <xref:System.Security.Cryptography.SlhDsaAlgorithm.SecretKeySizeInBytes?displayProperty=fullName>

docs/core/compatibility/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ items:
7272
href: cryptography/10.0/cosesigner-key-null.md
7373
- name: Environment variable renamed to DOTNET_OPENSSL_VERSION_OVERRIDE
7474
href: cryptography/10.0/version-override.md
75+
- name: MLDsa and SlhDsa 'SecretKey' members renamed
76+
href: cryptography/10.0/mldsa-slhdsa-secretkey-to-privatekey.md
7577
- name: OpenSSL cryptographic primitives not supported on macOS
7678
href: cryptography/10.0/openssl-macos-unsupported.md
7779
- name: X500DistinguishedName validation is stricter

0 commit comments

Comments
 (0)