Skip to content

Commit

Permalink
include JSON examples
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Fossati <[email protected]>
  • Loading branch information
thomas-fossati committed Feb 10, 2025
1 parent c47d0a2 commit acdcd56
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
7 changes: 7 additions & 0 deletions cddl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,18 @@ check-examples: $(JSON_EXAMPLES) $(CBOR_EXAMPLES) $(CDDL)

MCEAT_CDDL := mc+eat.cddl
MCEAT_DIAG_EXAMPLES := eat-ex1.diag
MCEAT_DIAG_EXAMPLES += eat-ex1-json.diag
MCEAT_CBOR_EXAMPLES := $(MCEAT_DIAG_EXAMPLES:.diag=.cbor)

$(MCEAT_CDDL): minimal-eat.cddlc eat-plug.cddl $(CDDL)
cddlc -2 -sClaims-Set -tcddl -Imeasured-component $< > $@

eat-ex1.diag: eat-ex1.diag.in ; sed -e 's/TBD1/65000/' $< > $@
eat-ex1-json.diag: eat-ex1-json.diag.in ; sed -e 's/TBD2/65001/' $< > $@

CLEANFILES += eat-ex1.diag
CLEANFILES += eat-ex1-json.diag

mceat-check-examples: $(MCEAT_CBOR_EXAMPLES) $(MCEAT_CDDL)
@for f in $(MCEAT_CBOR_EXAMPLES); do \
echo ">> validating $$f against $(MCEAT_CDDL)" ; \
Expand Down
8 changes: 8 additions & 0 deletions cddl/eat-ex1-json.diag.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"measurements": [
[
TBD2, / mc+json /
"{ \"id\": [ \"boot loader X\", [ \"1.2.3rc2\", 16384 ] ], \"measurement\": [ \"sha-256\", \"OZYAPUhvuR_7BW99A_KymSshWzHb569LNzQx_H0xnaM\" ], \"signers\": [ \"SS6bZ2wh9gErHO65Ay_rQUGogHlzVfZnUBXsWcUcoew\", \"Qne7l7p7UVd6DTgVHT4ItAvflGdT9bW964FNb_V6il4\" ] }"
]
]
}
2 changes: 1 addition & 1 deletion cddl/eat-ex1.diag → cddl/eat-ex1.diag.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
273: [
[
65000, / using a CoAP C-F from the experimental range /
TBD1, / mc+cbor /
<<
{
/ id / 1: [
Expand Down
25 changes: 15 additions & 10 deletions draft-ietf-rats-eat-measured-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,12 +218,6 @@ Note the use of the "native" and "tunnel" formats from {{fig-eat-plug}}, and how

# Examples

> **NOTE:**
> The examples are CBOR only.
> JSON examples will be added in a future version of this document.
>
> Tracking issue: https://github.com/ietf-rats-wg/draft-ietf-rats-eat-measured-component/issues/18

The example in {{ex-1}} is a measured component with all the fields populated.

~~~ cbor-edn
Expand All @@ -233,14 +227,25 @@ The example in {{ex-1}} is a measured component with all the fields populated.

The example in {{ex-eat-1}} is the same measured component as above but used as the format of a `measurements` claim in a EAT claims-set.

Note that the example uses a CoAP Content-Format value from the experimental range (65000), which will change to the value assigned by IANA for the `application/measured-component+cbor` Content-Format.
The example uses TBD1 as the `content-type` value of the `measurements-format` entry.
(This will change to the value assigned by IANA to the `mc+cbor` Content-Format.)

Note that the array contains only one measured component, but additional entries could be added if the measured TCB is made of multiple, individually measured components.

~~~ cbor-edn
{::include cddl/eat-ex1.diag.in}
~~~
{: #ex-eat-1 title="EAT Measurements Claim using a Measured Component (CBOR)"}

The example in {{ex-eat-2}} illustrates the inclusion of a JSON measured component inside a JSON EAT.

Note also that the array contains only one measured component, but additional entries could be added if the measured TCB is made of multiple, individually measured components.
The example uses TBD2 as the `content-type` value of the `measurements-format` entry.
(This will change to the value assigned by IANA to the `mc+json` Content-Format.)

~~~ cbor-edn
{::include cddl/eat-ex1.diag}
{::include-fold cddl/eat-ex1-json.diag.in}
~~~
{: #ex-eat-1 title="EAT Measurements Claim using a Measured Component"}
{: #ex-eat-2 title="EAT Measurements Claim using a Measured Component (JSON)"}

# Security and Privacy Considerations {#seccons}

Expand Down

0 comments on commit acdcd56

Please sign in to comment.