Discuss this help topic in SecureBlackbox Forum

XML: Add reference to external file

To add a reference to the external resource (file) you need to put a string value, which uniquely identifies the referenced resource, to TElXMLReference.URI property (it can have custom format or be the URL of the data), and then use TElXMLReference.URIStream property to provide the actual data. Optionally you can use TElXMLReference.URIStreamOffset and TElXMLReference.URIStreamCount properties to specify the part of the data in the stream, that must be processed.

Note, that the SecureBlackbox doesn't automatically download the resource specified in URI property. If you need to download it, please use TElHTTPSClient for HTTP(S) resources or other included transport components.

C#:


TElXMLReference Ref = new TElXMLReference();

FileStream stream = new FileStream(...);
Ref.URI = "file://sample.bin";
Ref.URIStream = stream;
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
stream.Close();
Delphi:

FileStream := TElFileStream.Create('sample.bin', fmOpenRead);
Ref := TElXMLReference.Create();
Ref.URI := 'file://sample.bin';
Ref.URIStream := FileStream;
Signer.References.Add(Ref); // add the reference to TElXMLSigner object
...
// when signing is finished we need to clear file stream object
FileStream.Free();

How To articles about XML signing (XMLDSig and XAdES)

Discuss this help topic in SecureBlackbox Forum