signature Property

 

[This feature was implemented for MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]

This is a read/write property for getting or setting a signature to be processed.

The signature property takes an IXMDOMNode object as its value. The DOM object holds a signature template or signed signature document as represented by a <ds:Signature> element that belongs to the http://www.w3.org/2000/09/xmldsig# namespace. The ds alias is used for this namespace throughout this document.

JScript Syntax

var objSigNode = objXMLDigitalSignature.signature;  
objXMLDigitalSignature.signature = objSigNode;  

Visual Basic Syntax

Set objSigNode = objXMLDigitalSignature.signature  
Set objXMLDigitalSignature.signature = objSigNode  

C/C++ Syntax Using Smart Pointers

IXMLDOMNodePtr objSigNode = objXMLDigitalSignature.signature;  
objXMLDigitalSignature.signature = objSigNode;  

C/C++ Syntax

HRESULT get_signature (IXMLDOMNode** objSigNode);  
HRESULT putref_signature (IXMLDOMNode* objSigNode);  

Parameters

objSigNode
An XML DOM node corresponding to the <ds:Signature> element of the XML document.

Return Values

S_OK
Getting or setting signature succeeded.

E_FAIL
Getting or setting signature failed.

Remarks

Setting this property resets all the data previously assigned using the setReferenceData method, but does not have any side effects on cryptographic keys already created by the selected key creation method or by the createSAXProxy method.

After this property is set, you must not modify the XML data referenced to or embedded in the corresponding <ds:Signature> element until the data has been signed or verified. Otherwise, the outcome is not defined.

For both signing and verification, the signature property must meet certain requirements. The following topics provide tables that describe these requirements.

Example

This example illustrates how to get and set the signature property. The sample code performs the following tasks.

  1. Loads an XML signature template file, signature_template.xml, to a DOM object.

  2. Assigns the <ds:signature> element selected from the loaded DOM object to the sigature property of an MXDigitalSignature50 object.

  3. Signs the data referenced in the signature template. This data is the text "Hello, World!" contained in a <ds:Object Id="objData"> element.

The example uses a resource file, signature_template.xml. We've provided source files for the sample in two languages: Visual Basic and C++. The output is the same from each language.

Applies to

IXMLDigitalSignature

Versioning

MSXML 5.0 for Microsoft Office Applications and later

See Also

IXMLDigitalSignatureEx
sign Method
verify Method