@@ -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 was used to
62
66
sign the message. It ** must not** be used for security decisions.
63
67
@@ -102,6 +106,9 @@ To sign:
102
106
103
107
To verify:
104
108
109
+ - If `sigType == "raw-json-no-payload-type"`, use
110
+ [backwards compatible signature] instead. Reject if `sigType` is any other
111
+ non-empty value.
105
112
- Base64-decode `payload`; call this SERIALIZED_BODY. Reject if the decoding
106
113
fails.
107
114
- Base64-decode `sig` and verify PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY).
@@ -122,30 +129,31 @@ valid while avoiding the verifier from having to use [Canonical JSON].
122
129
123
130
```json
124
131
{
125
- "payload": "<Base64(CanonicalJson(BODY))>",
126
- "payloadType": "<URI>/backwards-compatible-json",
132
+ "payload": "<Base64(SERIALIZED_BODY)>",
127
133
"signatures" : [{
128
134
"keyid": "<KEYID>",
129
- "sig": "<Base64(Sign(CanonicalJson(BODY)))>"
135
+ "sigType": "raw-json-no-payload-type",
136
+ "sig" : "<Base64(Sign(SERIALIZED_BODY))>"
130
137
}]
131
138
}
132
139
```
133
140
134
- Support for this backwards compatibility mode is optional.
141
+ Support for this backwards compatibility mode is optional and should be disabled
142
+ by default.
135
143
136
144
To sign:
137
145
138
- - BODY ** must** be an object type (` {...} ` ).
139
- - Serialize BODY as [ Canonical JSON] ; call this SERIALIZED_BODY.
146
+ - The message ** must** be an object type (` {...} ` ).
147
+ - Serialize the message as [ Canonical JSON] ; call this SERIALIZED_BODY.
140
148
- Sign SERIALIZED_BODY, base64-encode the result, and store it in ` sig ` .
149
+ - Store ` "raw-json-no-payload-type" ` in ` sigType ` .
141
150
- Optionally, compute a KEYID and store it in ` keyid ` .
142
151
- Base64-encode SERIALIZED_BODY and store it in ` payload ` .
143
- - Store ` "<URI>/backwards-compatible-json" ` in ` payloadType ` .
144
152
145
153
To verify:
146
154
147
- - If ` payloadType ` != ` "<URI>/backwards-compatible- json"` , use the normal
148
- verification process instead of this one.
155
+ - If ` sigType != "raw- json-no-payload-type "` , use the
156
+ [ normal verification process] ( #steps ) instead of this one.
149
157
- Base64-decode ` payload ` ; call this SERIALIZED_BODY. Reject if the decoding
150
158
fails.
151
159
- Base64-decode ` sig ` and verify SERIALIZED_BODY. Reject if either the
@@ -154,6 +162,7 @@ To verify:
154
162
the result is not a JSON object. In particular, the first byte of
155
163
SERIALIZED_BODY must be ` { ` . Verifiers ** must not** require SERIALIZED_BODY
156
164
to be Canonical JSON.
165
+ - Discard ` payloadType ` if present.
157
166
158
167
Backwards compatible signatures are not recommended because they lack the
159
168
authenticated payloadType indicator.
@@ -334,18 +343,20 @@ To detect whether a signature is in the old or new format:
334
343
To convert an existing signature to the new format:
335
344
336
345
- ` new.payload = base64encode(CanonicalJson(orig.signed)) `
337
- - ` new.payloadType = "<URI>/backwards-compatible- json" `
346
+ - ` new.signatures[*].sigType = "raw- json-no-payload-type " `
338
347
- ` new.signatures[*].sig = base64encode(hexdecode(orig.signatures[*].sig)) `
339
348
- ` new.signatures[*].keyid = orig.signatures[*].keyid `
340
349
341
- To convert a backwards compatible signature to the old format:
350
+ To convert a [ backwards compatible signature] to the old format:
342
351
343
352
- ` old.signed = jsonparse(base64decode(new.payload)) `
344
353
- ` old.signatures[*].sig = hexencode(base64decode(new.signatures[*].sig)) `
345
354
- ` old.signatures[*].keyid = new.signatures[*].keyid `
346
355
347
356
## Testing
348
357
358
+ TODO: Update reference implementation with this new design.
359
+
349
360
See [ reference implementation] ( reference_implementation.ipynb ) . Here is an
350
361
example.
351
362
0 commit comments