Support Rfc3279 signature format for DSA and EcDSA (#1612)
authorKrzysztof Wicher <mordotymoja@gmail.com>
Wed, 18 Mar 2020 15:19:25 +0000 (08:19 -0700)
committerGitHub <noreply@github.com>
Wed, 18 Mar 2020 15:19:25 +0000 (08:19 -0700)
commit960b9a8df83de4efb03758a18fafbc4c6bab3b00
tree4d69a78f89946fc73e04f5b4d659f849e10083dc
parent8722e7a7616168816412532d9278d865286c41d1
Support Rfc3279 signature format for DSA and EcDSA (#1612)

This change adds overloads for SignData and SignHash/ComputeSignature on the DSA and ECDsa classes to make it easier for callers that need to use RFC3279's signature format to work with the classes in .NET.

It also moves more temporary work from temporary buffers to stackallocs.

Co-authored-by: Jeremy Barton <jbarton@microsoft.com>
28 files changed:
src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs
src/libraries/Common/src/Internal/Cryptography/Helpers.cs
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs
src/libraries/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs
src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs
src/libraries/Common/src/System/Security/Cryptography/DSASecurityTransforms.cs
src/libraries/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs
src/libraries/Common/src/System/Security/Cryptography/ECDsaOpenSsl.cs
src/libraries/Common/src/System/Security/Cryptography/ECDsaSecurityTransforms.cs
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DSASignatureFormatTests.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/DSA/DsaFamilySignatureFormatTests.cs [new file with mode: 0644]
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/ECDsa/ECDsaSignatureFormatTests.cs [new file with mode: 0644]
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_ecdsa.c
src/libraries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.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.cs
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormat.cs [new file with mode: 0644]
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/ECDsaTests.cs
src/libraries/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj
src/libraries/System.Security.Cryptography.Cng/src/System.Security.Cryptography.Cng.csproj
src/libraries/System.Security.Cryptography.Cng/tests/System.Security.Cryptography.Cng.Tests.csproj
src/libraries/System.Security.Cryptography.Csp/src/System/Security/Cryptography/DSACryptoServiceProvider.Unix.cs
src/libraries/System.Security.Cryptography.Csp/tests/ShimHelpers.cs
src/libraries/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj
src/libraries/System.Security.Cryptography.OpenSsl/src/System.Security.Cryptography.OpenSsl.csproj
src/libraries/System.Security.Cryptography.OpenSsl/tests/System.Security.Cryptography.OpenSsl.Tests.csproj