Output from sign Method Example

 

[This sample output requires features that were implemented in MSXML 5.0 for Microsoft Office Applications. XML digital signatures are not supported in MXSML 6.0 and later.]

When you build and run the sign code, you should get output similar to the following. The differences are due to the cryptographic key used. Compare the output from the two cases where the fwWriteKeyInfo parameter is set to CERTIFICATES versus set to CERTIFICATES|PURGE.

Sign with fwWriteKeyInfo = NOKEYINFO:  
The specified data was signed successfully.  
Resultant signature:  
<?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#rsa-sha1"/>  
  
    <ds:Reference URI="#obj" Type="http://www.w3.org/2000/09/xmldsig#;Object">  
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>  
      <ds:DigestValue>8UIaiFvvufk+ybGUHcMk5+2Nmh4=</ds:DigestValue>  
    </ds:Reference>  
  </ds:SignedInfo>  
  <ds:SignatureValue>  
    dvMOHXb+YMNV1xBloLAHJXYm4QoXN5ykEUfYRV9ZXySf9bhdDBrq9JtxOGpm0SzjUV66NWJF  
    XW5TgnVvv6L3nA==  
  </ds:SignatureValue>  
  <ds:Object Id="obj" MimeType="text/plain">Hello, World!</ds:Object>  
   <ds:KeyInfo></ds:KeyInfo>  
</ds:Signature>  
  
Sign with fwWriteKeyInfo = KEYVALUE:  
The specified data was signed successfully.  
Resultant signature:  
<?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#rsa-sha1"/>  
  
    <ds:Reference URI="#obj" Type="http://www.w3.org/2000/09/xmldsig#;Object">  
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>  
      <ds:DigestValue>8UIaiFvvufk+ybGUHcMk5+2Nmh4=</ds:DigestValue>  
    </ds:Reference>  
  </ds:SignedInfo>  
  <ds:SignatureValue>  
    dvMOHXb+YMNV1xBloLAHJXYm4QoXN5ykEUfYRV9ZXySf9bhdDBrq9JtxOGpm0SzjUV66NWJF  
    XW5TgnVvv6L3nA==  
  </ds:SignatureValue>  
  <ds:Object Id="obj" MimeType="text/plain">Hello, World!</ds:Object>  
   <ds:KeyInfo>  
  <KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">  
    <RSAKeyValue>  
      <Modulus>  
        4yn1pJsP1PC8Ii3961dqcHm8OGYRxMgGREwq5WyMEvnnQAinRoN6LFk0jKrBMNQqpt/KgeaI  
  
        gkVKs4kfSwJDAw==  
      </Modulus>  
      <Exponent>AQAB</Exponent>  
    </RSAKeyValue>  
  </KeyValue>  
</ds:KeyInfo>  
</ds:Signature>  
  
