DocumentID: ECMA-376/Part2/12.2.4 Title: ECMA-376, Part2: 12.2.4 Digital Signature Markup Extracted-From: ECMA-376 Office Open XML File Formats, 1st Edition / December 2006 Warning: Coverted to HTML format by a script known to have bugs
The markup described here includes a subset of elements and attributes from the XML Digital Signature specification and some package-specific markup. For a complete example of a digital signature, see §12.3.
The package modifications to the XML Digital Signature specification are summarized as follows:
The producer shall create package-specific Object elements that contain exactly one Manifest element and exactly one SignatureProperties element. [Note: This SignatureProperties element can contain multiple SignatureProperty elements. end note] The consumer shall consider package-specific Object elements that contain other types of elements to be an error. [M6.8] [Note: A signature may contain other Object elements that are not package-specific. end note]
URI attribute only parts within the package. The consumer shall consider Reference elements within a Manifest element that reference resources outside the package to be an error. [M6.9] The producer shall create relative references to the local parts that have query components that specifies the part content type as described in §12.2.4.6. The relative reference excluding the query component shall conform to the part name grammar. The consumer shall consider a relative reference to a local part that has a query component that incorrectly specifies the part content type to be an error. [M6.10] The producer shall create Reference elements with a query component that specifies the content type that matches the content type of the referenced part. The consumer shall consider signature validation to fail if the part content type compared in a case-sensitive manner to the content type specified in the query component of the part reference does not match. [M6.11]Id attribute value set to idSignatureTime. The Target attribute value of this element shall be either empty or contain a fragment reference to the value of the Id attribute of the root Signature element. A SignatureProperty element shall contain exactly one SignatureTime child element. The consumer shall consider a SignatureProperty element that does not contain a SignatureTime element or whose Target attribute value is not empty or does not contain a fragment reference the Id attribute of the ancestor Signature element to be in error. [M6.14].[Note: All modifications to XML Digital Signature markup occur in locations where the XML Signature schema allows any namespace. Therefore, package digital signature XML is valid against the XML Signature schema. end note]
The structure of a Signature element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The structure of a SignedInfo element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of a CanonicalizationMethod element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
Since XML allows equivalent content to be represented differently, a producer should apply a canonicalization transform to the SignedInfo element when it generates it, and a consumer should apply the canonicalization transform to the SignedInfo element when validating it. [S6.3]
[Note: Performing a canonicalization transform ensures that SignedInfo content can be validated even if the content has been regenerated using, for example, different entity structures, attribute ordering, or character encoding.
Producers and consumers should also use canonicalization transforms for references to parts that hold XML documents. These transforms are defined using the Transformelement. end note]
The following canonicalization methods shall be supported by producers and consumers of packages with digital signatures:
Consumers validating signed packages shall fail the validation if other canonicalization methods are encountered. [M6.34]
The structure of a SignatureMethod element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The structure of a Reference element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The producer shall create a Reference element within a Manifest element with a URI attribute and that attribute shall contain a part name, without a fragment identifier. The consumer shall consider a Reference element with a URI attribute that does not contain a part name to be an error. [M6.18]
References to package parts include the part content type as a query component. The syntax of the relative reference is as follows:
/page1.xml?ContentType="value"
where value is the content type of the targeted part.
[Note: See §12.2.4.1 for additional requirements on Reference elements. end note]
[Example:
Example 12--2. Part reference with query component
In the following example, the content type is "application/vnd.ms-package.relationships+xml".
URI="/_rels/document.xml.rels?ContentType=application/vnd.ms-package.relationships+xml"
end example]
The structure of a Transforms element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The following transforms shall be supported by producers and consumers of packages with digital signatures:
Consumers validating signed packages shall fail the validation if other transforms are encountered. Relationships transforms shall only be supported by producers and consumers when the Transform element is a descendant element of a Manifest element [M6.19]
The structure of a Transform element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The structure of a DigestMethod element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The structure of a DigestValue element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of a SignatureValue element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The Object element can be either package-specific or application-specific.
The structure of a Object element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
[Note: Although the diagram above shows use of the Id attribute as optional, as does the XML Digital Signature schema, for package-specific Object elements, the Id attribute shall be specified and have the value of "idPackageObject". This is a package-specific restriction over and above the XML Digital Signature schema. end note]
The producer shall create each Signature element with exactly one package-specific Object. For a signed package, consumers shall treat the absence of a package-specific Object, or the presence of multiple package-specific Object elements, as an invalid signature. [M6.15]
The application-specific Object element specifies application-specific information. The format designer might permit one or more application-specific Object elements. If allowed by the format designer, format producers can create one or more application-specific Object elements. [O6.8] Producers shall create application-specific Object elements that contain XML-compliant data; consumers shall treat data that is not XML-compliant as an error. [M6.20] Format designers and producers might not apply package-specific restrictions regarding URIs and Transform elements to application-specific Object element. [O6.9]
The structure of a KeyInfo element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of an X509Data element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of an X509Certificate element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of a Manifest element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
annotation |
|
The structure of a SignaturePropertieselement is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
|
|
Annotation |
|
The structure of a SignatureProperty element is shown in the following diagram:
|
diagram |
|
||||||||||||||||||||
|
namespace |
http://www.w3.org/2000/09/xmldsig# |
||||||||||||||||||||
|
attributes |
|
||||||||||||||||||||
|
annotation |
|
The structure of a SignatureTime element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://schemas.openxmlformats.org/package/2006/digital-signature |
|
|
annotation |
|
The structure of a Format element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://schemas.openxmlformats.org/package/2006/digital-signature |
|
|
annotation |
|
The date and time format definition conforms to the syntax described in the W3C Note "Date and Time Formats."
The structure of a Value element is shown in the following diagram:
|
diagram |
|
|
|
namespace |
http://schemas.openxmlformats.org/package/2006/digital-signature |
|
|
annotation |
|
The structure of a RelationshipReference element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://schemas.openxmlformats.org/package/2006/digital-signature |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
The structure of a RelationshipsGroupReference element is shown in the following diagram:
|
diagram |
|
|||||||||||||
|
namespace |
http://schemas.openxmlformats.org/package/2006/digital-signature |
|||||||||||||
|
attributes |
|
|||||||||||||
|
annotation |
|
Format designers might permit producers to sign individual relationships in a package or the Relationships part as a whole. [O6.10] To sign a subset of relationships, the producer shall use the package-specific relationships transform. The consumer shall use the package-specific relationships transform to validate the signature when a subset of relationships are signed. [M6.25] The transform filters the contents of the Relationships part to include only relationships that have Id values matching the specified SourceId values or Type values matching the specified SourceType values. A producer shall not specify more than one relationship transform for a particular relationships part. A consumer shall treat the presence of more than one relationship transform for a particular relationships part as an error. [M6.35]
Producers shall specify a canonicalization transform immediately following a relationships transform and consumers that encounter a relationships transform that is not immediately followed by a canonicalization transform shall generate an error. [M6.26]
The relationships transform takes the XML document from the Relationships part and converts it to another XML document.
The package implementer might create relationships XML that contains content from several namespaces, along with versioning instructions as defined in Part 5: "Markup Compatibility and Extensibility". [O6.11]
The relationships transform algorithm is as follows:
Step 1: Process versioning instructions
Step 2: Sort and filter relationships
Id value in lexicographical order, considering Id values as case-sensitive Unicode strings.Id value that matches any SourceId valueor a Type value that matches any SourceType value, among the SourceId and SourceType values specified in the transform definition. Producers and consumers shall compare values as case-sensitive Unicode strings. [M6.27] The resulting XML document holds all Relationship elements that either have an Id value that matches a SourceId value or a Type value that matches a SourceType value specified in the transform definition.Step 3: Prepare for canonicalization