SecureBlackbox 16: How to reference elements inside the Signature element

Note: This article applies only to SecureBlackbox Legacy. For future development please consider using the latest version.

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

For example, signing the KeyInfo element:

ElXMLSigner.UpdateReferencesDigest(); ... // add the reference after UpdateReferencesDigest call, otherwise an exception will be thrown TElXMLReference Ref = new TElXMLReference(); Ref.URI = "#KeyInfo1"; // Ref.URINode = // skip this. The node will be located and the 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 the Signature element. ElXMLSigner.References.Add(Ref); ... ElXMLSigner.Sign(); // this method generates the Signature structure ... ElXMLSigner.Signature.KeyInfo.ID = "KeyInfo1"; // set an Id for the KeyInfo element

We appreciate your feedback.  If you have any questions, comments, or suggestions about this article please contact our support team at kb@nsoftware.com.