Commit 3aec76f
Add COSE support to Rekor (sigstore#867)
* WIP: Add COSE support to Rekor
This commit adds COSE Sign1 support to rekor via a new data type.
COSE is defined in RFC8152, and provides a signing message envelope.
This is supported in rekor using the veraison/go-cose library. The new
API type requires the signed content, the signature envelope, and the public key.
The public key is in the standard rekor PKI format, at the moment only ECDSA P256
with SHA256 is supported. The signed message only supports in-line bodies (no URL fetching),
and there is no support for pre-hashed entries.
Signed-off-by: Dan Lorenc <lorenc.d@gmail.com>
* Completed basic support for COSE records.
This adds some more functionality related to COSE enveleopes.
Features added are:
- Support for specifying Additional Authentincated Data (AAD)
- The entire CBOR envelope is stored as an attestation
- If the payload type is an in-toto statement, subject is indexed
What's not optimal is that the COSE envelope is using the regular
`Attestion()` functionality, which means that rekor cli tries to
print it during `rekor-cli get` and the response record from Rekor
looks a bit awkward.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Updated the documentation for COSE envelopes.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Resolved merge conflicts with main.
The biggest change is adapting the new interface where attestation func
is split to two, one to get the key and a nother to get key/val.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Ran go mod tidy after resolving merge committs.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Added check to see that provided EC key uses the P256 curve.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Spelled out aad when printing the help message.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Updated copyright notice to have current (2022) year.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Removed direct dependency on github.com/pkg/errors and replaced with stdlib
errors package.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Fixed a bug where nil was wrongfully returned instead of err.
Also increas the general test coverage.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Changed aad in artifact properties struct to be []byte instead of string.
This gives the caller the possibility to decide how to decode the data.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Fixed a warning from the linter.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* Added test case for malformed base64 aad parameter.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
* During signature validation, do not store any state until entire validation
is done.
Signed-off-by: Fredrik Skogman <kommendorkapten@github.com>
Co-authored-by: Dan Lorenc <lorenc.d@gmail.com>1 parent bd717e7 commit 3aec76f
File tree
25 files changed
+2253
-10
lines changed- cmd
- rekor-cli/app
- rekor-server/app
- pkg
- generated/models
- types
- cose
- v0.0.1
- tests
25 files changed
+2253
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| 50 | + | |
50 | 51 | | |
51 | 52 | | |
52 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
| |||
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
155 | 165 | | |
156 | 166 | | |
157 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
46 | 47 | | |
47 | 48 | | |
48 | 49 | | |
| 50 | + | |
49 | 51 | | |
50 | 52 | | |
51 | 53 | | |
| |||
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
108 | 114 | | |
109 | 115 | | |
110 | 116 | | |
| |||
239 | 245 | | |
240 | 246 | | |
241 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
242 | 255 | | |
243 | 256 | | |
244 | 257 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
349 | 376 | | |
350 | 377 | | |
351 | 378 | | |
| |||
384 | 411 | | |
385 | 412 | | |
386 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
387 | 417 | | |
388 | 418 | | |
389 | 419 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
| 72 | + | |
69 | 73 | | |
70 | 74 | | |
71 | 75 | | |
| |||
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
98 | | - | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
| |||
108 | 111 | | |
109 | 112 | | |
110 | 113 | | |
111 | | - | |
| 114 | + | |
112 | 115 | | |
113 | 116 | | |
114 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| 478 | + | |
| 479 | + | |
478 | 480 | | |
479 | 481 | | |
480 | 482 | | |
| |||
1582 | 1584 | | |
1583 | 1585 | | |
1584 | 1586 | | |
| 1587 | + | |
| 1588 | + | |
1585 | 1589 | | |
1586 | 1590 | | |
1587 | 1591 | | |
1588 | 1592 | | |
1589 | 1593 | | |
1590 | 1594 | | |
1591 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
1592 | 1598 | | |
1593 | 1599 | | |
1594 | 1600 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
378 | 378 | | |
379 | 379 | | |
380 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
381 | 398 | | |
382 | 399 | | |
383 | 400 | | |
| |||
0 commit comments