IETF Logo W3C Logo

XML-Signature Core Syntax

W3C Working Draft 1999-September-22

This Public Draft version:
Previous Working Group version:
... (990922)

Copyright  1999 The Internet Society & W3C (MIT, INRIA, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply.

W3C Status of this Document

This document includes updates from the 990902 draft. The goal is to get some version of this document out as an ietf-draft and W3C technical report as soon as possible.

; Reagle's updates include :

  1. changed some of the tokens to shorter or more expressive names.
  2. changed the case of the token names (CamelCase)
  3. documented open issues and to'do in the body of the text.
  4. Use BNF or DTD syntax to describe structure, not truncated examples. I've placed DTD syntax throughout the document, not really necessary but easier to work on as you make conceptual tweaks.
  5. Lots of editing on improving setence structure, grammar, and typos.
  6. Removed type as token in the algAlg andc14nAlgl attribute, called it algorithm instead.
  7. Removed redundant descriptions in section two (or collapsed what there is into bullet points.)


This document lists the core signature syntax. 

Table of Contents


1.0 Introduction

This document describes the proposed syntax and processing rules for the XML Digital Signature specification. This specification provides a mechanism for applying digital signatures to XML documents and other Internet resources.

The structure allows for both embedded and detached signatures. An embedded signature can include the signature within the signed object or embed the signed object within the signature. A detached signature allows the signature to be independent of the object. The processing structure allows for switching between embedded and detached signatures without invalidating the signature.

In addition to the basic signature document type, this document also defines other useful types including a methods of referencing multiple resources and key management and algorithm definitions.

Editorial Comment: Presently most of this work is unspecified. The working group needs to define things like manifest and algorithm definitions more explicitly.

The namespace URI that must be used by experimental implementations of this dated specification is:


1.1 Editorial Conventions

This document uses the following abbreviations for long words. (The acryonyms are generated by wrapping the word_length-2 in the first and last letter):

This document also includes editorial comments (highlighted in a light tan wit a blue border) that point out open issues the WG has not yet closed. Readers unfamiliar with DTD syntax may wish to refer to Ron Bourret's "Declaring Elements and Attributes in an XML DTD."

1.2 Design Philosophy

The design philosophy and requirements of this specification are addressed in the XML-Signature Requirements document [XML-Signature-RD]. However, a few of the key philosphy axioms are repeated. This specification endeavors to rely upon the syntax -- and the underlying data model -- to represent the functionality and structure of a signature where ever possible. One way this is manifested is by the use URIs to define the relationships between a signature and its context (its constituent parts, the objects it signs, the algorithms it employs, etc.). This philosophy is best captured by the idea that of "if you make statements about statements, signature is merely one type of statement " This allows us to clearly (and perhaps formally) define the meaning of a signature and how that meaning interacts with the semantics of the content it signs. One way this is manifested is in the choice of the WG to avoid things like:

<attribute type="CDATA" and value="CDATA"/>

Instead, if applications need to associate external semantics for key exchange or trust processing they must introduce a set of qualified namespace [XML-namespace] application elements with clearly defined semantics, or they must make a statement about an existing resource within some data model.

Editorial Comment: The syntax defined in this document is not yet associated with a directed labeled graph data model. The WG has decided not to use the RDF serialization syntax. WG members have advocated usings a "striped" XML syntax whereby the structure and nesting of the XML can be read as {resource, predicate, value} tuples. Unfortunatley, this can result in superflous syntax. The WG is investigating the use of a schema definition to bind a formally specified data model to an XML syntax that is intuitive and compact.

2.0 Signature Structure

The general structure of an XML signature includes the following elements:

<!ELEMENT Signature (SignedInfo, SignatureValue, KeyInfo?, Object*)>
<!ATTLIST SignedInfo
          Id     ID       #IMPLIED>

3.0 SignatureValue

SignatureValue is an empty-element tag [XML] that contains the actual value of the digital signature. The ability to define a SignatureAlg and SignatureValue pair which includes multiple distinct signatures is explicitly permitted (e.g. "rsawithsha-1 and ecdsawithsha-1").

<!ELEMENT SignatureValue EMPTY)>
<!-- base64 encoded signature value -->
<!ATTLIST SignatureValue
          Value          CDATA   #REQUIRED >

; Why is the content captured in an attribute instead of the content of the element? Should make this a URN. Should we define our own URN scheme? - JR

4.0 SignedInfo

