graphic with four colored squares
Cover page images (keys)

XML Encryption and Signature

23 Aug 2005

Ivan Herman, W3C

XML Encryption and Signature

Slides of the presentation …

(If your browser has proper implementation of the object element of XHTML (e.g., Mozilla’s Firefox) and you have a SVG plugin installed, you might want to use the same slideset using SVG. Some of the images may have added interaction and they also rescale better…)

Table of Contents:

  1. XML Cryptography Modules
  2. Common characteristics
  3. XML Signatures
  4. Sign and Check Signature
  5. Signature in XML
  6. Adding Key Information
  7. Transformations Possibilities
  8. Example using XPath
  9. Adding Information to Signature
  10. Encryption
  11. Encryption and Decryption
  12. Encryption in XML
  13. Encrypting the (Sub)tree
  14. Encrypting Character Content
  15. Encryption Data Stored Elsewhere
  16. Transforms in Encryptions
  17. Key management
  18. Key management (cont)
  19. X-KISS + X-KRSS = XKMS
  20. Some X-KISS Usage Scenarios

XML Cryptography Modules

Common characteristics

XML Signatures

Sign and Check Signature

XML Signature Processes...

Signature in XML

Shows how the logical signature process diagram maps into XML

Adding Key Information

<Signature Id="..."> 
  <SignedInfo>
    ... 
  </SignedInfo> 
  <SignatureValue>MC0CFFrVLtRlk=...</SignatureValue>
  <KeyInfo>
    <KeyValue>
      <PGPData>
        <PGPKeyID>FGHJ</PGPKeyID>
        <PGPKeyPacket>BKJHasdfJKN</PGPKeyPacket>
      </PGPData> 
    </KeyValue> 
  </KeyInfo>
</Signature>

The example is for PGP; there are variants for DSA, RSA, …

Transformations Possibilities

Example using XPath

For example, an enveloped signature on the rest of the document:

  <Document id="Full">
    <Signature xmlns:dsig="...">
      <SignedInfo>
        <Reference Id="#Full">
          <Transform Algorithm="..">
            <XPath>not(ancestor-or-self::dsig:Signature)</XPath>
          </Transform>
        </Reference>
        ...
      </SignedInfo>
    </Signature>
    ...
  </Document>

Adding Information to Signature

<Signature Id="MySignature" ...>
  <SignedInfo> 
    <Reference URI="something">...</Reference>
    <Reference URI="#MyTimeStamp" 
       Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties">
    ...
    </Reference> 
  </SignedInfo>
  ...  
  <Object> 
    <SignatureProperties>
     <SignatureProperty Id="MyTimeStamp" Target="#MySignature">
       <t:timestamp xmlns:t="http://www.ietf.org/rfcXXXX.txt">
         <t:date>19990908</t:date> 
         <t:time>14:34:34:34</t:time>
       </t:timestamp>
     </SignatureProperty>
   </SignatureProperties>
  </Object>
</Signature>

Encryption

Encryption and Decryption

XML Signature Processes...

Encryption in XML

XML Signature Processes...

Encrypting the (Sub)tree

 <PaymentInfo>
    <Name>Ivan Herman</Name>
    <CreditCard>
       <Name>VISA</Name>
       <Number>4567 8901 2345 5678</Number>
       <Expiration>01 01</Expiration>
    </CreditCard>
 </PaymentInfo>

Can be encrypted as follows:

 <PaymentInfo>
    <Name>Ivan Herman</Name>
    <EncryptedData Type="http://www.w3.org/…/xmlenc#Element"
        xmnls="http://www.w3.org/2001/04/xmlenc#">
       <CipherData><CipherValue>QEK^SD27</CipherValue></CipherData>
    </EncryptedData>
 </PaymentInfo>

An eavesdropper doesn’t knows about any Credit Card!

Encrypting Character Content

 <PaymentInfo>
    <Name>Ivan Herman</Name>
    <CreditCard>
       <Name>VISA</Name>
       <Number>4567 8901 2345 5678</Number>
       <Expiration>01 01</Expiration>
    </CreditCard>
 </PaymentInfo>

Can be encrypted as:

 <PaymentInfo>
    <Name>Ivan Herman</Name>
    <CreditCard>
       <Name>VISA</Name>
       <Number>
          <EncryptedData Type="http://www.w3.org/…/xmlenc#Content"
              xmnls="http://www.w3.org/2001/04/xmlenc#">
             <CipherData>
                <CipherValue>QEK^SD27</CipherValue>
             </CipherData>
          </EncryptedData>
       </Number>
       <Expiration>01 01</Expiration>
    </CreditCard>
 </PaymentInfo>

Encryption Data Stored Elsewhere

<CipherData>
    <CipherValue>QEK^SD27</CipherValue>
 </CipherData>

can be replaced by:

 <CipherData>
    <CipherReference URI="....">
       <Transforms>
          ...
       </Transforms>
   </CipherReference>
 </CipherData>

Transforms in Encryptions

   <CipherData>
      <CipherReference URI="http://.../Cyphers.xml">
         <Transforms>
            <ds:Transform xmlns:r="…">
               <ds:XPath>self::text()[//r:CypherValue[3]]</ds:XPath>
            </ds:Transform>
            ...
         </Transforms>
     </CipherReference>
   </CipherData>

Key management

Key management (cont)

X-KISS + X-KRSS = XKMS

Some X-KISS Usage Scenarios