signature Property
[This feature was first implemented for MSXML 5.0.]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.
- Loads an XML signature template file, signature_template.xml, to a DOM object.
- Assigns the
<ds:signature>
element selected from the loaded DOM object to thesigature
property of anMXDigitalSignature50
object. - 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 three languages: JScript, Visual Basic, and C++. The output is the same from each language.
- Resource Files
- JScript Code (signature.js)
- Visual Basic Code (signature.frm)
- C/C++ Code (signature.cpp)
- Output for the signature Example
Applies To
Versioning
MSXML 5.0 and later
To view reference information for Visual Basic, C/C++, or Script only, click the Language Filter button in the upper-left corner of the page.
See Also
IXMLDigitalSignatureEx | sign Method | verify Method