Resource: signature.dsa.xml

 

[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 example uses a signature file, which contains internally referenced text data that has been signed. This file has the following characteristics:

  • The signed text data is a string, "Hello, World!". This string is held as the content of a <ds:Object Id="HelloWorld"> element.

  • The signature method used is http://www.w3.org/2000/09/xmldsig\#dsa-sha1.

  • The key information is given in an <ds:KeyInfo> element, which will be retrieved by the createKeyFromNode method before the signature is verified.

Signature File (signature.dsa.xml)

<?xml version="1.0"?>
<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#dsa-sha1"/>
    <ds:Reference URI="#HelloWorld" Type=
                 "http://www.w3.org/2000/09/xmldsig#;Object">
      <ds:DigestMethod Algorithm=
                 "http://www.w3.org/2000/09/xmldsig#sha1"/>
      <ds:DigestValue>BQKNAJjTw98dp7Uvw4oAmJU8LSU=</ds:DigestValue>
    </ds:Reference>
  </ds:SignedInfo>
  <ds:SignatureValue>SxbzV35amsuf4mtKgMHps0Fdm6U98
          fF6vF81CUpmXVd9ULLXeXH5Ew==
  </ds:SignatureValue>
  <ds:Object Id="HelloWorld" MimeType="text/plain">Hello, World!</ds:Object>
  <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
    <KeyValue>
      <DSAKeyValue>
        <P>wLHwVoUYz2txHkKnKUQoN/u1ftCXqw61edb/
           pC1WPv6EV6FBXl0E8vGHHjfzm2ZLm4Gu/j8v
           sNXYDTi8zGFXmhqOO5Me2sUpOgbUzZpeZ7ZN
           0YMaFXWzgeKDg/gb9DrK/USj4BGueB3HAzmF
           QT8Qu6SM/YBGZKph7JTddYXbodU=
        </P>
        <Q>nkI1onvHNR4tMSvPMc0rhOBHgME=</Q>
        <G>QD6OUOIeg64nvtvVbp1Rblw+ehmpPCIjG1Aq+
           w67C3PHqRfor9fBeKf6J6Ap1i1QsBBSau6SOO
           LLkHvR2jwsgyAdYMYSuUYoTJZ66pGkMy2U712
           1/oKrlkF8MrEZh3esA2JfvF+h396K2Wa/Nvl9
           s8xTcDhxLepcndAewKhz5nY=
        </G>
        <Y>rv1GX+/qY99y0xGrdaJANlm7YjJ5/j7famSv6
           cHVwtY79WXFFBDlFGNVOKGiYGsRG6BXX00G
           4yHLOndIsywsMYDejB+TuUfvkGcEPGDZErtPy1F
           /xgJ48jhPttwrv8Wy3k279+ufB27NpBC/
           vW2Rxf3bh22L7V0KNa0VuTwie2g=
        </Y>
        <PgenCounter>AAAAZQ==</PgenCounter>
        <Seed>soBYpnG6Yy/B4Or2y1zqB2mZr/U=</Seed>
      </DSAKeyValue>
    </KeyValue>
  </KeyInfo>
</ds:Signature>