The structure of SignedInfo includes a canonicalizatin (c14n) algorithm, a signature algorithm, and one or more references to objects. The SignedInfo element may contain an optional ID attribute that will allow it to be referenced by other signatures and objects.

<!ELEMENT SignedInfo(c14nAlg?, SignatureAlg, ObjectReference+ )>   
<!ATTLIST SignedInfo
          Id     ID       #IMPLIED>

SignedInfo does not include explicit signature attributes (in the traditional cryptographic sense). If an application needs to associate semantics (such as signing time, signing device, etc.) with the signature, it may add an additional Object that includes those semantics and reference that Object via an ObjectReference.

4.1 c14nAlg (Canonicalization)

c14nAlg is an optional element which specifies the canonicalization (c14n) algorithm applied to the SignedInfo element prior to performing signature calculations. This element uses the general structure here for algorithms in which an URI is included as an attribute naming the algorithm and optional contents of the element contain any parameter, value, or other information defined by the algorithm name. Possible options may include a null algorithm (no changes), a simple identity algorithm (CRLF and charset normalization), or more extensive operations such as [XML-C14N].

<!ELEMENT c14nAlg ANY>
<!ATTLIST c14nAlg
          Algorithm    CDATA    "null">
     <!-- Where CDATA conforms to the
          productions specified by [URI] -->

4.2 SignatureAlg

SignatureAlg is a required element which specifies the algorithm used for signature generation and validation. This algorithm ID identifies all cryptographic functions involved in the signature operation (e.g. hashing, public key algorithms, MACs, etc.). This element uses the general structure here for algorithms in which a URI is included as an attribute naming the algorithm and optional contents of the element contain any parameter, value, or other information defined by the algorithm name. While there is a single identifier, that identifier may specify a format containing multiple distinct signature values.

<!ELEMENT SignatureAlg ANY>
<!ATTLIST SignatureAlg
          Algorithm    CDATA    #REQUIRED >
     <!-- Where CDATA conforms to the
          productions specified by [URI] -->

4.3 ObjectReference

ObjectReference  is an element that may occur one or more times. It includes a URI, the type of the object, specified transformations, a digest algorith and digest value. Note, it is the content yielded after the URI is dereferenced, decoded, and transformed that the digest algorithm is applied to.

<!ELEMENT ObjectReference (Location?, Type?, Transformations?, DigestAlg, DigestValue) >

; Why is location optional? -JR

4.3.1 Location

Location identifies where to find the Object . This element may be omitted if the location is implicit in the application.

<!ELEMENT Location EMPTY >
<!ATTLIST Location
          HREF           CDATA   #IMPLIED >
     <!-- Where CDATA conforms to the
          productions specified by [URI] -->

; I would prefer this wasn't implicit. -JR

4.3.2 Type

Type is an optional element which contains information about the type of object being signed (e.g. manifest, package, document, SignedInfo, PDF file). This may be represented as a name (e.g. MIME type), namespace qualified element name, or URI.

          Type           CDATA   #REQUIRED >

; Not sure about the purpose behind this, and needs to be further specified. -JR

4.3.3 Transformations

Transformations is an optional element that contains one or more operations to be performed on the Object prior to signature calculation. Examples of Transformations include encoding, c14n, XPointer, XSL, filtering, encoding, etc. (These operations are different from those specified in the signature; those are are applied over signedinfo.)

Each element within Transformations uses the general structure here for algorithms in which a URI is included as a value specifying the algorithm and optional contents of the element contain any parameter, value, or other information defined by the algorithm name. If the Transformations element is omitted, the only operation performed is the default object c14n algorithm (null or identity).

<!ELEMENT Transformations (ANY, c14nAlg?, Encoding?) >

<!ATTLIST c14nAlg
          Algorithm    CDATA    #REQUIRED >

<!ELEMENT Encoding EMPTY >
<!ATTLIST Encoding
          Algorithm    CDATA    #REQUIRED >

     <!-- Where CDATA conforms to the
productions specified by [URI] -->

; I think this is one of the very few places where we should definine an algorithm attribute and let others fill it in. Should allow transformations beyond c14nAl, Encoding and Exclusion. - JR

Implementation Comment: When transformations are applied the signer is not signing the native (original) document but the resulting (transformed) document that is not captured explicitly in the signature syntax. Where transformation processes are well known and widely implemented an application might include native content and specify transformations by reference. Otherwise, an application may perform transformations on the content itself and use the resulting content within the signature.

