After updating System.Security.Cryptography.Xml
from 4.7.0 to 5.0.0 or 6.0.0, with no other changes to my code, I'm getting a NullReferenceException
in IsKeyTheCorrectAlgorithm
. The certificates being used are SHA1 and SHA256 self-signed certificates, created using CNG, CAPI, and OpenSSL.
After weeks of searching, I finally found this obscure GitHub issue indicating the solution (but without acknowledging a problem or fixing the issue): https://github.com/dotnet/runtime/issues/55383.
The solution is to remove calls to CryptoConfig.AddAlgorithm
, which is apparently no longer needed.