Discuss this help topic in SecureBlackbox Forum
XML: Add reference to document element
To add a reference to the document part you need to put a string value, which uniquely identifies the referenced element, to TElXMLReference.URI property, and then put a reference to this element to TElXMLReference.URINode property, which will be used for reference computation.
For example, if the element has Id attribute, it could be referenced with fragment identifier (hash mark #), followed by Id attribute value:
C#:
TElXMLReference Ref = new TElXMLReference();
Ref.URI = "#id-1";
Ref.URINode = SBXMLUtils.Unit.FindElementById(XMLDocument.DocumentElement, "id-1");
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
Delphi:
Ref := TElXMLReference.Create();
Ref.URI := '#id-1';
Ref.URINode := SBXMLUtils.FindElementById(XMLDocument.DocumentElement, 'id-1');
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
Note: If the element being signed encloses the signature itself, then you should use Enveloped Signature, XPath, or XPath Filter 2.0 transform to exclude the signature value from reference computation.