Security Comment: Applications are recommended to ensure signers understand the actual resulting content that is being signed after transformations are applied. Users should not be tricked into signing a native content that is transformed into something that the user would not have signed otherwise.

4.3.4 DigestAlg

DigestAlg is a required element which identifies the digest algorithm to be applied to the signed object. This element uses the general structure here for algorithms in which a URI is included as an attribute naming the algorithm and optional contents of the element contain any parameter, value, or other information defined by the algorithm name.

<!ELEMENT DigestAlg ANY>
<!ATTLIST DigestAlg
           Algorithm     CDATA   #REQUIRED >
     <!-- Where CDATA conforms to the
          productions specified by [URI] -->

4.3.5 digestvalue

digestvalue is a required empty-element tag which contains the base64 encoded value of the digest.

<!ELEMENT DigestValue EMPTY>
<!-- base64 encoded digest value -->
<!ATTLIST DigestValue
          value          CDATA   #REQUIRED >

5.0 Object

. When present this element may contain any item and specifies the encoding. It is important to note that the content of the Object itself is not part of the hash algorithm over the signature.

<!ATTLIST Object
          Id    CDATA    #IMPLIED
          Type  CDATA    #IMPLIED
          Encoding       CDATA   #IMPLIED >
     <!-- Where type and encoding CDATA conforms to the
          productions specified by [URI] -->

; Define what is meant by type. -JR

Object is an optional element which may occur one or more times.  The purpose of Object element is to wrap elements defined by any XML application as introduced through the namespace [XML-namespace] facility. For instance, the following Object references a timestamp document that is defined by some other specification.

  <Object id="timestamp1" type="signatureattributes" > ;who defined this type?
    <timestamp xmlsn="">

The Object's ID is referenced from the ObjectReference in SignedInfo. This element is used for embedded signatures where the object being signed is to be included in the signature document. The Object element may include optional type, ID, and encoding attributes. Note there is nothing that prevents these other XML applications from referencing and making statements about signatures.

<!ATTLIST Object
           id    CDATA    #IMPLIED
           type  CDATA    #IMPLIED
           encoding       CDATA   #IMPLIED >

6.0 KeyInfo

KeyInfo may contain keys, names, certificates and other public key management information (such as inband key distribution or agreement data or use any other method.) This specification defines a few simple types but  applications may place (embed) their own key identification and exchange semantics within this element through the XML-namespace facility. [XML-namespace]

<!ELEMENT KeyInfo  (ANY | (KeyName | KeyValue |
          SubjectName | RetrievalMethod | x509Data |
          PGPData | MgmtData)* )>

KeyInfo is an optional element which enables the recipient(s) to obtain the key(s) needed to validate the signature. If omitted, the recipient is expected to be able to identify the key based on application context information. This element contains one or more KeyInfo data elements providing information for the recipient(s). Applications may define and use any mechanism they choose through inclusion of elements from a different namespace.