Sign with fwWriteKeyInfo = CERTIFICATES:  
The specified data was signed successfully.  
Resultant signature:  
<?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#rsa-sha1"/>  
  
    <ds:Reference URI="#obj" Type="http://www.w3.org/2000/09/xmldsig#;Object">  
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>  
      <ds:DigestValue>8UIaiFvvufk+ybGUHcMk5+2Nmh4=</ds:DigestValue>  
    </ds:Reference>  
  </ds:SignedInfo>  
  <ds:SignatureValue>  
    dvMOHXb+YMNV1xBloLAHJXYm4QoXN5ykEUfYRV9ZXySf9bhdDBrq9JtxOGpm0SzjUV66NWJF  
    XW5TgnVvv6L3nA==  
  </ds:SignatureValue>  
  <ds:Object Id="obj" MimeType="text/plain">Hello, World!</ds:Object>  
   <ds:KeyInfo>  
  <KeyValue xmlns="http://www.w3.org/2000/09/xmldsig#">  
    <RSAKeyValue>  
      <Modulus>  
        4yn1pJsP1PC8Ii3961dqcHm8OGYRxMgGREwq5WyMEvnnQAinRoN6LFk0jKrBMNQqpt/KgeaI  
  
        gkVKs4kfSwJDAw==  
      </Modulus>  
      <Exponent>AQAB</Exponent>  
    </RSAKeyValue>  
  </KeyValue>  
  
  <X509Data xmlns="http://www.w3.org/2000/09/xmldsig#">  
    <X509Certificate>  
      MIIFIjCCBIugAwIBAgIKOMW2EAAAAAAAAjANBgkqhkiG9w0BAQUFADCBjTEkMCIGCSqGSIb3  
      DQEJARYVa2RlZGluZ0BtaWNyb3NvZnQuY29tMQswCQYDVQQGEwJVUzELMAkGA1UECBMCd2Ex  
      EDAOBgNVBAcTB3JlZG1vbmQxEjAQBgNVBAoTCW1pY3Jvc29mdDEOMAwGA1UECxMFeG1sdWUx  
      FTATBgNVBAMTDHRlc3RDQW1zRUNTUDAeFw0wMjAzMjIxODUwNDhaFw0wMzAzMjIxOTAwNDha  
      MH4xJDAiBgkqhkiG9w0BCQEWFWtkZWRpbmdAbWljcm9zb2Z0LmNvbTELMAkGA1UEBhMCVVMx  
      CzAJBgNVBAgTAndhMRAwDgYDVQQHEwdyZWRtb25kMQ0wCwYDVQQKEwRtc2Z0MQ4wDAYDVQQL  
      EwV4bWx1ZTELMAkGA1UEAxMCbWUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA4yn1pJsP1PC8  
      Ii3961dqcHm8OGYRxMgGREwq5WyMEvnnQAinRoN6LFk0jKrBMNQqpt/KgeaIgkVKs4kfSwJD  
      AwIDAQABo4IC2TCCAtUwDgYDVR0PAQH/BAQDAgbAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMB0G  
      A1UdDgQWBBRwJHnJ2w26IBlunPoqzJREZEayNjCByQYDVR0jBIHBMIG+gBSAkq3y1qiTJL9F  
      ajLJbP2Wktrqa6GBk6SBkDCBjTEkMCIGCSqGSIb3DQEJARYVa2RlZGluZ0BtaWNyb3NvZnQu  
      Y29tMQswCQYDVQQGEwJVUzELMAkGA1UECBMCd2ExEDAOBgNVBAcTB3JlZG1vbmQxEjAQBgNV  
      BAoTCW1pY3Jvc29mdDEOMAwGA1UECxMFeG1sdWUxFTATBgNVBAMTDHRlc3RDQW1zRUNTUIIQ  
      TvdcKS97h49Pds+/biO1DjCBrwYDVR0fBIGnMIGkME+gTaBLhklodHRwOi8va3VydGRpbmct  
      MDEucmVkbW9uZC5jb3JwLm1pY3Jvc29mdC5jb20vQ2VydEVucm9sbC90ZXN0Q0Ftc0VDU1Au  
      Y3JsMFGgT6BNhktmaWxlOi8vXFxrdXJ0ZGluZy0wMS5yZWRtb25kLmNvcnAubWljcm9zb2Z0  
      LmNvbVxDZXJ0RW5yb2xsXHRlc3RDQW1zRUNTUC5jcmwwggEPBggrBgEFBQcBAQSCAQEwgf4w  
      fAYIKwYBBQUHMAKGcGh0dHA6Ly9rdXJ0ZGluZy0wMS5yZWRtb25kLmNvcnAubWljcm9zb2Z0  
      LmNvbS9DZXJ0RW5yb2xsL2t1cnRkaW5nLTAxLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29t  
      X3Rlc3RDQW1zRUNTUC5jcnQwfgYIKwYBBQUHMAKGcmZpbGU6Ly9cXGt1cnRkaW5nLTAxLnJl  
      ZG1vbmQuY29ycC5taWNyb3NvZnQuY29tXENlcnRFbnJvbGxca3VydGRpbmctMDEucmVkbW9u  
      ZC5jb3JwLm1pY3Jvc29mdC5jb21fdGVzdENBbXNFQ1NQLmNydDANBgkqhkiG9w0BAQUFAAOB  
      gQCNHTpOxFuzk7x834gZz98Yr4OUNJnVtDbUrCEPbruZKGGOBxjSqg4ZEZO6e8GpT7+M5IzT  
      IQSuwlJO5pkOQOOmYI9c4f+gE9pZGnJYnKPVrnhWMv+EWb/BQsX2BdEijOfLKWy+JqPP98YW  
      9xhGzxnqIcldcOwY/8Qw/o+6BaOIYA==  
    </X509Certificate>  
  </X509Data>  
</ds:KeyInfo>  
</ds:Signature>  
  
