Why [SignedXml].CheckSignature() do not pass if canonicalization method is inclusive REC-xml-c14n-20010315?
The same code is working if document is canonicalizated with excl. method
I'm using .NET 8
The same code is working if document is canonicalizated with excl. method
I'm using .NET 8
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Deepika SawantPosted Oct 13, 2025, 1:23 PM
Inclusive canonicalization (
REC-xml-c14n-20010315) can causeSignedXml.CheckSignature()to fail in .NET 8 due to namespace handling differences, especially when default or unused namespaces are present. Exclusive canonicalization avoids these issues by omitting unused namespaces.Key Differences Between Inclusive and Exclusive Canonicalization
Inclusive Canonicalization (
REC-xml-c14n-20010315):Exclusive Canonicalization (
xml-exc-c14n#):Why It Fails in .NET 8
SignedXmlimplementation is sensitive to namespace context and whitespace.CheckSignature()to returnfalse.How to Fix or Work Around It
Prefer Exclusive Canonicalization:
http://www.w3.org/2001/10/xml-exc-c14n#in yourandelements.Ensure
PreserveWhitespace = true:Avoid unnecessary namespaces:
Use
XmlDsigExcC14NTransformexplicitly: