-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
System.Security.Cryptography.Xml.Utils.GetAnyPublicKey returns only RSA or null? #55194
Comments
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks Issue DetailsThis is the line in question: runtime/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs Line 753 in 7e43f8c
But what about DSA or ECDsa keys? Shouldn't it check for them when GetRSAPublicKey() returns null?How about return (AsymmetricAlgorithm) (certificate.GetRSAPublicKey() ?? certificate.GetDSAPublicKey() ?? certificate.GetECDsaPublicKey()); ?
|
Do you have a specifically impacted scenario, or is this just a code inspection question? My recollection is that SignedXml doesn't support ECDSA, so having GetECDsaPublicKey in there doesn't make sense. And GetDSAPublicKey isn't part of .NET Standard 2.0, so we can't call it without splitting the library. Given that there's not a lot usage of DSA we thought it wasn't worth splitting for it. |
@bartonjs I am trying to validate XAdES signatures in XML files. I already use SignedXML for signing such documents with ECDSA keys. The The problem comes when I try to check the signature of an XML signed with something else than an RSA key. I make a new SignedXml, load the signature, and it fails ( What would you suggest I try to do? I could just rip the entire source code of the classes required to reach that particular line, and re-implement them with the needed changes in our app, but I'd rather avoid re-inventing the wheel. ps.: To be honest I didn't research what platforms support what functions of the Cryptography library, my use case is Windows x64, though I believe we compile into portable runtime. |
It looks like:
So adding those calls is a reasonable compat thing to do. |
@bartonjs I can pick this one up for 6.0. |
This is the line in question:
runtime/src/libraries/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
Line 753 in 7e43f8c
But what about DSA or ECDsa keys? Shouldn't it check for them when
GetRSAPublicKey()
returns null?How about
return (AsymmetricAlgorithm) (certificate.GetRSAPublicKey() ?? certificate.GetDSAPublicKey() ?? certificate.GetECDsaPublicKey());
?The text was updated successfully, but these errors were encountered: