@@ -156,21 +156,127 @@ $ cocli comid display -f m1.cbor \
156156 -d yet-another-comid-folder/
157157```
158158
159+ ## CoTSs manipulation
160+
161+ The ` cots ` subcommand allows you to create, display and validate CoTSs.
162+
163+ ### Create
164+
165+ Use the ` cots create ` subcommand to create a CBOR-encoded CoTS. The ` environment ` switch takes in a JSON template specifiying the environments that are valid for the keys specified and the ` tas ` switch takes in a directory of trust anchors files:
166+ ```
167+ $ cocli cots create --environment c1.json --tas tas_dir
168+ ```
169+ On success, you should see something like the following printed to stdout:
170+ ```
171+ >> created "c1.cbor"
172+ ```
173+
174+ The CBOR-encoded CoTS file is stored in the current working directory with a
175+ name derived from its environment template. If you want, you can specify a different
176+ target directory and file name using the ` --output ` command line switch (abbrev. ` -o ` )
177+ ```
178+ $ cocli cots create --environment c1.json --tas tas_dir --output /tmp/myCots.cbor
179+ >> created "/tmp/myCots.cbor"
180+ ```
181+ Note that the output directory, as well as all its parent directories, MUST pre-exist.
182+
183+ ### Display
184+
185+ Use the ` cots display ` subcommand to print to stdout one or more CBOR-encoded
186+ CoTSs in human readable (JSON) format.
187+
188+ You can supply individual files using the ` --file ` switch (abbrev. ` -f ` ), or
189+ directories that may (or may not) contain CoTS files using the ` --dir ` switch
190+ (abbrev. ` -d ` ). Only valid CoTSs will be displayed, and any decoding or
191+ validation error will be printed alongside the corresponding file name.
192+
193+ For example:
194+ ```
195+ $ cocli cots display --file c1.cbor
196+ ```
197+ provided the ` c1.cbor ` file contains valid CoTS, would print something like:
198+ ```
199+ >> [c1.cbor]
200+ {
201+ "tag-identity": {
202+ "id": "ab0f44b1-bfdc-4604-ab4a-30f80407ebcc",
203+ "version": 5
204+ },
205+ "environments": [
206+ {
207+ "environment": {
208+ "class": {
209+ "vendor": "Worthless Sea, Inc."
210+ }
211+ }
212+ }
213+ ],
214+ "keys": {
215+ "tas": [
216+ {
217+ "format": 2,
218+ "data": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAErYoMAdqe2gJT3CvCcifZxyE9+N8T6Jy5zbeo5LYtnOipmi1wXA9/gNtlwAbRCRQitH/GEcvUaGlzPZxIOITV/g=="
219+ }
220+ ]
221+ }
222+ }
223+ ```
224+ While a ` cots ` folder with the following contents:
225+ ```
226+ $ tree cots/
227+ cots/
228+ ├── rubbish.cbor
229+ ├── valid-cots-1.cbor
230+ ├── valid-cots-2.cbor
231+ ```
232+ could be inspected in one go using:
233+ ```
234+ $ cocli cots display --dir cots/
235+ ```
236+ which would output something like:
237+ ```
238+ >> failed displaying "cots/rubbish.cbor": CBOR decoding failed: EOF
239+ >> [cots/valid-cots-1.cbor]
240+ {
241+ "tag-identity": {
242+ "id": "43bbe37f-2e61-4b33-aed3-53cff1428b16"
243+ },
244+ [...]
245+ }
246+ >> [cots/valid-cots-2.cbor]
247+ {
248+ "tag-identity": {
249+ "id": "ab0f44b1-bfdc-4604-ab4a-30f80407ebcc"
250+ },
251+ [...]
252+ }
253+ Error: 1/3 display(s) failed
254+ ```
255+
256+ One of more files and directories can be supplied in the same invocation, e.g.:
257+ ```
258+ $ cocli cots display -f c1.cbor \
259+ -f cots/c2.cbor \
260+ -d /var/spool/cots \
261+ -d yet-another-cots-folder/
262+ ```
263+
264+
159265## CoRIMs manipulation
160266
161267The ` corim ` subcommand allows you to create, display, sign, verify CoRIMs or submit
162268a CoRIM using the [ Veraison provisioning API] ( https://github.com/veraison/docs/tree/main/api/endorsement-provisioning ) .
163- It also provides a means to extract as-is the embedded CoSWIDs and CoMIDs and save
269+ It also provides a means to extract as-is the embedded CoSWIDs, CoMIDs and CoTSs and save
164270them as separate files.
165271
166272### Create
167273
168274Use the ` corim create ` subcommand to create a CBOR-encoded, unsigned CoRIM, by
169275passing its JSON representation<sup >[ 1] ( #templates-ex ) </sup > via the
170276` --template ` switch (or equivalently its ` -t ` shorthand) together with the
171- CBOR-encoded CoMIDs and/or CoSWIDs to be embedded. For example:
277+ CBOR-encoded CoMIDs, CoSWIDs and/or CoTS to be embedded. For example:
172278```
173- $ cocli corim create --template c1.json --comid m1.cbor --coswid s1.cbor
279+ $ cocli corim create --template c1.json --comid m1.cbor --coswid s1.cbor --cots c1.cbor
174280```
175281On success, you should see something like the following printed to stdout:
176282```
@@ -181,14 +287,14 @@ The CBOR-encoded CoRIM file is stored in the current working directory with a
181287name derived from its template. If you want, you can specify a different
182288file name using the ` --output ` command line switch (abbrev. ` -o ` ):
183289```
184- $ cocli corim create -t c1 .json -m m1.cbor -s s1.cbor -o my.cbor
185- >> created "my.cbor" from "c1 .json"
290+ $ cocli corim create -t r1 .json -m m1.cbor -s s1.cbor -c c1 .cbor -o my.cbor
291+ >> created "my.cbor" from "r1 .json"
186292```
187293
188- CoMIDs and CoSWIDs can be either supplied as individual files, using the
189- ` --comid ` (abbrev. ` -m ` ) and ` --coswid ` (abbrev. ` -s ` ) switches respectively, or
190- as "per-folder" blocks using the ` --comid-dir ` (abbrev. ` -M ` ) and ` --coswid -dir `
191- (abbrev. ` -S ` ) switch. For example:
294+ CoMIDs, CoSWIDs and CoTSs can be either supplied as individual files, using the
295+ ` --comid ` (abbrev. ` -m ` ), ` --coswid ` (abbrev. ` -s ` ) and ` --cots ` (abbrev. ` -c ` ) switches respectively, or
296+ as "per-folder" blocks using the ` --comid-dir ` (abbrev. ` -M ` ), ` --coswid-dir ` and ` --cots -dir `
297+ (abbrev. ` -C ` ) switch. For example:
192298```
193299$ cocli corim create --template c1.json --comid-dir comids.d/
194300```
@@ -279,7 +385,7 @@ Corim:
279385}
280386```
281387
282- By default, the embedded CoMID and CoSWID tags are not expanded, and what you
388+ By default, the embedded CoMID, CoSWID and CoTS tags are not expanded, and what you
283389will see is the base64 encoding of their CBOR serialisation. If you want to
284390peek at the tags' content, supply the ` --show-tags ` (abbrev. ` -v ` ) switch, which
285391will add a further Tags section with one entry per each expanded tag:
@@ -331,32 +437,152 @@ $ cocli corim submit \
331437>> "corim.cbor" submit ok
332438```
333439
334- ### Extract CoSWIDs and CoMIDs
440+ ### Extract CoSWIDs, CoMIDs and CoTSs
335441
336- Use the ` corim extract ` subcommand to extract the embedded CoMIDs and CoSWIDs
442+ Use the ` corim extract ` subcommand to extract the embedded CoMIDs, CoSWIDs and CoTSs
337443from a signed CoRIM.
338444
339445You must supply a signed CoRIM file using the ` --file ` switch (abbrev. ` -f ` ) and
340446an optional output folder (default is the current working directory) using the
341447` --output-dir ` switch (abbrev. ` -o ` ). Make sure that the output directory as
342448well as any parent folder exists prior to issuing the command.
343449
344- On success, the found CoMIDs and CoSWIDs are saved in CBOR format:
450+ On success, the found CoMIDs, CoSWIDs, CoTS are saved in CBOR format:
345451```
346452$ cocli corim extract --file signed-corim.cbor --output-dir output.d/
347453$ tree output.d/
348454output.d/
349455├── 000000-comid.cbor
350456├── 000001-comid.cbor
351- └── 000002-coswid.cbor
457+ ├── 000002-coswid.cbor
458+ └── 000003-cots.cbor
352459```
353460
354461
355462
356- <a name =" templates-ex " >1</a >: A few examples of CoMID, CoRIM, and Meta JSON
463+ <a name =" templates-ex " >1</a >: A few examples of CoMID, CoRIM, CoTS, and Meta JSON
357464templates can be found in the [ data/templates] ( data/templates ) folder.
358465
359466
360467## Visual Synopsis of the Available Commands
361468
362- ![ visual map] ( data/pics/cocli-map.png )
469+ ``` mermaid
470+ graph LR
471+ OEM[(OEM/ODM \n DB)]
472+ JSONTmplCoMID[["JSON \n template \n (CoMID)"]]
473+
474+ JSONTmplCoSWID[["JSON \n template \n (CoSWID)"]]
475+ style JSONTmplCoSWID fill:#71797E
476+ click JSONTmplCoSWID "https://github.com/veraison/corim/issues/81"
477+
478+ JSONTmplCoRIM[["JSON \n template \n (CoRIM)"]]
479+ JSONTmplMeta[["JSON \n template \n (Meta)"]]
480+ key((key))
481+
482+ %% Cots nodes
483+ environments[["Environments"]]
484+ tas(("Trust \n anchors"))
485+ cas(("CA \n certificates"))
486+ permClaims[["Permanant claims"]]
487+ exclClaims[["Excluded claims"]]
488+
489+ cliComidCreate($ cocli comid create)
490+ cliComidDisplay($ cocli comid display)
491+ style cliComidCreate fill:#00758f
492+ style cliComidDisplay fill:#00758f
493+
494+ cliCotsCreate($ cocli cots create)
495+ cliCotsDisplay($ cocli cots display)
496+ style cliCotsCreate fill:#00758f
497+ style cliCotsDisplay fill:#00758f
498+
499+ cliCoswidCreate($ cocli coswid create)
500+ cliCoswidDisplay($ cocli coswid display)
501+ style cliCoswidCreate fill:#71797E
502+ style cliCoswidDisplay fill:#71797E
503+
504+
505+ cliCorimCreate($ cocli corim create)
506+ cliCorimSign($ cocli corim sign)
507+ cliCorimVerify($ cocli corim verify)
508+ cliCorimExtract($ cocli corim extract)
509+ cliCorimDisplay($ cocli corim display)
510+ cliCorimSubmit($ cocli corim submit)
511+ style cliCorimCreate fill:#00758f
512+ style cliCorimSign fill:#00758f
513+ style cliCorimVerify fill:#00758f
514+ style cliCorimExtract fill:#00758f
515+ style cliCorimDisplay fill:#00758f
516+ style cliCorimSubmit fill:#00758f
517+
518+ provisioningEndpoint{{Veraison \n Provisioning \n Service}}
519+
520+ CBORComid1((CBOR <br /> CoMID))
521+ CBORSwid1((CBOR <br /> SWID))
522+ CBORCots1((CBOR <br /> CoTS))
523+
524+ CBORComid2((CBOR <br /> CoMID))
525+ CBORSwid2((CBOR <br /> SWID))
526+ CBORCots2((CBOR <br /> CoTS))
527+
528+ CBORCorim((CBOR CoRIM))
529+ CoseSign1((COSE Sign1 CoRIM))
530+ signBool((T/F))
531+
532+ OEM --> JSONTmplCoMID
533+ OEM --> JSONTmplCoSWID
534+
535+ %% Cots items provisioning
536+ OEM --> environments
537+ OEM --> tas
538+ OEM --> cas
539+ OEM --> permClaims
540+ OEM --> exclClaims
541+
542+ OEM --> JSONTmplCoRIM
543+ OEM --> JSONTmplMeta
544+ OEM --> key
545+
546+ %% Cots individual items
547+ environments --> cliCotsCreate
548+ tas --> cliCotsCreate
549+ cas --> cliCotsCreate
550+ permClaims --> cliCotsCreate
551+ exclClaims --> cliCotsCreate
552+
553+
554+ JSONTmplCoMID --> cliComidCreate
555+ JSONTmplCoSWID --> cliCoswidCreate
556+ JSONTmplCoRIM --> cliCorimCreate
557+ JSONTmplMeta --> cliCorimSign
558+ key --> cliCorimSign
559+ key --> cliCorimVerify
560+
561+ cliComidCreate --> CBORComid1
562+ cliCotsCreate --> CBORCots1
563+ cliCoswidCreate --> CBORSwid1
564+
565+ cliCorimCreate --> CBORCorim
566+ cliCorimSign --> CoseSign1
567+ cliCorimVerify --> signBool
568+ cliCorimSubmit -- to--> provisioningEndpoint
569+
570+ CBORComid1 --> cliComidDisplay
571+ CBORComid1 --> cliCorimCreate
572+
573+ CBORCots1 --> cliCorimCreate
574+ CBORCots1 --> cliCotsDisplay
575+
576+ CBORSwid1 --> cliCoswidDisplay
577+ CBORSwid1 --> cliCorimCreate
578+
579+ CBORCorim --> cliCorimSubmit
580+ CBORCorim --> cliCorimSign
581+ CoseSign1 --> cliCorimExtract
582+ CoseSign1 --> cliCorimVerify
583+ CoseSign1 --> cliCorimDisplay
584+
585+ cliCorimExtract --> CBORComid2
586+ cliCorimExtract --> CBORSwid2
587+ cliCorimExtract --> CBORCots2
588+ ```
0 commit comments