[Bug]: SignedXml cannot validate XML signatures using Canonical XML 1.1
Nobody has claimed this yet.
- Dominant language
- AL
- Stars
- 683
- Forks
- 459
- Avg merge
- 3d 26m
- Merged PRs (30d)
- 633
Description
Describe the issue
The System Application SignedXml implementation cannot process XML signatures that use W3C Canonical XML 1.1:
http://www.w3.org/2006/12/xml-c14n11
Canonical XML 1.1 is used by real-world XMLDSIG/XAdES documents, including signed business documents.
When such a signature is loaded through SignedXml, the Canonical XML 1.1 transform cannot be resolved by the current implementation, so the signature cannot be cryptographically verified.
This appears to originate from the underlying System.Security.Cryptography.Xml implementation, which currently does not provide a built-in Canonical XML 1.1 transform.
The upstream .NET issue is:
https://github.com/dotnet/runtime/issues/132231
This is separate from the previously reported XPath Filter 2.0 transform issue in #10215
Expected behavior
SignedXml should be able to load and verify standards-compliant XML signatures using Canonical XML 1.1.
If support depends on the underlying .NET implementation, Business Central should be able to use that support once it becomes available.
Alternatively, the SignedXml abstraction should expose sufficient transform extensibility for consumers to provide an implementation for otherwise unsupported XMLDSIG transforms.
Steps to reproduce
-
Obtain the valid Canonical XML 1.1 XMLDSIG test document referenced in the abovementioned dotnet/runtime issue.
The test document uses:
-
Create a small AL codeunit or test that reads the XML document.
-
Select its XMLDSIG Signature element.
-
Pass that element to the System Application SignedXml implementation.
-
Observe that SignedXml cannot process the signature because
http://www.w3.org/2006/12/xml-c14n11 is not supported by the current
implementation.
Additional context
Canonical XML 1.1 is a W3C XML canonicalization standard and is used in
real XML digital-signature ecosystems.
We encountered this while implementing generic XAdES verification support
using the System Application SignedXml abstraction. Documents using the
currently supported canonicalization algorithms can be processed, while
documents using Canonical XML 1.1 cannot.
A public, non-confidential valid XMLDSIG test vector is referenced in the
linked dotnet/runtime issue, so no customer or invoice data is required to
reproduce the problem.
I am willing to contribute a fix on the Business Central side if changes
are required there once the underlying .NET capability is available, or
if exposing generic transform extensibility is considered the preferred
solution.
I will provide a fix for a bug
- I will provide a fix for a bug
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the System Application SignedXml abstraction and the AL codeunit or test that loads the Signature element; review the linked dotnet/runtime issue and its public Canonical XML 1.1 test vector. The work is done when the vector can be loaded and cryptographically verified, either through underlying .NET support or an appropriate transform-extensibility path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- xml
- Domain
- backend, cryptography, security
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100