How to reference elements inside the Signature element

Create an instance of TElXMLReference class, but don’t fill URIData and URINode properties. Add it to the References after the call to UpdateReferencesDigest(). Assign URI and ID for the Reference and referenced element. That’s all.

For example, signing the KeyInfo element:



// add the reference after UpdateReferencesDigest call, otherwise exception will be thrown
TElXMLReference Ref = new TElXMLReference();
Ref.URI = "#KeyInfo1";

// Ref.URINode = // skip this. The node will be located and digest value will be recalculated in the Save method after it
is generated and added to the XML document. It is done automatically for all elements under Signature element.



ElXMLSigner.Sign(); // this method generates Signature structure


ElXMLSigner.Signature.KeyInfo.ID = "KeyInfo1"; // set an Id for the KeyInfo element

Ready to get started?

Learn more about SecureBlackbox or download a free trial.

Download Now