COSE Header parameter for RFC 3161 Time-Stamp Tokens
Internet-Draft draft-ietf-cose-tsa-tst-header-parameter-03
Henk Birkholz
Fraunhofer SIT
Rheinstrasse 75
Darmstadt
64295
Germany
henk.birkholz@sit.fraunhofer.de
Thomas Fossati
Linaro
thomas.fossati@linaro.org
Maik Riechert
Microsoft
UK
Maik.Riechert@microsoft.com
10 September 2024
Security
COSE
Internet-Draft
This document defines a CBOR Signing And Encrypted (COSE) header parameter for incorporating RFC 3161-based timestamping into COSE message structures (COSE_Sign and COSE_Sign1). This enables the use of established RFC 3161 timestamping infrastructure to prove the creation time of a message.
Discussion Venues
Source for this draft and an issue tracker can be found at https://github.com/ietf-scitt/draft-birkholz-cose-tsa-tst-header-parameter.
Introduction
RFC 3161 [RFC3161] provides a method to timestamp a message digest to prove that it was created before a given time.
This document defines two new CBOR Object Signing and Encryption (COSE) [STD96] header parameters that carry the TimestampToken (TST) output of RFC 3161, thus allowing existing and widely deployed trust infrastructure to be used with COSE structures used for signing (COSE_Sign and COSE_Sign1).
Use Cases
This section discusses two use cases, each representing one of the two modes of use defined in Section 2.
A first use case is a digital document signed alongside a trustworthy timestamp. This is a common case in legal contracts. In such scenario, the document signer wants to reinforce the claim that the document existed on a specific date. To achieve this, the document signer acquires a fresh TST for the document from a TSA, combines it with the document, and then signs the bundle. Later on, a relying party consuming the signed bundle can be certain that the document existed at least at the time specified by the TSA. The relying party does not have to trust the signer's clock, which may have been maliciously altered or simply inaccurate.
This usage scenario motivates the "Timestamp then COSE" mode defined in Section 2.1.
A second use case is the notarization of a signed document by registering it at a Transparency Service. This is common for accountability and auditability of issued documents. Once a document is registered at a Transparency Service's append-only log, its log entry cannot be changed. In certain cases, the registration policy of a Transparency Service may add a trustworthy timestamp to the signed document. This is done to lock the signature to a specific point in time. To achieve this, the Transparency Service acquires a TST from a TSA, bundles it alongside the signed document, and then registers it. A relying party that wants to ascertain the authenticity of the document after the signing key has been compromised, can do so by making sure that no revocation information has been made public before the time asserted in the TST.
This usage scenario motivates the "COSE then Timestamp" mode described in Section 2.2.
Requirements Notation
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
Modes of Use
There are two different modes of composing COSE protection and timestamping, motivated by the usage scenarios discussed above.
The diagrams in this section illustrate the processing flow of the specified modes. For simplicity, only the COSE_Sign1 processing is shown. Similar diagrams for COSE_Sign can be derived by allowing multiple private-key boxes and replacing the label [signature] with [signatures].
Timestamp then COSE (TTC)
Figure 1 shows the case where a datum is first digested and submitted to a TSA to be timestamped.
This mode is utilized when the signature should also be performed over the timestamp to provide an immutable timestamp.
A signed COSE message is then built as follows:
- The obtained timestamp token is added to the protected headers,
- The original datum becomes the payload of the signed COSE message.
The message imprint sent to the TSA (Section 2.4 of [RFC3161]) MUST be the hash of the payload field of the COSE signed object.
Timestamp, then COSE (TCC)

Signer

TSA

private-key

nonce

private-key

message

datum

hash

Imprint

L

Clock

protected

Sign1

TST

timestamp

unprotected

[protected]

[payload]

[signature]
                  ...

rfc3161-ttc

COSE

