Change X509CertificateLoader to wrap unsupported algorithms with a CryptographicException#104040
Conversation
…yptographicException
|
Tagging subscribers to this area: @dotnet/area-system-security, @bartonjs, @vcsjones |
The test is actually checking the exception message? We generally try not to do that. |
No, the test does not do that. When I say "same message" meant the product behavior. "Let's go back to throwing a CryptographicException like we were before the loader was merged, and the exception text that I used for the CryptographicException is also the same as it was before". |
I don't think it is, since in the premise he points out that me regressing CryptographicException to PNSE here unmasked that we have a test that is passing, but for the wrong reason. |
|
/azp run runtime-android |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Before the X509CertificateLoader was merged, the
ReadECDsaPrivateKey_BrainpoolP160r1_Pfxtest on Android was passing, but for the wrong reason. The test is asserting that the platform throws a CryptographicException for brainpool curves. On Android it was throwing a CryptographicException because the PFX is protected with RC2, which is unavailable on Android.This PR changes the PBE decryption to wrap the PlatformNotSupportedException with a CryptographicException with the same message, restoring the previous behavior.
We should probably investigate fixing the brainpool test to use an algorithm other than RC2 so we can confirm the Android tests fail for the right reason, but this unblocks CI.
Before loader merge:
After this pull request:
Fixes #104030