Skip to content

Commit

Permalink
drop tunnels (#165)
Browse files Browse the repository at this point in the history
Fix #163

Signed-off-by: Thomas Fossati <[email protected]>
  • Loading branch information
thomas-fossati authored Jan 30, 2025
1 parent 31c1f24 commit a9fe697
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 57 deletions.
4 changes: 2 additions & 2 deletions cddl/cmw-collection.cddl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
json-collection = {
? "__cmwc_t": ~uri / oid
+ &(label: text) => json-cmw / c2j-tunnel
+ &(label: text) => json-cmw
}

cbor-collection = {
? "__cmwc_t": ~uri / oid
+ &(label: (int / text)) => cbor-cmw / j2c-tunnel
+ &(label: (int / text)) => cbor-cmw
}
2 changes: 0 additions & 2 deletions cddl/cmw-tunnel.cddl

This file was deleted.

5 changes: 3 additions & 2 deletions cddl/collection-example-2.diag
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
],
/ attester B / 1: 1668576935(h'2347da55'),
/ attester C / 2: [
"#cmw-j2c-tunnel",
'[ "application/eat+jwt", "Li4u", 8 ]'
"application/eat+jwt",
h'2e2e2e',
8
]
}
7 changes: 4 additions & 3 deletions cddl/collection-example-2.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"e30K",
4
],
"attester B (tunnelled)": [
"#cmw-c2j-tunnel",
"g3gYYXBwbGljYXRpb24vZWF0LXVjcytjYm9yQaAE"
"attester B": [
"application/eat-ucs+cbor",
"oA",
4
]
}
7 changes: 4 additions & 3 deletions cddl/eat-example-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
"e30K",
4
],
"attester B (tunnelled)": [
"#cmw-c2j-tunnel",
"g3gYYXBwbGljYXRpb24vZWF0LXVjcytjYm9yQaAE"
"attester B": [
"application/eat-ucs+cbor",
"oA",
4
]
},
"iss": "evidence collection daemon",
Expand Down
3 changes: 0 additions & 3 deletions cddl/frags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ CMW_FRAGS := cmw-start.cddl
CMW_FRAGS += cmw-record.cddl
CMW_FRAGS += cmw-cbor-tag.cddl
CMW_FRAGS += cmw-collection.cddl
CMW_FRAGS += cmw-tunnel.cddl
CMW_FRAGS += common-types.cddl
CMW_FRAGS += rfc9193.cddl
# CBOR tags used in examples
Expand All @@ -25,7 +24,6 @@ EAT_FRAGS := eat-start.cddl
EAT_FRAGS += cmw-start.cddl
EAT_FRAGS += cmw-record.cddl
EAT_FRAGS += cmw-collection.cddl
EAT_FRAGS += cmw-tunnel.cddl
EAT_FRAGS += common-types.cddl
EAT_FRAGS += rfc9193.cddl

Expand All @@ -35,6 +33,5 @@ COLLECTED_CDDL_FRAGS := cmw-start.cddl
COLLECTED_CDDL_FRAGS += cmw-record.cddl
COLLECTED_CDDL_FRAGS += cmw-cbor-tag.cddl
COLLECTED_CDDL_FRAGS += cmw-collection.cddl
COLLECTED_CDDL_FRAGS += cmw-tunnel.cddl
COLLECTED_CDDL_FRAGS += common-types.cddl
COLLECTED_CDDL_FRAGS += rfc9193.cddl
47 changes: 5 additions & 42 deletions draft-ietf-rats-msg-wrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,9 @@ This document reuses the terms defined in {{Section 2 of -senml-cf}}

# Conceptual Message Wrappers

A RATS Conceptual Message Wrapper (CMW) has a tree structure of leaves that contain payload messages associated with their content type.
The two leaf node types are:

* A CMW using a CBOR or JSON record ({{type-n-val}});
* A CMW based on CBOR tags ({{cbor-tag}}).

Intermediate tree nodes are either:

* A CMW "collection" type that holds together multiple CMW items ({{cmw-coll}});
* A CMW "tunnel" type that allows transporting CBOR CMWs in JSON collections and vice-versa ({{cmw-tunnel}}).
A RATS Conceptual Message Wrapper (CMW) has a tree structure.
Leaf nodes are of type "record" ({{type-n-val}}), or "CBOR tag" ({{cbor-tag}}).
Intermediate nodes are of type "collection" ({{cmw-coll}}; they hold together multiple CMW items.

The following snippet outlines the productions associated with the top-level types.

Expand Down Expand Up @@ -268,7 +261,7 @@ Although originally designed to support layered Attester and composite device us
For instance, collections may be used to group Endorsements, Reference Values, Attestation Results, and more.
A single CMW collection can contain a mix of different message types, and it can also be used to carry messages related to multiple devices simultaneously.

The CMW collection ({{fig-cddl-collection}}) is defined as a CBOR map or JSON object with CMW values, either native or "tunnelled" ({{cmw-tunnel}}).
The CMW collection ({{fig-cddl-collection}}) is defined as a CBOR map or JSON object containing CMW values.
The position of a `cmw` entry in the `cmw-collection` is not significant.
Labels can be strings (or integers in the CBOR serialization) that serve as a mnemonic for different conceptual messages in the collection.

Expand Down Expand Up @@ -301,34 +294,6 @@ A CMW Collection's tree structure is not required to be a spanning tree of the s
If the labels carry semantic content for a Verifier (e.g. to improve Verifier performance or aid human comprehension), the collection SHOULD be integrity protected.
For example, the collection can be integrity protected by including it in a signed token such as a CWT or JWT.

### CMW Tunnel {#cmw-tunnel}

The CMW tunnel type ({{fig-cddl-tunnel}}) allows for moving a CMW in one serialization format, either JSON or CBOR, into a collection that uses the opposite serialization format.

Both tunnel types are arrays with two elements.
The first element, a fixed text string starting with a `#`, acts as a sentinel value.
The `#`, which is not an acceptable start symbol for the `Content-Type` production ({{collected-cddl}}), makes it possible to disambiguate a CMW tunnel from a CMW record.

~~~ cddl
{::include cddl/cmw-tunnel.cddl}
~~~
{: #fig-cddl-tunnel artwork-align="left"
title="CDDL definition of the CMW tunnel format"}

The conversion algorithms are described in the following subsections.

#### CBOR-to-JSON

The CBOR byte string of the serialised CBOR CMW is encoded as Base64 using the URL and filename safe alphabet ({{Section 5 of -base64}}) without padding.
The obtained string is added as the second element of the `c2j-tunnel` array.
The `c2j-tunnel` array is serialized as JSON.

#### JSON-to-CBOR

The UTF-8 string of the serialized JSON CMW is encoded as a CBOR byte string (Major type 2).
The byte string is added as the second element of the `j2c-tunnel` array.
The `j2c-tunnel` array is serialized as CBOR.

## Decapsulation Algorithm

Once any external framing is removed (for example, if the CMW is carried in a certificate extension), the CMW decoder performs a 1-byte lookahead to determine how to decode the remaining byte buffer.
Expand Down Expand Up @@ -450,7 +415,7 @@ END

Section 6.1.8 of {{DICE-arch}} specifies the ConceptualMessageWrapper (CMW) format and its corresponding object identifier.
The CMW format outlined in {{DICE-arch}} permits only a subset of the CMW grammar defined in this document.
In particular, the tunnel and collection formats cannot be encoded using DICE CMWs.
In particular, the collection format cannot be encoded using DICE CMWs.

# Examples

Expand Down Expand Up @@ -527,7 +492,6 @@ lication/signed-corim+cbor"
## CBOR Collection

The following example is a CBOR collection that assembles conceptual messages from three attesters: Evidence for attesters A and B and Attestation Results for attester C.
Since attester C returns Attestation Results as CMW in JSON record format, the JSON record needs to be tunnelled.
It is given an explicit collection type using the URI form.

~~~
Expand All @@ -537,7 +501,6 @@ It is given an explicit collection type using the URI form.
## JSON Collection

The following example is a JSON collection that assembles Evidence from two attesters.
Since attester B outputs Evidence as CMW in CMW record format, the CBOR record needs to be tunnelled.

~~~
{::include cddl/collection-example-2.json}
Expand Down

0 comments on commit a9fe697

Please sign in to comment.