.--------.                                     .-----.
| Signer |                                     | TSA |
+--------+----------------------------------.  +-----+-------------.
|   .-------------.          .-------.      |  |   .-------------. |
|  / private-key /           | nonce +-------->+  / private-key /  |
| '-+-----------'            '-------'      |  | '------+------'   |
|   |                       .---------.     |  |        |          |
|   |  .-------.   .----.   | message |     |  |        |          |
|   |  + datum +->+ hash +->+ Imprint +------->+       .+.         |
|   |  '-+-----'   '----'   '---------'     |  |      | L | Clock  |
|   |    |                                  |  |       '+'         |
|   |    |               .-------------.    |  |        |          |
|   v    v               |  protected  |    |  |        v          |
|  .-------.             |   .-----.   |    |  |    .---------.    |
| |  Sign1  +<-----------+   | TST |<----------+   | timestamp |   |
|  '-+-----'             |   '-----'   |    |  |    '---------'    |
|    |                   '-------------'    |  |                   |
'----|--------------------------------------'  '-------------------'
     |                                 .-------------.
     +-------------+-----------+       | unprotected |
     |             |            |      |   .-----.   |
[protected]    [payload]   [signature] |   | ... |   |
     |             |            |      |   '-----'   |
     |             v            v      '------+------'
     |     .-------+------------+-----.       |
      '--->+     rfc3161-ttc COSE     +<-----'
           '--------------------------'

COSE then Timestamp (CTT)
Figure 2 shows the case where the signature(s) field of the signed COSE object is digested and submitted to a TSA to be timestamped. The obtained timestamp token is then added back as an unprotected header into the same COSE object.
This mode is utilized when a record of the timing of the signature operation is desired.
COSE, then Timestamp (CTT)

Signer

TSA

private-key

protected

datum

private-key

L

Clock

message

Sign1

hash

Imprint

nonce

timestamp

unprotected

[protected]

[payload]

[signature]

TST

rfc3161-ctt

COSE

.--------.                                     .-----.
| Signer |                                     | TSA |
+--------+----------------------------------.  +-----+-------------.
|   .-------------. .-----------. .-------. |  |   .-------------. |
|  / private-key /  | protected | | datum | |  |  / private-key /  |
| '-----+-------'   '---+-------' '---+---' |  | '------+------'   |
|       |               |             |     |  |        |          |
|       +---------------+------------'      |  |        |          |
|       |                                   |  |       .+.         |
|       v                  .---------.      |  |      | L | Clock  |
|  .---------.    .----.   | message |      |  |       '+'         |
| |   Sign1   +->+ hash +->+ Imprint +-------->|        |          |
|  '-+-------'    '----'   '---------'      |  |        v          |
|    |                      .-------.       |  |    .---------.    |
|    |                      | nonce +--------->|   | timestamp |   |
|    |                      '-------'       |  |    '---------'    |
'----|--------------------------------------'  '---------+---------'
     |                                 .-------------.   |
     +-------------+-----------+       | unprotected |   |
     |             |            |      |   .-----.   |   |
[protected]    [payload]   [signature] |   | TST |<-----'
     |             |            |      |   '-----'   |
     |             v            v      '------+------'
     |     .-------+------------+-----.       |
      '--->+     rfc3161-ctt COSE     +<-----'
           '--------------------------'

