Caleb
Caleb

Reputation: 1

SignedXml.CheckSignature different after .NET 8 upgrade

I'm currently working to upgrade some projects from .NET 6 to .NET 8. Right now, I'm having an issue with signature validation.

Currently, I take an XML document and parse out the X509Certificate element from the signature. With the certificate, I get the RSA public key using x509Certificate.GetRSAPublicKey. I then load the signature element from the XML into a signedXml object. The issue I'm having is when I run signedXml.CheckSignature(RsaPublicKey). This used to just work in .NET 6, but in .NET 8 the signature is no longer valid.

My initial suspicion was that x509Certificate.GetRSAPublicKey was not functioning correctly. The first thing I noticed was that in .NET 6 it would return an RSA key from System.Security.Cryptography.RSACng while in .NET 8 it is from System.Security.Cryptography.CSBCrypt (running Windows in both instances). I swapped out the public key to try signedXml.CheckSignature(x509Cert, true), but that ended in same result as before.

Upvotes: 0

Views: 51

Answers (0)

Related Questions