From acdcd56ee144972a8d47e92638dc1099e38ef162 Mon Sep 17 00:00:00 2001 From: Thomas Fossati Date: Mon, 10 Feb 2025 14:14:48 +0100 Subject: [PATCH] include JSON examples Signed-off-by: Thomas Fossati --- cddl/Makefile | 7 +++++++ cddl/eat-ex1-json.diag.in | 8 ++++++++ cddl/{eat-ex1.diag => eat-ex1.diag.in} | 2 +- draft-ietf-rats-eat-measured-component.md | 25 ++++++++++++++--------- 4 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 cddl/eat-ex1-json.diag.in rename cddl/{eat-ex1.diag => eat-ex1.diag.in} (91%) diff --git a/cddl/Makefile b/cddl/Makefile index 386a3d1..96c5b01 100644 --- a/cddl/Makefile +++ b/cddl/Makefile @@ -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)" ; \ diff --git a/cddl/eat-ex1-json.diag.in b/cddl/eat-ex1-json.diag.in new file mode 100644 index 0000000..b73558f --- /dev/null +++ b/cddl/eat-ex1-json.diag.in @@ -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\" ] }" + ] + ] +} diff --git a/cddl/eat-ex1.diag b/cddl/eat-ex1.diag.in similarity index 91% rename from cddl/eat-ex1.diag rename to cddl/eat-ex1.diag.in index b15c977..7459192 100644 --- a/cddl/eat-ex1.diag +++ b/cddl/eat-ex1.diag.in @@ -1,7 +1,7 @@ { 273: [ [ - 65000, / using a CoAP C-F from the experimental range / + TBD1, / mc+cbor / << { / id / 1: [ diff --git a/draft-ietf-rats-eat-measured-component.md b/draft-ietf-rats-eat-measured-component.md index f8823e1..18c2ae6 100644 --- a/draft-ietf-rats-eat-measured-component.md +++ b/draft-ietf-rats-eat-measured-component.md @@ -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 @@ -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}