Search code examples
c#xmldigital-signature.net-5

.NET5 C# XPath Filter 2.0 Support (XML Digital Signatures)


I'm writing a .NET5 routine to check a signed XML File. The file had this "http://www.w3.org/2002/06/xmldsig-filter2" as transformation Alghoritm. So, when I try to load it into SignedXML object (using SignedXml.LoadXml() method), I get an error:

System.Security.Cryptography.CryptographicException: 'Unknown transform has been encountered.'

I tried to search for the correct transform class into .NET but i found only XmlDsigXPathTransform. Is there a way to achieve it? Many thanks for your suggestions.

Check the XML signature


Solution

  • The System.Security.Cryptography.Xml namespace does not contain a class that implements the XPath Filter 2.0 transform algorithm, but only the XPath transform algorithm (which is not the same).

    A possibility would be to implement the XPath Filter 2.0 algorithm as a class inheriting from Transform yourself.