Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Add ToXmlString and FromXmlString implementations to RSA and DSA.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bartonjs committed May 15, 2019
1 parent a28176b commit 271138b
Show file tree
Hide file tree
Showing 11 changed files with 2,963 additions and 39 deletions.
Expand Up @@ -24,6 +24,13 @@ public static DSA Create(int keySize)
return s_provider.Create(keySize);
}

public static DSA Create(in DSAParameters dsaParameters)
{
DSA dsa = s_provider.Create();
dsa.ImportParameters(dsaParameters);
return dsa;
}

/// <summary>
/// If false, 186-2 is assumed which implies key size of 1024 or less and only SHA-1
/// If true, 186-3 includes support for keysizes >1024 and SHA-2 algorithms
Expand Down

0 comments on commit 271138b

Please sign in to comment.