Skip to content

[Breaking change]: ECDsa/ECDiffieHellman FromXmlString/ToXmlString methods are being marked [Obsolete] #28834

@bartonjs

Description

@bartonjs

Description

The FromXmlString and ToXmlString that are on Elliptic Curve Cryptography types ECDsaCng, ECDiffieHellmanCng, ECDiffieHellmanCngPublicKey, and ECDiffieHellmanPublicKey have been marked as [Obsolete] with diagnostic SYSLIB0042. They were never implemented and always threw a PlatformNotSupportedException exception.

Version

.NET 7 Preview 4

Previous behavior

The members were not obsolete and did not produce a compiler warning.

New behavior

The members are obsolete and produce a compiler warning.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load/execute or different run-time behavior.
  • Source incompatible: Source code may encounter a breaking change in behavior when targeting the new runtime/component/SDK, such as compile errors or different run-time behavior.

Reason for change

The members have been marked [Obsolete] because they were never implemented, and always threw an exception.

Recommended action

Callers should use a standard data format for exchanging EC keys.

ToXmlString can use ExportSubjectPublicKeyInfo or ExportPkcs8PrivateKey depending on if the caller wants the public or private key.

FromXmlString can use ImportSubjectPublicKeyInfo or ImportPkcs8PrivateKey depending on if the caller wants to import a public or private key.

Feature area

Cryptography

Affected APIs

  • M:System.Security.Cryptography.ECDiffieHellmanCng.FromXmlString(System.String, System.Security.Cryptography.ECKeyXmlFormat)
  • M:System.Security.Cryptography.ECDiffieHellmanCng.ToXmlString(System.Security.Cryptography.ECKeyXmlFormat)
  • M:System.Security.Cryptography.ECDiffieHellmanCngPublicKey.FromXmlString(System.String)
  • M:System.Security.Cryptography.ECDiffieHellmanCngPublicKey.ToXmlString()
  • M:System.Security.Cryptography.ECDiffieHellmanPublicKey.ToXmlString()
  • M:System.Security.Cryptography.ECDsaCng.FromXmlString(System.String, System.Security.Cryptography.ECKeyXmlFormat)
  • M:System.Security.Cryptography.ECDsaCng.ToXmlString(System.Security.Cryptography.ECKeyXmlFormat)

Metadata

Metadata

Assignees

Labels

🏁 Release: .NET 7Work items for the .NET 7 releasebreaking-changeIndicates a .NET Core breaking changesource incompatibleSource code may encounter a breaking change in behavior when targeting the new version.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions