Enveloping Signatures
[This sample code uses features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]
The <ds:Signature>
element contains the signed or to-be-signed data as the content of a <ds:Object>
element. For example, the following signature template is for an enveloping signature in which a text object containing the plain text "Hello, World!" is embedded.
<?xml version="1.0" encoding="UTF-8"?>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo>
<ds:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
<ds:Reference URI="#obj">
<ds:DigestMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
<ds:DigestValue/>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue/>
<ds:Object Id="obj">Hello, World!</ds:Object>
</ds:Signature>
Notice that the reference of the text object uses the value of the Id attribute ("obj").