Sign with fwWriteKeyInfo = CERTIFICATES|PURGE:  
The specified data was signed successfully.  
Resultant signature:  
<?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#rsa-sha1"/>  
  
    <ds:Reference URI="#obj" Type="http://www.w3.org/2000/09/xmldsig#;Object">  
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>  
      <ds:DigestValue>8UIaiFvvufk+ybGUHcMk5+2Nmh4=</ds:DigestValue>  
    </ds:Reference>  
  </ds:SignedInfo>  
  <ds:SignatureValue>  
    dvMOHXb+YMNV1xBloLAHJXYm4QoXN5ykEUfYRV9ZXySf9bhdDBrq9JtxOGpm0SzjUV66NWJF  
    XW5TgnVvv6L3nA==  
  </ds:SignatureValue>  
  <ds:Object Id="obj" MimeType="text/plain">Hello, World!</ds:Object>  
   <ds:KeyInfo>  
  <X509Data xmlns="http://www.w3.org/2000/09/xmldsig#">  
    <X509Certificate>  
      MIIFIjCCBIugAwIBAgIKOMW2EAAAAAAAAjANBgkqhkiG9w0BAQUFADCBjTEkMCIGCSqGSIb3  
      DQEJARYVa2RlZGluZ0BtaWNyb3NvZnQuY29tMQswCQYDVQQGEwJVUzELMAkGA1UECBMCd2Ex  
      EDAOBgNVBAcTB3JlZG1vbmQxEjAQBgNVBAoTCW1pY3Jvc29mdDEOMAwGA1UECxMFeG1sdWUx  
      FTATBgNVBAMTDHRlc3RDQW1zRUNTUDAeFw0wMjAzMjIxODUwNDhaFw0wMzAzMjIxOTAwNDha  
      MH4xJDAiBgkqhkiG9w0BCQEWFWtkZWRpbmdAbWljcm9zb2Z0LmNvbTELMAkGA1UEBhMCVVMx  
      CzAJBgNVBAgTAndhMRAwDgYDVQQHEwdyZWRtb25kMQ0wCwYDVQQKEwRtc2Z0MQ4wDAYDVQQL  
      EwV4bWx1ZTELMAkGA1UEAxMCbWUwXDANBgkqhkiG9w0BAQEFAANLADBIAkEA4yn1pJsP1PC8  
      Ii3961dqcHm8OGYRxMgGREwq5WyMEvnnQAinRoN6LFk0jKrBMNQqpt/KgeaIgkVKs4kfSwJD  
      AwIDAQABo4IC2TCCAtUwDgYDVR0PAQH/BAQDAgbAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMB0G  
      A1UdDgQWBBRwJHnJ2w26IBlunPoqzJREZEayNjCByQYDVR0jBIHBMIG+gBSAkq3y1qiTJL9F  
      ajLJbP2Wktrqa6GBk6SBkDCBjTEkMCIGCSqGSIb3DQEJARYVa2RlZGluZ0BtaWNyb3NvZnQu  
      Y29tMQswCQYDVQQGEwJVUzELMAkGA1UECBMCd2ExEDAOBgNVBAcTB3JlZG1vbmQxEjAQBgNV  
      BAoTCW1pY3Jvc29mdDEOMAwGA1UECxMFeG1sdWUxFTATBgNVBAMTDHRlc3RDQW1zRUNTUIIQ  
      TvdcKS97h49Pds+/biO1DjCBrwYDVR0fBIGnMIGkME+gTaBLhklodHRwOi8va3VydGRpbmct  
      MDEucmVkbW9uZC5jb3JwLm1pY3Jvc29mdC5jb20vQ2VydEVucm9sbC90ZXN0Q0Ftc0VDU1Au  
      Y3JsMFGgT6BNhktmaWxlOi8vXFxrdXJ0ZGluZy0wMS5yZWRtb25kLmNvcnAubWljcm9zb2Z0  
      LmNvbVxDZXJ0RW5yb2xsXHRlc3RDQW1zRUNTUC5jcmwwggEPBggrBgEFBQcBAQSCAQEwgf4w  
      fAYIKwYBBQUHMAKGcGh0dHA6Ly9rdXJ0ZGluZy0wMS5yZWRtb25kLmNvcnAubWljcm9zb2Z0  
      LmNvbS9DZXJ0RW5yb2xsL2t1cnRkaW5nLTAxLnJlZG1vbmQuY29ycC5taWNyb3NvZnQuY29t  
      X3Rlc3RDQW1zRUNTUC5jcnQwfgYIKwYBBQUHMAKGcmZpbGU6Ly9cXGt1cnRkaW5nLTAxLnJl  
      ZG1vbmQuY29ycC5taWNyb3NvZnQuY29tXENlcnRFbnJvbGxca3VydGRpbmctMDEucmVkbW9u  
      ZC5jb3JwLm1pY3Jvc29mdC5jb21fdGVzdENBbXNFQ1NQLmNydDANBgkqhkiG9w0BAQUFAAOB  
      gQCNHTpOxFuzk7x834gZz98Yr4OUNJnVtDbUrCEPbruZKGGOBxjSqg4ZEZO6e8GpT7+M5IzT  
      IQSuwlJO5pkOQOOmYI9c4f+gE9pZGnJYnKPVrnhWMv+EWb/BQsX2BdEijOfLKWy+JqPP98YW  
      9xhGzxnqIcldcOwY/8Qw/o+6BaOIYA==  
    </X509Certificate>  
  </X509Data>  
</ds:KeyInfo>  
</ds:Signature>  
  
Sign with fwWriteKeyInfo = PURGE:  
The specified data was signed successfully.  
Resultant signature:  
<?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#rsa-sha1"/>  
  
    <ds:Reference URI="#obj" Type="http://www.w3.org/2000/09/xmldsig#;Object">  
      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>  
      <ds:DigestValue>8UIaiFvvufk+ybGUHcMk5+2Nmh4=</ds:DigestValue>  
    </ds:Reference>  
  </ds:SignedInfo>  
  <ds:SignatureValue>  
    dvMOHXb+YMNV1xBloLAHJXYm4QoXN5ykEUfYRV9ZXySf9bhdDBrq9JtxOGpm0SzjUV66NWJF  
    XW5TgnVvv6L3nA==  
  </ds:SignatureValue>  
  <ds:Object Id="obj" MimeType="text/plain">Hello, World!</ds:Object>  
   <ds:KeyInfo></ds:KeyInfo>  
</ds:Signature>