It is important that a person who reads the signed document is able to understand its meaning. Therefore, it is not enough to sign plain XML data, as this usually can not be interpreted by an average user. You also need to provide some sort of human readable interpretation of data.
To create a signed document that contains the data and visualisation, follow these steps:
' The following certificate will be used for signing
signingCert="CERT_FIND_SUBJECT_STR=CREA_TESTUSER_1"
' Create a CreaDoc object
Set cd = CreateObject("CreaSignClientIE.CreaDoc")
' Add some data - load it from a file first
set cd.Data = CreateObject("CreaSignClientIE.XmlData")
set data=CreateObject("CreaSignClientIE.Data")
data.Load "files/invoice.xml"
cd.Data.SetEmbeddedData data,"","text/xml"
' Add a visualisation - load it from a file first
set vis=CreateObject("CreaSignClientIE.Data")
vis.Load "files/invoice.gif"
' Now add a base64 encoded visualisation
cd.Visualisations.Add "","image/gif","base64","",vis,"someImage.gif"
' Create a signature
cd.CreateSignature signingCert,0
' Save the result to a file
saveTo="files/signedDataAndVis.xml"
if WScript.Arguments.Count>0 then saveTo=WScript.Arguments(0)
cd.XmlNode.ownerDocument
WScript.Echo "Result saved to: " & saveTo
(c) Crea 2002-2006