Add ToXmlString and FromXmlString implementations to RSA and DSA.
authorJeremy Barton <jbarton@microsoft.com>
Wed, 15 May 2019 05:54:46 +0000 (22:54 -0700)
committerGitHub <noreply@github.com>
Wed, 15 May 2019 05:54:46 +0000 (22:54 -0700)
commitdc833dcf78881c10105df2c61c7378d98f5820bc
tree3a864606725144711be6ed503a6c0cdca2caceaf
parentace0212fed19e3db89709caa82af89c9a7432931
Add ToXmlString and FromXmlString implementations to RSA and DSA.

The ToXmlString implementations produce output identical to .NET Framework.

The FromXmlString implementations are based on XDocument in Core, vs a
custom parser in Framework.  Additionally, the FromXmlString in Core can
read values which (per the xmldsig spec) removed any leading zero-value
bytes, whereas the Framework version can't.

No ToXmlString or FromXmlString is being added for ECDsa or
ECDiffieHellman, because these types have always thrown in .NET Framework.
The equivalent functionality was provided by an overload on ECDsaCng (and
ECDiffieHellmanCng) that took a format-type enum (with only one member
defined in it). Since that's not portable, and telemetry has never
seen a caller of that method, they are being left as PNSE.

Commit migrated from https://github.com/dotnet/corefx/commit/271138bc0625ff82b1d1b5cb115a309130d8202e
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAFactory.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSAXml.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/ImportExport.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAKeyFileTests.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAXml.cs
src/libraries/System.Security.Cryptography.Algorithms/src/Resources/Strings.resx
src/libraries/System.Security.Cryptography.Algorithms/src/System.Security.Cryptography.Algorithms.csproj
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.Xml.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/RSA.Xml.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/XmlKeyHelper.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj