EldoS | Feel safer!

Software components for data protection, secure storage and transfer

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:

ElXMLSigner.UpdateReferencesDigest();
...
// 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.References.Add(Ref);
...
ElXMLSigner.Sign(); // this method generates Signature structure
...
ElXMLSigner.Signature.KeyInfo.ID = "KeyInfo1"; // set an Id for the KeyInfo element

Return to the list

|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!