CreaSign

Create an Enveloping Signature

In an enveloping signature, the <ds:Signature> element contains signed or to-be-signed data as a child of the <ds:Object> element. To create an enveloping signature, follow these steps:

  1. Create a new XmlSignature object.
  2. Add a <ds:Object> node to the signature object.
  3. Add the data to the object.
  4. Call the CreateSignature method.
' The following certificate will be used for signing
signingCert="CERT_FIND_SUBJECT_STR=CREA_TESTUSER_1"

' Create an xml signature object
Set cs = CreateObject("CreaSignClientIE.XmlSignature")

' Add an object with some data
cs.AddObject "myObject","This text will be signed" 

' Add reference to the object cs.AddReference "","#myObject", "" ' Create a signature cs.CreateSignature signingCert,0 ' Save the result to a file saveTo="files/signedEnveloping.xml" if WScript.Arguments.Count>0 then saveTo=WScript.Arguments(0) cs.XmlNode.ownerDocument.save saveTo

WScript.Echo "Result saved to: " & saveTo


Send comments on this topic.

(c) CREA 2002-2007 www.creasign.si