Digital Signature Example

The contents of digital signature parts are defined by the W3C Recommendation “XML-Signature Syntax and Processing” with some package-specific modifications specified in §12.2.4.1.

example:

Digital signature markup for packages is illustrated in this example. For information about namespaces used in this example, see Annex F, “Standard Namespaces and Content Types.”

<Signature Id="SignatureId" xmlns="http://www.w3.org/2000/09/xmldsig#"> 
   <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/
         REC-xml-c14n-20010315"/> 
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/
         xmldsig#dsa-sha1"/> 
      <Reference 
         URI="#idPackageObject" 
         Type="http://www.w3.org/2000/09/xmldsig#Object">
         <Transforms>
            <Transform Algorithm="http://www.w3.org/TR/2001/
               REC-xml-c14n-20010315"/>
         </Transforms>
         <DigestMethod Algorithm="http://www.w3.org/2000/09/
            xmldsig#sha1"/> 
         <DigestValue>...</DigestValue> 
      </Reference>
      <Reference 
         URI="#Application" 
         Type="http://www.w3.org/2000/09/xmldsig#Object">
         <Transforms>
            <Transform Algorithm="http://www.w3.org/TR/2001/
               REC-xml-c14n-20010315"/>
         </Transforms>
         <DigestMethod 
            Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> 
         <DigestValue>...</DigestValue> 
      </Reference>
   </SignedInfo>
   <SignatureValue>...</SignatureValue>
   <KeyInfo>
      <X509Data>
         <X509Certificate>...</X509Certificate>
      </X509Data>
   </KeyInfo>
   <Object Id="idPackageObject" xmlns:pds="http://schemas.openxmlformats.org
     /package/2006/digital-signature">
      <Manifest>
         <Reference URI="/document.xml?ContentType=application/
            vnd.ms-document+xml">
            <Transforms>
               <Transform Algorithm="http://www.w3.org/TR/2001/
                  REC-xml-c14n-20010315"/>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/
               xmldsig#sha1"/> 
            <DigestValue>...</DigestValue> 
         </Reference>
         <Reference 
            URI="/_rels/document.xml.rels?ContentType=application/
               vnd.ms-package.relationships+xml">
            <Transforms>
               <Transform Algorithm="http://schemas.openxmlformats.org/
                  package/2005/06/RelationshipTransform">
                  <pds:RelationshipReference SourceId="B1"/>
                  <pds:RelationshipReference SourceId="A1"/>
                  <pds:RelationshipReference SourceId="A11"/>
                  <pds:RelationshipsGroupReference SourceType=
                     "http://schemas.custom.com/required-resource"/>
               </Transform>
               <Transform Algorithm="http://www.w3.org/TR/2001/
                  REC-xml-c14n-20010315"/>
            </Transforms>
            <DigestMethod Algorithm="http://www.w3.org/2000/09/
               xmldsig#sha1"/> 
            <DigestValue>...</DigestValue> 
         </Reference>
      </Manifest>
      <SignatureProperties>
         <SignatureProperty Id="idSignatureTime" Target="#SignatureId">
            <pds:SignatureTime>
               <pds:Format>YYYY-MM-DDThh:mmTZD</pds:Format>
               <pds:Value>2003-07-16T19:20+01:00</pds:Value>
            </pds:SignatureTime>
         </SignatureProperty> 
      </SignatureProperties>
   </Object>
   <Object Id="Application">...</Object>
</Signature>