This repository was archived by the owner on Aug 12, 2025. It is now read-only.

Description
It appears the library is setting a randomly generated Id to the QualifyingPropertes Target attribute when SignedXml is constructed, and I do not see any way to change this.XmlSignature.Id before this happens.
export class SignedXml extends XmlDSigJs.SignedXml {
constructor(node?: Document | Element) {
super(node);
this.CreateQualifyingProperties();
}
protected CreateQualifyingProperties() {
if (this.Properties) {
throw new XmlCore.XmlError(XmlCore.XE.XML_EXCEPTION, "Cannot create QualifyingProperties cause current signature has got one. You must create CounterSignature");
}
const rnd = XmlDSigJs.Application.crypto.getRandomValues(new Uint8Array(6)) as Uint8Array;
const id = XmlCore.Convert.ToHex(rnd);
this.XmlSignature.Id ||= `id-${id}`;
const dataObject = new XAdES.DataObject();
dataObject.QualifyingProperties.Target = `#${this.XmlSignature.Id}`;
dataObject.QualifyingProperties.SignedProperties.Id ||= `xades-${this.XmlSignature.Id}`;
this.properties = dataObject.QualifyingProperties;
this.XmlSignature.ObjectList.Add(dataObject);
}
}
Shouldn't this Id be the same as the Signature id set in SignedXml().Sign fourth parameter (OptionsXAdES)?
From XAdES spec:
4.2 The QualifyingProperties
The mandatory Target attribute refers to the XML signature with which the qualifying properties are associated.