CA5384 Asymmetric encryption algorithm DSA is weak. Switch to an RSA …#7234
CA5384 Asymmetric encryption algorithm DSA is weak. Switch to an RSA …#7234elachlan wants to merge 1 commit intodotnet:mainfrom
Conversation
…with at least 2048 key size, ECDH or ECDSA algorithm instead.
| return s_getRsaPrivateKey(cert); | ||
| } | ||
|
|
||
| internal static DSA GetDSAPublicKey(X509Certificate2 cert) |
There was a problem hiding this comment.
It looks like this is called via reflection, and I don't think it should be removed. I think we should not enable this rule, because I don't understand the compatibility implications of removing support for this style of signing at build time.
msbuild/src/Tasks/ManifestUtil/CngLightup.cs
Lines 520 to 530 in 1fea1d3
There was a problem hiding this comment.
Ahh bummer, I thought we could get away with it because it wasn't referenced anywhere and it was not a public API.
The code you linked is a private function, it is called via GetDSAPublicKey/GetDSAPrivateKey:
msbuild/src/Tasks/ManifestUtil/CngLightup.cs
Lines 118 to 140 in 14efa06
The above methods call BindCoreDelegate is using reflection to call System.Security.Cryptography.X509Certificates.DSACertificateExtensions.GetDSAPublicKey/GetDSAPrivateKey
Additionally, CngLightup is only used when RUNTIME_TYPE_NETCORE=false.
The only public exposed functions I see that end up calling CNGLightup are in src/Tasks/ManifestUtil/SecurityUtil.cs
All calls end up in:
If the file being signed is a portable executable it will use signtool.exe via SignPEFileInternal, if it isn't it will then call GetRSAPrivateKey and throw an OnlyRSACertsAreAllowed error if its null.
msbuild/src/Tasks/ManifestUtil/SecurityUtil.cs
Lines 625 to 637 in 14efa06
There is then the file header comment, which I think might mean this file is pulled in externally somewhere?:
msbuild/src/Tasks/ManifestUtil/CngLightup.cs
Lines 14 to 17 in 518c041
|
Sounds like this one should be closed, right? |
I am not sure. Would the DSA functionality be called from outside of msbuild? If so maybe we need to add an suppression attribute for this analyzer? |
|
Not a bad idea, but personally, I'd prefer to not touch it until someone complains. |
Relates to #7174
https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/CA5384