In this context, timestamp tokens are similar to a countersignature made by the TSA.
RFC 3161 Time-Stamp Tokens COSE Header Parameters
The two modes described in Section 2.1 and Section 2.2 use different inputs into the timestamping machinery, and consequently create different kinds of binding between COSE and TST. To clearly separate their semantics two different COSE header parameters are defined as described in the following subsections.
3161-ttc
The 3161-ttc COSE protected header parameter MUST be used for the mode described in Section 2.1.
The 3161-ttc protected header parameter contains a DER-encoded RFC3161 TimeStampToken wrapped in a CBOR byte string (Major type 2).
To minimize dependencies, the hash algorithm used for signing the COSE message SHOULD be the same as the algorithm used in the RFC3161 MessageImprint.
3161-ctt
The 3161-ctt COSE unprotected header parameter MUST be used for the mode described in Section 2.2.
The message imprint sent in the request to the TSA MUST be either:
- the hash of the signature field of the COSE_Sign1 message.
- the hash of the signatures field of the COSE_Sign message.
In either case, to minimize dependencies, the hash algorithm SHOULD be the same as the algorithm used for signing the COSE message. This may not be possible if the timestamp token has been obtained outside the processing context in which the COSE object is assembled.
The 3161-ctt unprotected header parameter contains a DER-encoded RFC3161 TimeStampToken wrapped in a CBOR byte string (Major type 2).
Timestamp Processing
RFC 3161 timestamp tokens use CMS as signature envelope format. [STD70] provides the details about signature verification, and [RFC3161] provides the details specific to timestamp token validation. The payload of the signed timestamp token is the TSTInfo structure defined in [RFC3161], which contains the message imprint that was sent to the TSA. The hash algorithm is contained in the message imprint structure, together with the hash itself.
As part of the signature verification, the receiver MUST make sure that the message imprint in the embedded timestamp token matches a hash of either the payload, signature, or signature fields, depending on the mode of use and type of COSE structure.
Appendix B of [RFC3161] provides an example that illustrates how timestamp tokens can be used to verify signatures of a timestamped message when utilizing X.509 certificates.
Security Considerations
Please review the Security Considerations section in [RFC3161]; these considerations apply to this document as well.
Also review the Security Considerations section in [STD96]; these considerations apply to this document as well, especially the need for implementations to protect private key material.
The following scenario assumes an attacker can manipulate the clocks on the COSE signer and its relying parties, but not the TSA. It is also assumed that the TSA is a trusted third party, so the attacker cannot impersonate the TSA and create valid timestamp tokens. In such a setting, any tampering with the COSE signer's clock does not have an impact because, once the timestamp is obtained from the TSA, it becomes the only reliable source of time. However, in both CTT and TTC mode, a denial of service can occur if the attacker can adjust the relying party's clock so that the CMS validation fails. This could disrupt the timestamp validation.
In CTT mode, an attacker could manipulate the unprotected header by removing or replacing the timestamp. To avoid that, the signed COSE object should be integrity protected during transit and at rest.
In TTC mode, the TSA is given an opaque identifier (a cryptographic hash value) for the payload. While this means that the content of the payload is not directly revealed, to prevent comparison with known payloads or disclosure of identical payloads being used over time, the payload would need to be armored, e.g., with a nonce that is shared with the recipient of the header parameter but not the TSA. Such a mechanism can be employed inside the ones described in this specification, but is out of scope for this document.
IANA Considerations
IANA is requested to add the COSE header parameters defined in Table 1 to the "COSE Header Parameters" registry [IANA.cose_header-parameters].
New COSE Header Parameters
Name | Label | Value Type | Value Registry | Description | Reference
3161-tcc | TBD1 | bstr | - | RFC 3161 timestamp token | RFCthis, Section 3.1
3161-ctt | TBD2 | bstr | - | RFC 3161 timestamp token | RFCthis, Section 3.2
Normative References
[STD70]

Cryptographic Message Syntax (CMS)
R. Housley
September 2009
STD 70
RFC 5652
DOI 10.17487/RFC5652
[RFC3161]

Internet X.509 Public Key Infrastructure Time-Stamp Protocol (TSP)
C. Adams
P. Cain
D. Pinkas
R. Zuccherato
August 2001
RFC 3161
DOI 10.17487/RFC3161
[STD96]

CBOR Object Signing and Encryption (COSE): Structures and Process
J. Schaad
August 2022
STD 96
RFC 9052
DOI 10.17487/RFC9052
[RFC2119]

Key words for use in RFCs to Indicate Requirement Levels
S. Bradner
March 1997
BCP 14
RFC 2119
DOI 10.17487/RFC2119
[RFC8174]

Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
B. Leiba
May 2017
BCP 14
RFC 8174
DOI 10.17487/RFC8174
[IANA.cose_header-parameters]

COSE Header Parameters
IANA
Acknowledgments
The editors would like to thank Carl Wallace, Leonard Rosenthol, Michael B. Jones, Michael Prorock, Orie Steele, and Steve Lasker for their reviews and comments.
Contributors
Carsten Bormann
cabo@tzi.org
Carsten contributed part of the security considerations.
Orie Steele
orie@transmute.industries
Orie contributed an improved version of the diagrams.