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
-
Create an XmlDocument.
-
Initialize SignedXml with the document.
-
Initialize a reference using the existing InitializeReference API.
-
Configure the URI, digest method, and required transforms.
-
Attempt to create a reference with:
Type="http://uri.etsi.org/01903#SignedProperties"
-
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
Describe the issue
The System Application
SignedXmlcodeunit 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
Typeattribute of ads: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:SignedPropertiesmust identify the referenced data as SignedProperties using:Business Central currently allows the reference URI, digest algorithm, transforms, etc. to be configured, but not the
Typeattribute.As a result, almost all of the required XAdES structure can be constructed using the existing
SignedXmlAPI, but the resulting signature cannot be made compliant because this standardds:Referenceproperty is inaccessible.Expected behavior
SignedXmlshould expose a way to set theTypeproperty on a reference before it is added to the signature.For example, conceptually:
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.Typeproperty.Steps to reproduce
Create an
XmlDocument.Initialize
SignedXmlwith the document.Initialize a reference using the existing
InitializeReferenceAPI.Configure the URI, digest method, and required transforms.
Attempt to create a reference with:
Observe that the public
SignedXmlAPI provides no method to set theReference.Typevalue.This prevents creation of a standards-compliant XAdES SignedProperties reference.
Additional context
The issue is not specific to XAdES.
Typeis a standard property of an XMLDSIGReference, and exposing it would make the currentSignedXmlwrapper 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
SignedXmlpublic API.We would be willing to contribute the change and tests if appropriate.
I will provide a fix for a bug