<!ELEMENT SubjectName (#PCDATA)>
<!ELEMENT RetrievalMethod (#PCDATA)>

7.0 Algorithms

; This section requires more work. - JR

This sections identifies algorithms used with the XML digital signature standard. Entries contain the identifier to be used in signature documents, a reference to the formal specification, and definitions, where applicable, for the representation of keys and the results of cryptographic operations.

7.1 Algorithm Identifiers and Requirements

The specification defines the following URNs that are associated with algorithms we employ. Requirements are specified over implementation, not requirements for signature use.

Algorithm Type Algorithm Requirements Algorithm URI
  SHA1 mandatory urn:dsig:SHA1
  MD5 recommended
  AESH (forthcoming) urn:dsig:AESH
  HMAC-SHA1 mandatory urn:dsig:HMAC-SHA1
  HMAC-MD5 optional urn:dsig:HMAC-MD5
  DSAwithSHA1 (DSS) mandatory urn:dsig:DSAwithSHA1 (DSS)
  RSAwithSHA1 recommended urn:dsig:RSAwithSHA1
  RSAwithMD5 optional urn:dsig:RSAwithMD5
  ECDSA (forthcoming) urn:dsig:ECDSA
  :null mandatory urn:dsig:null
  :minimal mandatory urn:dsig:minimal
  XML-c14n recommended
  DOM-c14n recommended urn:dsig:DOM-c14n
  XPointer mandatory

7.2. Algorithm References

RFC1321. The MD5 Message-Digest Algorithm. R. Rivest. INFORMATIONAL
XML Canonicalization Requirements.
XML Pointer Language (XPointer)


8.0 Processing rules

These sections describe the operations to be performed as part of signature generation and validation. The description is of a logical behavior and does not specify an order of execution, nor specify discrete steps.

8.1 Generation

  1. apply Transformations determined by application to object being signed.
  2. calculate digest over object
  3. create Object reference element(s) including location of object, digest, and transformation and digest algorithm elements, if required.
  4. create SignedInfoelement with signaturealg, c14nAlg (for SignedInfo), and Object reference(s).
  5. canonicalize and calculate signature over SignedInfobased on algorithms in step d. f) construct signature document with SignedInfo, Object (s) (if desired, encoding may be different than that used for signing), KeyInfo (if required), and SignatureValue.

8.2 Signature Validation

  1. locate and apply Transformations (e.g. c14n) to the signed object(s) based on all Object reference(s) in the SignedInfoelement.
  2. calculate digest over all transformed signed object(s) based on the algorithm in Object reference(s). If the object is contained within the Object element, only the object itself is hashed (i.e. the <Object > and </Object > tags are excluded).
  3. compare value against digest value in SignedInfo(if mismatch, validation fails).
  4. canonicalize the SignedInfoelement based on the c14n algorithm ID in SignedInfo(or based on the default if absent).
  5. obtain the validation keying info from KeyInfo or externally.
  6. validate the SignatureValue based on the SignatureAlg in the SignedInfoelement, the key obtained in step c, and the results of step d. - Digest calculation is performed over the SignedInfoelement including start and end tags.

Note that while a signature may validate (a key was properly applied to content to yield the stated SignatureValue) this does not mean applications will necessarily trust or accept the signature. For instance, perhaps the assertions within the content that was signed could not be confirmed or validated themselves.


Editorial Comment: Declarations are now in the body of the text.

10.0 Example syntax

<Signature xmlns="">
  <SignedInfo Id="5">
    <c14nAlg Algorithm="null"/>
    <SignatureAlg algorithm="dsig:rsaWithSHA-1"/> ; not a namespace but an http urn scheme.
    <ObjectReference> ;one might use the manifest or package container here
      <Location HREF="..."/> 
        <!-- pointer to external signedobject  -->
      <Type Type="http://..." /> ;don't really understand
         <C14NAlg Algorithm="http://..."/>
         <Encoding Algorithm="http://..."/>
      <DigestAlg Algorithm="sha-1"/>
      <DigestValue Value="a23bcd43" />
      <Location HREF="#timestamp"/>
           <!-- points to Object below -->
      <Type type="signatureattributes" /> ;who defines this type? awkward
         <c14nAlg Algorithm="http://..."/>
      <DigestAlg Algorithm="sha-1"/>
      <DigestValue Value="a53uud43" />
  <SignatureValue value="dd2323dd"/>
  <Object id="timestamp1" type="signatureattributes" > ;who defined this type?
    <timestamp about="#5" xmlsn="">
     <keyname>Solo</keyname> ;changed to be elements

11.0 Open Issues

  1. Default c14n algorithms for SignedInfoand for objects. Other defaults. Mandatory to implement cryptographic algorithms and KeyInfo types.
  2. Identifying signed object. How do we handle the pointer from SignedInfoto the signed object, and what rules need to be defined for the ID attributes in SignedInfoand Object ?

12.0 Security Considerations


13.0 References

Internet Draft. Digest Values for DOM (DOMHASH) .
RDF Schema
RDF Model and Syntax
Uniform Resource Identifiers (URI): Generic Syntax
XML Linking Language
Extensible Markup Language (XML) Recommendation.
XML Canonicalization Requirements.
XML-Fragment Interchange
Namespaces in XML
XML Schema Part 1: Structures
XML Schema Part 2: Datatypes
XML Pointer Language (XPointer)
XML-Signature Requirements
Web Architecture: Describing and Exchanging Data.


14.0 Acknowledgements

Members of the WG

15.0 Other Useful Types

this is moot - JR

15.1 signatureattributes

signatureattributesis an optional element which contains one or more attributedata elements. Each attributedata element contains a type attribute naming the attribute type with a URI or qualifed element name and has a value defined by the type. signatureattributescontains information associated with the signature itself. signatureattributesalso contains an optional reference to the SignedInfoelement with which it is associated.

15.2 manifest

manifest is an element type which is used to collect a number of instances of Object reference and optionally Object . manifestis one instance of a type that may be used as a Object to create a signature over multiple items.