Skip to content

Commit 5950b31

Browse files
authored
Merge pull request #12 from MarkLodato/cleanups
Minor cleanups to the specification
2 parents e6ae241 + cb8467e commit 5950b31

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

specification.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# $signing_spec
22

3-
A signature scheme for software supply chain metadata that avoids canonicalization
3+
A signature scheme for software supply chain metadata that avoids
4+
canonicalization
45

56
November 25, 2020
67

@@ -33,7 +34,7 @@ The signature format is a JSON message of the following form:
3334
"payloadType": "<PAYLOAD_TYPE>",
3435
"signatures": [{
3536
"keyid": "<KEYID>",
36-
"sig": "<Base64(Sign(PAE([UTF8(PAYLOAD_TYPE), SERIALIZED_BODY])))>"
37+
"sig": "<Base64(Sign(PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY)))>"
3738
}]
3839
}
3940
```
@@ -70,7 +71,7 @@ Functions:
7071
where parameters `type` and `body` are byte sequences:
7172

7273
```none
73-
PAE([type, body]) := le64(2) || le64(len(type)) || type || le64(len(body)) || body
74+
PAE(type, body) := le64(2) || le64(len(type)) || type || le64(len(body)) || body
7475
le64(n) := 64-bit little-endian encoding of `n`, where 0 <= n < 2^63
7576
```
7677
@@ -87,11 +88,17 @@ Functions:
8788
8889
### Steps
8990
91+
Out of band:
92+
93+
- Agree on a PAYLOAD_TYPE and cryptographic details.
94+
- Decide if [backwards compatible signature] mode should be allowed.
95+
9096
To sign:
9197
92-
- Serialize BODY according to PAYLOAD_TYPE. Call the result SERIALIZED_BODY.
93-
- Sign PAE([UTF8(PAYLOAD_TYPE), SERIALIZED_BODY]), base64-encode the result,
94-
and store it in `sig`.
98+
- Serialize the message according to PAYLOAD_TYPE. Call the result
99+
SERIALIZED_BODY.
100+
- Sign PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY), base64-encode the result, and
101+
store it in `sig`.
95102
- Optionally, compute a KEYID and store it in `keyid`.
96103
- Base64-encode SERIALIZED_BODY and store it in `payload`.
97104
- Store PAYLOAD_TYPE in `payloadType`.
@@ -100,8 +107,9 @@ To verify:
100107
101108
- Base64-decode `payload`; call this SERIALIZED_BODY. Reject if the decoding
102109
fails.
103-
- Base64-decode `sig` and verify PAE([UTF8(PAYLOAD_TYPE), SERIALIZED_BODY]).
110+
- Base64-decode `sig` and verify PAE(UTF8(PAYLOAD_TYPE), SERIALIZED_BODY).
104111
Reject if either the decoding or the signature verification fails.
112+
- Reject if PAYLOAD_TYPE is not a supported type.
105113
- Parse SERIALIZED_BODY according to PAYLOAD_TYPE. Reject if the parsing
106114
fails.
107115
@@ -297,14 +305,14 @@ Rationales for specific decisions:
297305
2. It would incur double base64 encoding overhead for non-JSON payloads.
298306
3. It is more complex than PAE.
299307

300-
## Backwards Compatibility
308+
## Backwards compatibility with existing TUF and in-toto signatures
301309

302310
### Current format
303311

304312
The
305-
[current signature format](https://github.com/in-toto/docs/blob/master/in-toto-spec.md#42-file-formats-general-principles)
306-
used by TUF and in-toto has a BODY that is a regular JSON object and a signature over the
307-
[Canonical JSON] serialization of BODY.
313+
[old signature format](https://github.com/in-toto/docs/blob/master/in-toto-spec.md#42-file-formats-general-principles)
314+
used by TUF and in-toto has a BODY that is a regular JSON object and a signature
315+
over the [Canonical JSON] serialization of BODY.
308316

309317
```json
310318
{
@@ -344,7 +352,7 @@ To convert a backwards compatible signature to the old format:
344352
See [reference implementation](reference_implementation.ipynb). Here is an
345353
example.
346354

347-
BODY:
355+
SERIALIZED_BODY:
348356

349357
```none
350358
hello world
@@ -385,10 +393,11 @@ Signed wrapper:
385393

386394
## References
387395

388-
- [Canonical JSON]
389-
- [JWS]
390-
- [PASETO]
396+
- [Canonical JSON]
397+
- [JWS]
398+
- [PASETO]
391399

400+
[backwards compatible signature]: #backwards-compatible-signatures
392401
[Canonical JSON]: http://wiki.laptop.org/go/Canonical_JSON
393402
[JWS]: https://tools.ietf.org/html/rfc7515
394403
[PASETO]: https://github.com/paragonie/paseto/blob/master/docs/01-Protocol-Versions/Version2.md#sig

0 commit comments

Comments
 (0)