microsoft / microsoft/BCApps

[Bug]: SignedXml cannot validate XML signatures using Canonical XML 1.1

Open
#10,218 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Team: Integrations
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
  1. Obtain the valid Canonical XML 1.1 XMLDSIG test document referenced in the abovementioned dotnet/runtime issue.

    The test document uses:

    http://www.w3.org/2006/12/xml-c14n11

  2. Create a small AL codeunit or test that reads the XML document.

  3. Select its XMLDSIG Signature element.

  4. Pass that element to the System Application SignedXml implementation.

  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.