Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update spec for timestamping #290

Merged
merged 81 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
3ea8e20
specs related to Timestamping
Two-Hearts Dec 25, 2023
b87fd4c
update
Two-Hearts Dec 25, 2023
4478a2c
update
Two-Hearts Dec 27, 2023
576e605
update
Two-Hearts Dec 27, 2023
6093caf
update
Two-Hearts Dec 27, 2023
a5f9f11
update
Two-Hearts Dec 27, 2023
b2359ba
update
Two-Hearts Dec 27, 2023
b4125e1
update
Two-Hearts Dec 27, 2023
e36692a
update
Two-Hearts Dec 27, 2023
0e8eb01
updated
Two-Hearts Dec 27, 2023
eeb56d3
updated per review
Two-Hearts Dec 28, 2023
010aca5
update
Two-Hearts Dec 28, 2023
c1d711e
updated per review
Two-Hearts Jan 2, 2024
49d8d7e
updated per review
Two-Hearts Jan 4, 2024
94ce122
update
Two-Hearts Jan 4, 2024
645a53c
update
Two-Hearts Jan 4, 2024
960f8ce
update
Two-Hearts Jan 4, 2024
5f3d2b3
update
Two-Hearts Jan 4, 2024
6771643
update
Two-Hearts Jan 4, 2024
c916ee2
updated per review
Two-Hearts Jan 5, 2024
06f6e8d
nit
Two-Hearts Jan 9, 2024
93eb901
update per review
Two-Hearts Jan 30, 2024
88e7a97
Merge branch 'notaryproject:main' into tsa
Two-Hearts Jan 30, 2024
4557764
update
Two-Hearts Jan 30, 2024
5fca53b
update
Two-Hearts Jan 30, 2024
eaf9bfa
update
Two-Hearts Jan 30, 2024
cecd09d
resolved conflicts
Two-Hearts Mar 13, 2024
0ace260
update timestamping spec
Two-Hearts Mar 13, 2024
8b93c76
update
Two-Hearts Mar 20, 2024
4630bdb
revise based on discussions
Two-Hearts Mar 21, 2024
7cce013
revise based on discussions
Two-Hearts Mar 21, 2024
b69f9e6
revise based on discussions
Two-Hearts Mar 21, 2024
92aa824
update
Two-Hearts Mar 21, 2024
aa3fd09
update
Two-Hearts Mar 21, 2024
15806fd
update
Two-Hearts Apr 3, 2024
3456402
update
Two-Hearts Apr 8, 2024
5cb7520
update
Two-Hearts Apr 8, 2024
df33526
update
Two-Hearts Apr 8, 2024
1362ff9
update
Two-Hearts Apr 10, 2024
ae08c46
Merge branch 'notaryproject:main' into tsa
Two-Hearts Apr 11, 2024
dc61f88
update
Two-Hearts Apr 11, 2024
e8fb5d7
update
Two-Hearts Apr 11, 2024
6428134
update
Two-Hearts Apr 16, 2024
7c267ea
timestamp
Two-Hearts Apr 17, 2024
c75c1df
timestamp
Two-Hearts Apr 18, 2024
f4f4914
clean up
Two-Hearts Apr 19, 2024
aafa7d5
refactored to trust policy 2.0
Two-Hearts Apr 23, 2024
8860133
trust policy 2.0
Two-Hearts Apr 25, 2024
2a6833f
updated per comments
Two-Hearts Apr 26, 2024
f70a466
updated per review
Two-Hearts May 2, 2024
37f9496
update
Two-Hearts May 6, 2024
5bca331
update
Two-Hearts May 6, 2024
821442f
update
Two-Hearts May 7, 2024
80be5ff
update
Two-Hearts May 7, 2024
3bc4106
update
Two-Hearts May 7, 2024
6711fec
update
Two-Hearts May 8, 2024
a121378
update
Two-Hearts May 8, 2024
2cc7b47
update
Two-Hearts May 8, 2024
10a75b7
update
Two-Hearts May 8, 2024
9e24818
update
Two-Hearts May 8, 2024
66da960
update
Two-Hearts May 8, 2024
2d62e51
update
Two-Hearts May 8, 2024
93e48d2
update per 5/20 community meeting
Two-Hearts May 21, 2024
f8e567d
update
Two-Hearts May 21, 2024
e7a9a5a
update
Two-Hearts May 22, 2024
c047008
update
Two-Hearts May 22, 2024
7f33e4c
added diagram for better understanding
Two-Hearts May 23, 2024
b2a07de
update
Two-Hearts May 23, 2024
5ff790f
update
Two-Hearts May 23, 2024
8f0be6a
clean up
Two-Hearts May 23, 2024
375e8b9
clean up
Two-Hearts May 27, 2024
50971bd
nit update
Two-Hearts May 28, 2024
a8400e5
nit updates
Two-Hearts May 28, 2024
b29bf52
nit updates
Two-Hearts May 28, 2024
f9915fd
update
Two-Hearts Jun 5, 2024
50e439c
update
Two-Hearts Jun 5, 2024
bc02398
update
Two-Hearts Jun 6, 2024
d183283
update
Two-Hearts Jun 6, 2024
dc8c42d
updated per review
Two-Hearts Jun 14, 2024
b808eaa
update
Two-Hearts Jun 17, 2024
3ad24c2
updated based on review
Two-Hearts Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions specs/plugin-extensibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ This interface targets plugins that integrate with providers of basic cryptograp
1. Check if `response.signingAlgorithm` is one of [supported signing algorithms](./signature-specification.md#algorithm-selection).
2. Check that the plugin did not modify `request.payload` before generating the signature, and the signature is valid for the given payload. Verify the hash of the `request.payload` against `response.signature`, using the public key of signing certificate (leaf certificate) in `response.certificateChain` along with the `response.signingAlgorithm`. This step does not include certificate chain validation (certificate chain leads to a trusted root configured in Notation's Trust Store), or revocation check.
3. Check that the `response.certificateChain` conforms to [Certificate Requirements](./signature-specification.md#certificate-requirements).
5. Assemble the JWS Signature envelope using `response.signature`, `response.signingAlgorithm` and `response.certificateChain`. Notation may also generate and include timestamp signature in this step.
5. Assemble the signature envelope using `response.signature`, `response.signingAlgorithm` and `response.certificateChain`. If the signing scheme is [`notary.x509`](./signing-scheme.md/#notaryx509), implementations MAY also request and include TSA timestamp countersignature in this step. The `certReq` field in the [timestamping request](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.1) MUST be set to true.
6. Generate a signature manifest for the given signature envelope.
2. Else if, plugin supports capability `SIGNATURE_GENERATOR.ENVELOPE` *(covered in next section)*
3. Return an error
Expand Down Expand Up @@ -355,7 +355,7 @@ All response attributes are required.

### Signature Envelope Generator

This interface targets plugins that in addition to signature generation want to generate the complete signature envelope. This interface allows plugins to have full control over the generated signature envelope, and can append additional signed and unsigned metadata, including timestamp signatures. The plugin must be signature envelope format aware, and implement new formats when Notary Project adopts new formats.
This interface targets plugins that in addition to signature generation want to generate the complete signature envelope. This interface allows plugins to have full control over the generated signature envelope, and can append additional signed and unsigned metadata, including timestamp countersignatures. The plugin must be signature envelope format aware, and implement new formats when Notary Project adopts new formats.

#### Signing workflow using plugin

Expand All @@ -366,14 +366,15 @@ This interface targets plugins that in addition to signature generation want to
1. Execute the plugin with `get-plugin-metadata` command
1. If plugin supports capability `SIGNATURE_GENERATOR.ENVELOPE`
1. Execute the plugin with `generate-envelope` command. Set `request.keyId` and the optional `request.pluginConfig` to corresponding values associated with signing key `keyName` in `config.json`. Set `request.payload` to base64 encoded the [Notary Project signature Payload](./signature-specification.md#payload), `request.payloadType` to `application/vnd.cncf.notary.payload.v1+json` and `request.signatureEnvelopeType` to a pre-defined type (`application/jose+json` for JWS).
2. `response.signatureEnvelope` contains the base64 encoded signature envelope, value of `response.signatureEnvelopeType` MUST match `request.signatureEnvelopeType`.
3. Validate the generated signature, return an error if of the checks fails.
2. If plugin supports timestamping under signing scheme [`notary.x509`](./signing-scheme.md/#notaryx509), the plugin MAY request and include TSA timestamp countersignature in the signature envelope at this step. The timestamp countersignature MUST be [RFC 3161](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2) compliant. The `certReq` field in the [timestamping request](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.1) MUST be set to true.
3. `response.signatureEnvelope` contains the base64 encoded signature envelope, value of `response.signatureEnvelopeType` MUST match `request.signatureEnvelopeType`.
4. Validate the generated signature envelope, return an error if any of the checks fails.
1. Check if `response.signatureEnvelopeType` is a supported envelope type and `response.signatureEnvelope`'s format matches `response.signatureEnvelopeType`.
2. Check if the signing algorithm in the signature envelope is one of [supported signing algorithms](./signature-specification.md#algorithm-selection).
3. Check that the [`targetArtifact` descriptor](./signature-specification.md#payload) in JWSPayload in `response.signatureEnvelope` matches `request.payload`. Plugins MAY append additional annotations but MUST NOT replace/override existing descriptor attributes and annotations.
4. Check that `response.signatureEnvelope` can be verified using the public key and signing algorithm specified in the signing certificate, which is embedded as part of certificate chain in `response.signatureEnvelope` . This step does not include certificate chain validation (certificate chain leads to a trusted root configure in Notation), or revocation check.
5. Check that the certificate chain in `response.signatureEnvelope` confirm to [Certificate Requirements].
4. Generate a signature manifest for the given signature envelope, and append `response.annotations` to manifest annotations.
4. Check that `response.signatureEnvelope` can be verified using the public key and signing algorithm specified in the signing certificate, which is embedded as part of certificate chain in `response.signatureEnvelope`. This step does not include certificate chain validation (certificate chain leads to a trusted root configured in Notation), or revocation check.
5. Check that the certificate chain in `response.signatureEnvelope` confirm to [certificate requirements](./signature-specification.md#certificate-requirements).
5. Generate a signature manifest for the given signature envelope, and append `response.annotations` to manifest annotations.
2. Else if plugin supports capability `SIGNATURE_GENERATOR.RAW` *(covered in previous section)*
3. Return an error

Expand Down Expand Up @@ -510,11 +511,11 @@ This allows implementations of the [Notary Project signature specification](./si
"criticalAttributes" :
{
"contentType" : "application/vnd.cncf.notary.payload.v1+json",
// One of notary.default.x509 or notary.signingAuthority.x509
"signingScheme" : "notary.default.x509" | "notary.signingAuthority.x509",
// One of notary.x509 or notary.x509.signingAuthority
"signingScheme" : "notary.x509" | "notary.x509.signingAuthority",
// Value is always RFC 3339 formatted date time string
"expiry": "2022-10-06T07:01:20Z",
// if signingScheme is notary.signingAuthority.x509.
// if signingScheme is notary.x509.signingAuthority
"authenticSigningTime": "2022-04-06T07:01:20Z",
// Name of the verification plugin
"verificationPlugin": "com.example.nv2plugin",
Expand Down Expand Up @@ -604,6 +605,6 @@ All response attributes are required.

## FAQ

**Q: Will Notation generate timestamp signature for Signature Envelope Generator plugin or its responsibility of plugin publisher?**
**Q: Will Notation generate timestamp countersignature for Signature Envelope Generator plugin or its responsibility of plugin publisher?**

**A :** If the envelope generated by a Signature Envelope Generator plugin contains timestamp signature, Notation will not append additional timestamp signature, else it will generate the timestamp signature and append it to the envelope as an unsigned attribute.
**A :** The Signature Envelope Generator plugin has full control over the generated signature envelope including any timestamp countersignature. Notation will NOT add/update/delete any timestamp countersignature in an envelope that's generated by a Signature Envelope Generator plugin.
5 changes: 2 additions & 3 deletions specs/signature-envelope-cose.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ Note: The above examples are represented using the [extended CBOR diagnostic not
- **[`content type`](https://datatracker.ietf.org/doc/html/rfc8152#section-3.1)** (*tstr*): The REQUIRED parameter content type (label `3`) is used to declare the media type of the secured content (the payload). The supported value is `application/vnd.cncf.notary.payload.v1+json`.
- **`io.cncf.notary.signingScheme`** (*tstr*, critical): This REQUIRED header specifies the [Notary Project signing scheme](./signing-scheme.md) used by the signature. Supported values are `notary.x509` and `notary.x509.signingAuthority`.
- **`io.cncf.notary.signingTime`** (*date/time*): This header specifies the time at which the signature was generated. This is an untrusted date/time, and therefore not used in trust decisions. Its value is an Epoch-Based Date/Time defined in [RFC 8949](https://datatracker.ietf.org/doc/html/rfc8949#section-3.4.2). The optional fractional seconds SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509`.
- **`io.cncf.notary.authenticSigningTime`** (*date/time*, critical): This header specifies the authenticated time at which the signature was generated. Its value is an Epoch-Based Date/Time defined in [RFC 8949](https://datatracker.ietf.org/doc/html/rfc8949#section-3.4.2). The optional fractional seconds SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509.signingAuthority` .
- **`io.cncf.notary.authenticSigningTime`** (*date/time*, critical): This header specifies the authenticated time at which the signature was generated. Its value is an Epoch-Based Date/Time defined in [RFC 8949](https://datatracker.ietf.org/doc/html/rfc8949#section-3.4.2). The optional fractional seconds SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509.signingAuthority`.
- **`io.cncf.notary.expiry`** (*date/time*, critical): This OPTIONAL header provides a "best by use" time for the artifact, as defined by the signer. Its value is an Epoch-Based Date/Time defined in [RFC 8949](https://datatracker.ietf.org/doc/html/rfc8949#section-3.4.2). The optional fractional seconds SHOULD NOT be used.

## Unprotected Headers
Expand All @@ -154,8 +154,7 @@ The Notary Project signature supports the following unprotected header parameter
Note: `<<` and `>>` are used to notate the CBOR byte string resulting from encoding the data item.

- **[`x5chain`](https://datatracker.ietf.org/doc/html/draft-ietf-cose-x509-08#section-2)** (*array of bstr*): This REQUIRED parameter (label `33` by [IANA](https://www.iana.org/assignments/cose/cose.xhtml#header-parameters)) contains the ordered list of X.509 certificate or certificate chain ([RFC5280](https://datatracker.ietf.org/doc/html/rfc5280)) corresponding to the key used to digitally sign the COSE. The certificate chain is represented as an array of certificate, each certificate in the array is DER encoded and then wrapped in a CBOR byte string. The certificate containing the public key corresponding to the key used to digitally sign the COSE MUST be the first certificate, followed by the intermediate and root certificates in the correct order. Refer [*Certificate Chain* unsigned attribute](signature-specification.md#unsigned-attributes) for more details. Optionally, this header can be presented in the protected header.
- **`io.cncf.notary.timestampSignature`** (*bstr*): This OPTIONAL header is used to store countersignature that provides authentic signing time. Only [RFC3161]([rfc3161](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2)) compliant `TimeStampToken` are supported.
- **TODO** Define the opaque datum (hash of envelope) that is sent to TSA, and how TSA response (time stamp token) is represented in this header.
- **`io.cncf.notary.timestampSignature`** (*bstr*): This OPTIONAL header is used to store a countersignature that proves the signature was generated before the timestamp. Only [RFC 3161](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2) compliant `TimeStampToken` are supported. If present, this header is validated and used solely under the [`notary.x509`](./signing-scheme.md/#notaryx509) signing scheme. Refer [*Timestamp Signature* unsigned attribute](signature-specification.md#unsigned-attributes) for more details.
- **`io.cncf.notary.signingAgent`** (*tstr*): This OPTIONAL header provides the identifier of a client (e.g. Notation) that produced the signature. E.g. `notation/1.0.0`. Refer [*Signing Agent* unsigned attribute](signature-specification.md#unsigned-attributes) for more details.

## Signature
Expand Down
5 changes: 2 additions & 3 deletions specs/signature-envelope-jws.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ Example with Signing Scheme `notary.x509.signingAuthority`
- **[`cty`](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.10)**(*string*): The REQUIRED header content-type is used to declare the media type of the secured content (the payload). The supported value is `application/vnd.cncf.notary.payload.v1+json`.
- **`io.cncf.notary.signingScheme`**(*string*)(critical): This REQUIRED header specifies the [Notary Project signing scheme](./signing-scheme.md) used by the signature. Supported values are `notary.x509` and `notary.x509.signingAuthority`.
- **`io.cncf.notary.signingTime`**(*string*): This header specifies the time at which the signature was generated. This is an untrusted timestamp, and therefore not used in trust decisions. Its value is a [RFC 3339][rfc3339] formatted date time, the optional fractional second ([time-secfrac][rfc3339][[1](https://datatracker.ietf.org/doc/html/rfc3339#section-5.3)]) SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509`.
- **`io.cncf.notary.authenticSigningTime`**(*string*)(critical): This header specifies the authenticated time at which the signature was generated. Its value is a [RFC 3339][rfc3339] formatted date time, the optional fractional second ([time-secfrac][rfc3339][[1](https://datatracker.ietf.org/doc/html/rfc3339#section-5.3)]) SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509.signingAuthority` .
- **`io.cncf.notary.authenticSigningTime`**(*string*)(critical): This header specifies the authenticated time at which the signature was generated. Its value is a [RFC 3339][rfc3339] formatted date time, the optional fractional second ([time-secfrac][rfc3339][[1](https://datatracker.ietf.org/doc/html/rfc3339#section-5.3)]) SHOULD NOT be used. This claim is REQUIRED and only valid when signing scheme is `notary.x509.signingAuthority`.
- **`io.cncf.notary.expiry`**(*string*)(critical): This OPTIONAL header provides a “best by use” time for the artifact, as defined by the signer. Its value is a [RFC 3339][rfc3339] formatted date time, the optional fractional second ([time-secfrac][rfc3339][[1](https://datatracker.ietf.org/doc/html/rfc3339#section-5.3)]) SHOULD NOT be used.
- **[`crit`](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.11)**(*array of strings*): This REQUIRED (optional as per JWS spec, but required in Notary Project JWS signature) header lists the headers that implementation MUST understand and process. It MUST only contain headers apart from registered headers (e.g. `alg`, `cty`) in JWS specification. This header MUST contain `io.cncf.notary.signingScheme` which is a required critical header, and optionally contain `io.cncf.notary.authenticSigningTime` and `io.cncf.notary.expiry` if these critical headers are present in the signature.

Expand All @@ -144,8 +144,7 @@ The Notary Project signature supports following unprotected headers: `timestamp`
```

- **[`x5c`](https://datatracker.ietf.org/doc/html/rfc7515#section-4.1.6)** (*array of strings*): This REQUIRED header contains the ordered list of X.509 certificate or certificate chain([RFC5280](https://datatracker.ietf.org/doc/html/rfc5280)) corresponding to the key used to digitally sign the JWS. The certificate chain is represented as a JSON array of certificate value strings, each string in the array is a base64-encoded DER certificate value. The certificate containing the public key corresponding to the key used to digitally sign the JWS MUST be the first certificate, followed by the intermediate and root certificates in the correct order. Refer [*Certificate Chain* unsigned attribute](signature-specification.md#unsigned-attributes) for more details.
- **`io.cncf.notary.timestampSignature`** (*string*): This OPTIONAL header is used to store countersignature that provides authentic signing time. Only [RFC3161]([rfc3161](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2)) compliant `TimeStampToken` are supported.
- **TODO** Define the opaque datum (hash of envelope) that is sent to TSA, and how TSA response (time stamp token) is represented in this header.
- **`io.cncf.notary.timestampSignature`** (*string*): This OPTIONAL header is used to store a base64-encoded countersignature that proves the signature was generated before the timestamp. Only [RFC 3161](https://datatracker.ietf.org/doc/html/rfc3161#section-2.4.2) compliant `TimeStampToken` are supported. If present, this header is validated and used solely under the [`notary.x509`](./signing-scheme.md/#notaryx509) signing scheme. Refer [*Timestamp Signature* unsigned attribute](signature-specification.md#unsigned-attributes) for more details.
- **`io.cncf.notary.signingAgent`**(*string*): This OPTIONAL header provides the identifier of a client (e.g. Notation) that produced the signature. E.g. “notation/1.0.0”. Refer [*Signing Agent* unsigned attribute](signature-specification.md#unsigned-attributes) for more details.

## Signature
Expand Down
Loading