Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - Digital Signatures

Resource: signature_template.rsa.xml and test.xml

This example uses two resource files: a signature template and an XML file. The XML file will be read by a SAX reader and fed as a SAX stream into the signature object, via a SAX proxy object.

Signature_template.rsa.xml

<?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="#objData">
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
      <ds:DigestValue/>
    </ds:Reference>
  </ds:SignedInfo>
  <ds:SignatureValue />
  <ds:Object Id="objData">Hello, world!</ds:Object>
</ds:Signature>

test.xml

<?xml version="1.0" encoding="ISO-8859-1"?>
<root peanut="bar.com">
  <PARTS>
    <PART MAKER="bar.com">
        <PARTNO>12345</PARTNO>
        <DESCRIPTION>VIP - Very Important Part</DESCRIPTION>
    </PART>
    <PART>
        <PARTNO>5678</PARTNO>
        <DESCRIPTION>LIP - Less Important Part</DESCRIPTION>
    </PART>
  </PARTS>
</root>