microsoft / microsoft/BCApps

[Extensibility Request] Expose SignedXml Reference.Type

Open
#10,139 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved extensibility-enhancement 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 codeunit exposes most of the functionality required to construct XML Digital Signatures, including references, digest methods, transforms, XML objects, and signature computation.

However, there is currently no public API to set the Type attribute of a ds:Reference.

This prevents extensions from producing standards-compliant signatures for formats that require a typed reference.

A concrete example is XAdES. A reference protecting xades:SignedProperties must identify the referenced data as SignedProperties using:

Type="http://uri.etsi.org/01903#SignedProperties"

Business Central currently allows the reference URI, digest algorithm, transforms, etc. to be configured, but not the Type attribute.

As a result, almost all of the required XAdES structure can be constructed using the existing SignedXml API, but the resulting signature cannot be made compliant because this standard ds:Reference property is inaccessible.

Expected behavior

SignedXml should expose a way to set the Type property on a reference before it is added to the signature.

For example, conceptually:

SignedXml.SetReferenceType(Type: Text);

or another API consistent with the existing reference initialization/configuration methods.

The implementation does not need to contain any XAdES-specific logic. It only needs to expose the standard XMLDSIG Reference.Type property.

Steps to reproduce
  1. Create an XmlDocument.

  2. Initialize SignedXml with the document.

  3. Initialize a reference using the existing InitializeReference API.

  4. Configure the URI, digest method, and required transforms.

  5. Attempt to create a reference with:

    Type="http://uri.etsi.org/01903#SignedProperties"
    
  6. Observe that the public SignedXml API provides no method to set the Reference.Type value.

This prevents creation of a standards-compliant XAdES SignedProperties reference.

Additional context

The issue is not specific to XAdES.

Type is a standard property of an XMLDSIG Reference, and exposing it would make the current SignedXml wrapper more complete without introducing application-specific behavior.

Our immediate use case is implementing generic AdES digital-signature support in AL, including XAdES creation.

We are also preparing a broader proposal for reusable CAdES/XAdES support in System Application, but this issue is independently useful as a small missing piece of the existing SignedXml public API.

We would be willing to contribute the change and tests if appropriate.

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 by locating the System Application SignedXml codeunit and its InitializeReference API, then inspect how Reference properties are exposed and covered by tests. Done means extensions can set a reference Type before adding it to the signature, including the XAdES SignedProperties URI, with test coverage for the exposed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
xml
Domain
api, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.