@@ -40,24 +40,28 @@ The signature format is a JSON message of the following form:
40
40
```
41
41
42
42
Empty fields may be omitted. [ Multiple signatures] ( #multiple-signatures ) are
43
- allowed.
43
+ allowed. Note that an optional ` signature.sigType ` field may be present but
44
+ empty for compatibility with [ backwards compatible signature] mode.
44
45
45
46
Parameters:
46
47
47
48
* SERIALIZED_BODY is the byte sequence to be signed.
48
49
49
- * PAYLOAD_TYPE is a URI indicating how to interpret SERIALIZED_BODY. It
50
- encompasses the content type (JSON, Canonical-JSON, CBOR, etc.), the
51
- purpose, and the schema version of the payload. This obviates the need for
52
- the ` _type ` field within in-toto/TUF payloads. This URI does not need to be
53
- resolved to a remote resource, nor does such a resource need to be fetched.
54
- Examples:
50
+ * PAYLOAD_TYPE is an authenticated( * ) URI indicating how to interpret
51
+ SERIALIZED_BODY. It encompasses the content type (JSON, Canonical-JSON,
52
+ CBOR, etc.), the purpose, and the schema version of the payload. This
53
+ obviates the need for the ` _type ` field within in-toto/TUF payloads. This
54
+ URI does not need to be resolved to a remote resource, nor does such a
55
+ resource need to be fetched. Examples:
55
56
56
57
- https://in-toto.io/Link/v0.9
57
58
- https://in-toto.io/Layout/v0.9
58
59
- https://theupdateframework.com/Root/v1.0.5
59
60
- etc...
60
61
62
+ (* ) Exception: PAYLOAD_TYPE is unauthenticated if `signature.sigType ==
63
+ "raw-json-no-payload-type"`.
64
+
61
65
* KEYID is an optional, unauthenticated hint indicating what key and algorithm
62
66
was used to sign the message. As with Sign(), details are agreed upon
63
67
out-of-band by the signer and verifier. It ** MUST NOT** be used for security
@@ -105,6 +109,9 @@ To sign:
105
109
106
110
To verify:
107
111
112
+ - If `sigType == "raw-json-no-payload-type"`, use
113
+ [backwards compatible signature] instead. Reject if `sigType` is any other
114
+ non-empty value.
108
115
- Base64-decode `payload`; call this SERIALIZED_BODY. Reject if the decoding
109
116
fails.
110
117
- Base64-decode `sig` and verify PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY).
@@ -119,44 +126,46 @@ either, and verifiers **MUST** accept either.
119
126
### Backwards compatible signatures
120
127
121
128
To convert existing signatures from the current format to the new format,
122
- `"backwards-compatible- json"` is added to the payload type URI to indicate that
129
+ `"raw- json-no-payload-type "` is added to the payload type URI to indicate that
123
130
the signature is over the raw payload. This allows the signatures to remain
124
131
valid while avoiding the verifier from having to use [Canonical JSON].
125
132
126
133
```json
127
134
{
128
- "payload": "<Base64(CanonicalJson(BODY))>",
129
- "payloadType": "<URI>/backwards-compatible-json",
135
+ "payload": "<Base64(SERIALIZED_BODY)>",
130
136
"signatures" : [{
131
137
"keyid": "<KEYID>",
132
- "sig": "<Base64(Sign(CanonicalJson(BODY)))>"
138
+ "sigType": "raw-json-no-payload-type",
139
+ "sig" : "<Base64(Sign(SERIALIZED_BODY))>"
133
140
}]
134
141
}
135
142
```
136
143
137
- Support for this backwards compatibility mode is optional.
144
+ Support for this backwards compatibility mode is optional and should be disabled
145
+ by default.
138
146
139
147
To sign:
140
148
141
- - BODY ** MUST** be an object type (` {...} ` ).
142
- - Serialize BODY as [ Canonical JSON] ; call this SERIALIZED_BODY.
149
+ - The message ** MUST** be an object type (` {...} ` ).
150
+ - Serialize the message as [ Canonical JSON] ; call this SERIALIZED_BODY.
143
151
- Sign SERIALIZED_BODY, base64-encode the result, and store it in ` sig ` .
152
+ - Store ` "raw-json-no-payload-type" ` in ` sigType ` .
144
153
- Optionally, compute a KEYID and store it in ` keyid ` .
145
154
- Base64-encode SERIALIZED_BODY and store it in ` payload ` .
146
- - Store ` "<URI>/backwards-compatible-json" ` in ` payloadType ` .
147
155
148
156
To verify:
149
157
150
- - If ` payloadType ` != ` "<URI>/backwards-compatible- json"` , use the normal
151
- verification process instead of this one.
158
+ - If ` sigType != "raw- json-no-payload-type "` , use the
159
+ [ normal verification process] ( #steps ) instead of this one.
152
160
- Base64-decode ` payload ` ; call this SERIALIZED_BODY. Reject if the decoding
153
161
fails.
154
162
- Base64-decode ` sig ` and verify SERIALIZED_BODY. Reject if either the
155
163
decoding or the signature verification fails.
156
164
- Parse SERIALIZED_BODY as a JSON object. Reject if the parsing fails or if
157
165
the result is not a JSON object. In particular, the first byte of
158
- SERIALIZED_BODY ** MUST** be ` { ` . Verifiers ** MUST NOT** require SERIALIZED_BODY
159
- to be Canonical JSON.
166
+ SERIALIZED_BODY ** MUST** be ` { ` . Verifiers ** MUST NOT** require
167
+ SERIALIZED_BODY to be Canonical JSON.
168
+ - Discard ` payloadType ` if present.
160
169
161
170
Backwards compatible signatures are not recommended because they lack the
162
171
authenticated payloadType indicator.
@@ -280,8 +289,8 @@ Rationales for specific decisions:
280
289
payloadType were not signed.
281
290
- Also, URIs don't need to be registered while Media Types do.
282
291
283
- - Why use payloadType "backwards-compatible- json" instead of assuming
284
- backwards compatible mode if payloadType is absent?
292
+ - Why use payloadType "raw- json-no-payload-type " instead of assuming backwards
293
+ compatible mode if payloadType is absent?
285
294
286
295
- We wanted to leave open the possibility of having an
287
296
application-specific "default" value if payloadType is unspecified,
@@ -337,11 +346,11 @@ To detect whether a signature is in the old or new format:
337
346
To convert an existing signature to the new format:
338
347
339
348
- ` new.payload = base64encode(CanonicalJson(orig.signed)) `
340
- - ` new.payloadType = "<URI>/backwards-compatible- json" `
349
+ - ` new.signatures[*].sigType = "raw- json-no-payload-type " `
341
350
- ` new.signatures[*].sig = base64encode(hexdecode(orig.signatures[*].sig)) `
342
351
- ` new.signatures[*].keyid = orig.signatures[*].keyid `
343
352
344
- To convert a backwards compatible signature to the old format:
353
+ To convert a [ backwards compatible signature] to the old format:
345
354
346
355
- ` old.signed = jsonparse(base64decode(new.payload)) `
347
356
- ` old.signatures[*].sig = hexencode(base64decode(new.signatures[*].sig)) `
0 commit comments