-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support Rfc3279 signature format for DSA and EcDSA #1612
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial review, will resume later.
src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Internal/Cryptography/AsymmetricAlgorithmHelpers.Der.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Unix/System.Security.Cryptography.Native/Interop.EcDsa.cs
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/DSACng.SignVerify.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/DSAOpenSsl.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/System/Security/Cryptography/ECDsaCng.SignVerify.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/Internal/Cryptography/Helpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Outdated
Show resolved
Hide resolved
|
||
protected virtual bool TryCreateSignatureCore(ReadOnlySpan<byte> hash, Span<byte> destination, DSASignatureFormat signatureFormat, out int bytesWritten) | ||
{ | ||
// This method is expected to be overriden with better implementation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we update the docs for this class will we recommend falling back to this implementation for an unknown signature format, since we'd theoretically handle it in ConvertIeeeP1363Signature for them?
Alternatively, do we want to add something so a derived type can report whether or not it directly handles a format, so that we understand when to apply an 1363-to-destination-scheme strategy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Maybe it's moot since there're only the two, but I like to think ahead)
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Show resolved
Hide resolved
...stem.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSASignatureFormat.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/ECDsa.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Outdated
Show resolved
Hide resolved
Marking as NO REVIEW until I figure out all the failures and fix build issues on non-Windows and fix all feedback so far |
src/libraries/System.Security.Cryptography.Algorithms/tests/DsaEcDsaSignatureFormatTests.cs
Outdated
Show resolved
Hide resolved
...aries/System.Security.Cryptography.Algorithms/ref/System.Security.Cryptography.Algorithms.cs
Show resolved
Hide resolved
This accounts for: * macOS not supporting DSA key generation * macOS not supporting FIPS 186-3 DSA * DSACryptoServiceProvider not supporting FIPS 186-3 DSA * Testing the signature format tests on the concrete types, as well as the opaque ones.
src/libraries/System.Security.Cryptography.Algorithms/src/System/Security/Cryptography/DSA.cs
Outdated
Show resolved
Hide resolved
The existing methods should all be unchanged, and the new methods written in terms of the existing ones.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions about edge cases and error handling, but otherwise seems solid. :)
Fixes: #31548
Please see the issue for more details.