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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Deepika SawantRank #242 · 10.2K reputationPosted Oct 13, 2025, 9:23 AM EDT
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: