Skip to content

Commit

Permalink
Realing CoTS directory structures
Browse files Browse the repository at this point in the history
Signed-off-by: Yogesh Deshpande <[email protected]>
  • Loading branch information
yogeshbdeshpande committed Dec 14, 2023
1 parent 14b474a commit 962d71a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 35 deletions.
21 changes: 21 additions & 0 deletions cocli/CORIM.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,25 @@ Tags:
"tag-id": "com.acme.rrd2013-ce-sp1-v4-1-5-0",
[...]
}
```

### Extract CoSWIDs, CoMIDs and CoTSs

Use the `corim extract` subcommand to extract the embedded CoMIDs, CoSWIDs and CoTSs
from a signed CoRIM.

You must supply a signed CoRIM file using the `--file` switch (abbrev. `-f`) and
an optional output folder (default is the current working directory) using the
`--output-dir` switch (abbrev. `-o`). Make sure that the output directory as
well as any parent folder exists prior to issuing the command.

On success, the found CoMIDs, CoSWIDs, CoTS are saved in CBOR format:
```
$ cocli corim extract --file signed-corim.cbor --output-dir output.d/
$ tree output.d/
output.d/
├── 000000-comid.cbor
├── 000001-comid.cbor
├── 000002-coswid.cbor
└── 000003-cots.cbor
```
31 changes: 3 additions & 28 deletions cocli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ To get a list of the supported shells, do:
```
$ cocli completion --help
```
# CoRIM Construction
A CoRIM consists of either one or more CoMID and/or CoSWID and/or CoTS. Hence the below
instructions need to be followed in the order.
# CoRIM Handling
A CoRIM consists of either one or more CoMID and/or CoSWID and/or CoTS. The below
instructions provides a step by step approach to handle CoRIMs.

## CoMIDs manipulation
The instructions to manipulate CoMIDs are documented [here](COMID.md)
Expand Down Expand Up @@ -65,31 +65,6 @@ path (usually `~/.config/cocli/config.yaml` on XDG-compliant systems). Please
see `./data/config/example-config.yaml` file for details of the configuration
that needs to be provided.

### Extract CoSWIDs, CoMIDs and CoTSs

Use the `corim extract` subcommand to extract the embedded CoMIDs, CoSWIDs and CoTSs
from a signed CoRIM.

You must supply a signed CoRIM file using the `--file` switch (abbrev. `-f`) and
an optional output folder (default is the current working directory) using the
`--output-dir` switch (abbrev. `-o`). Make sure that the output directory as
well as any parent folder exists prior to issuing the command.

On success, the found CoMIDs, CoSWIDs, CoTS are saved in CBOR format:
```
$ cocli corim extract --file signed-corim.cbor --output-dir output.d/
$ tree output.d/
output.d/
├── 000000-comid.cbor
├── 000001-comid.cbor
├── 000002-coswid.cbor
└── 000003-cots.cbor
```

<a name="templates-ex">1</a>: A few examples of CoMID, CoRIM, CoTS, and Meta JSON
templates can be found in the [data/templates](data/templates) folder.


## Visual Synopsis of the Available Commands

```mermaid
Expand Down
14 changes: 7 additions & 7 deletions cocli/cmd/cotsCreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Test_CotsCreateCtsCmd_too_many_ids(t *testing.T) {
"--output=output.cbor",
"--uuid",
"--id=some_tag_identity",
"--environment=../data/cots/env/vendor.json",
"--environment=../data/cots/templates/env/vendor.json",
"--tafile=../data/cots/shared_ta.ta",
}
cmd.SetArgs(args)
Expand All @@ -76,7 +76,7 @@ func Test_CotsCreateCtsCmd_invalid_uuid(t *testing.T) {
args := []string{
"--output=output.cbor",
"--uuid-str=NotAUuid",
"--environment=../data/cots/env/vendor.json",
"--environment=../data/cots/templates/env/vendor.json",
"--tafile=../data/cots/shared_ta.ta",
}
cmd.SetArgs(args)
Expand Down Expand Up @@ -104,7 +104,7 @@ func Test_CotsCreateCtsCmd_loading_permclaims_template_fail(t *testing.T) {

args := []string{
"--output=output.cbor",
"--environment=../data/cots/env/vendor.json",
"--environment=../data/cots/templates/env/vendor.json",
"--permclaims=nonexistent.json",
"--tafile=../data/cots/shared_ta.ta",
}
Expand All @@ -119,7 +119,7 @@ func Test_CotsCreateCtsCmd_loading_exclclaims_template_fail(t *testing.T) {

args := []string{
"--output=output.cbor",
"--environment=../data/cots/env/vendor.json",
"--environment=../data/cots/templates/env/vendor.json",
"--exclclaims=nonexistent.json",
"--tafile=../data/cots/shared_ta.ta",
}
Expand All @@ -134,9 +134,9 @@ func Test_CotsCreateCtsCmd_ok(t *testing.T) {

args := []string{
"--output=output.cbor",
"--environment=../data/cots/env/vendor.json",
"--exclclaims=../data/cots/claims/exclclaim.json",
"--permclaims=../data/cots/claims/permclaim.json",
"--environment=../data/cots/templates/env/vendor.json",
"--exclclaims=../data/cots/templates/claims/exclclaim.json",
"--permclaims=../data/cots/templates/claims/permclaim.json",
"--tafile=../data/cots/shared_ta.ta",
}
cmd.SetArgs(args)
Expand Down

0 comments on commit 962d71a

Please sign in to comment.