Skip to content

[Bug]: SignedXml does not expose Reference.Type #10139

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ApprovedThe issue is approvedIntegrationGitHub request for Integration area

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions