MLDsa 和 SlhDsa “SecretKey” 成员已重命名

量子后加密(PQC)类[Experimental]System.Security.Cryptography.MLDsa中的System.Security.Cryptography.SlhDsa一些方法和属性已重命名。 涉及sk各自规范的值的 API 现在在其名称PrivateKey中而不是SecretKey名称中。

已引入的版本

.NET 10

以前的行为

以前,可以像这样调用方法ImportMLDsaSecretKeyImportSlhDsaSecretKey,也可以访问类似SecretKeySizeInBytes属性。

新行为

从 .NET 10 开始,必须调用方法,比如ImportMLDsaPrivateKeyImportSlhDsaPrivateKey,以及访问类似PrivateKeySizeInBytes的属性。

破坏性变更的类型

此更改可能会影响 源兼容性

更改原因

进行了更改,以便与 .NET 中的现有非对称加密类型以及相关成员(例如 ExportPkcs8PrivateKey()) 保持一致。

通过将名为成员名称中的实例SecretKeyPrivateKey替换为此更改中的任何编译中断:

-int targetSize = key.Algorithm.SecretKeySizeInBytes;
+int targetSize = key.Algorithm.PrivateKeySizeInBytes;
byte[] output = new byte[targetSize];
-key.ExportMLDsaSecretKey(output);
+key.ExportMLDsaPrivateKey(output);

受影响的 API

  • System.Security.Cryptography.MLDsa.ImportMLDsaSecretKey()
  • System.Security.Cryptography.MLDsa.ExportMLDsaSecretKey()
  • System.Security.Cryptography.MLDsaAlgorithm.SecretKeySizeInBytes
  • System.Security.Cryptography.SlhDsa.ImportSlhDsaSecretKey()
  • System.Security.Cryptography.SlhDsa.ExportSlhDsaSecretKey()
  • System.Security.Cryptography.SlhDsaAlgorithm.SecretKeySizeInBytes