![]()
Author: Joseph Reagle
Audience: WWW2002
Question: The status/design of XML Signatures, Encryption, and Key Management
References:
Hash (fingerprint, digest): evenly and randomly maps variable length data into a smaller fixed size such that it's "one-way" (hard to find a data object for a given hash result) and "collision-free" (hard to find two data objects with the same hash result).
Secret Key Cryptography (symmetric): the key used for processing is kept as a secret between the parties.
Public Key Cryptography (asymmetric): a private/public key pair (inverse of each other) are used to sign (via the private key) and encrypt (via the public key).
Signature: a private key is applied to some data (or its hash)
Encryption: One often uses a public key (easy to obtain) to send a symmetric key (efficient) for a "session" of communication.
Key Management: How to obtain the real key of the person with whom you want to communicate. This typically involves chains of signatures on a key that must be checked/validated.
This protocol is faulty, but it demonstrates the use of selective signing and encryption.
<Signature>
<SignedInfo>
<CanonicalizationMethod/>?
<SignatureMethod/>
<Reference (URI=)? >
<Transforms/>?
<DigestMethod/>
<DigestValue/>
</Reference>+
</SignedInfo>
<SignatureValue/>
<KeyInfo/>?
<Object/>*
</Signature>
<Reference URI="order.xml">
<Transforms>
<Transform Algorithm="user-template.xslt"/>
<Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<Transforms>
<DigestMethod Algorithm="..."/>
<DigestValue>a234cb</DigestValue>
</Reference>
[s04] <SignatureMethod Algorithm="http://www.w3.org/2000/02/xmldsig#dsa"/>
| Type | Algorithm | Requirements | Algorithm URI |
| Digest | SHA1 | REQUIRED | http://www.w3.org/2000/09/xmldsig#sha1 |
| Encoding | Base64 | REQUIRED | http://www.w3.org/2000/09/xmldsig#base64 |
| MAC | HMAC-SHA1 | REQUIRED | http://www.w3.org/2000/09/xmldsig#hmac-sha1 |
| Signature | DSAwithSHA1 (DSS) |
REQUIRED | http://www.w3.org/2000/09/xmldsig#dsa |
| Canonicalization | Canonical XML | REQUIRED | http://www.w3.org/TR/2000/WD-xml-c14n-20000907 |
| Others | XPath | RECOMMENDED | http://www.w3.org/TR/1999/REC-xpath-19991116 |
In the encrypted version of an XML instance, the <EncryptedData> element will appear in place of an encrypted element or its content.
| Before: | After Rodents are encrypted |
<Animals> <Cat/> <Rodents> <Beaver/> <Mouse/> </Rodents> <Dog/> <Animals> |
<Animals> <Cat/> <EncryptedData xmlns=""> <CipherData>M3MXCV... </CipherData> </EncryptedData> <Dog/> <Animals> |
<EncryptedData Id="" Type=""> <EncryptionMethod/>? <ds:KeyInfo>? <enc:EncryptedKey/>? ... </ds:KeyInfo>? <CipherData URI="">iamscrambled</CipherData> </EncryptedData>
EncryptedKey is just like EncryptedData, but always carries a (session) key.
| Type | Algorithm | Requirements |
| Block Encryption | AES/3DES | REQUIRED |
| Key Transport | AES-RSA-OEAP 3DES-RSA-v1.5 |
REQUIRED |
| MAC | AES/3DES with SHA1 | OPTIONAL |
| Signature | XML Signature | OPTIONAL |
| (Exclusive) Canonicalization | Canonical XML | OPTIONAL |
| Compression et al | n/a |
Neither XML Signature nor Encryption specify how to obtain trustworhty keys.
There's a body of existing (non-XML) standards and infrastucture to satisfy this requirement.
XKMS provides a Web/XML based interface to existing infrastructure for XML based applications.
<?xml version="1.0" encoding="utf-8"?>
<LocateRequest xmlns:ds="http://www.w3.org/2000/09/xmldsig#"
xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"
Service="http://test.xmltrustcenter.org/XKMS"
xmlns="http://www.w3.org/2002/03/xkms#">
<RespondWith>KeyValue</RespondWith>
<QueryKeyBinding>
<KeyUsage>Encryption</KeyUsage>
<UseKeyWith Application="urn:ietf:rfc:2633" Identifier="bob@bobcorp.test" />
</QueryKeyBinding>
</LocateRequest>