ietf-wg-mimi / draft-ietf-mimi-content

6 stars 4 forks source link

Use CBOR #16

Closed rohanmahy closed 3 months ago

rohanmahy commented 3 months ago

Update draft to use CBOR for the binary format,

hellp commented 3 months ago

@rohanmahy I saw IETF's announcement of RFC 9582 the other day, and noticed that they use CBOR sequences to encode their messages instead of CBOR arrays (https://www.rfc-editor.org/rfc/rfc9528.html#name-edhoc-message-1).

I wonder if that's worth a consideration for mimi-content as well?

rohanmahy commented 3 months ago

Hi Fabian, That's a great question. While I used CBOR sequences for some logical internal groupings in the CDDL to make it more readable, I avoided using them for the NestedPart and top level definitions. The other main disadvantage is that you can't convert the CBOR sequences into JSON for logging or debugging purposes, and for the NestedPart you don't have a fixed length sequence, since the number of elements depends if it is a null, single, external, or multiple.

Another option is to turn sequences into an embedded CBOR bstr by enclosing each in << and >>. This also makes logging/debugging more difficult.

Let's see if the CBOR community and potential implementers have anything to say about these tradeoffs.

thanks, -rohan

On Fri, Jun 7, 2024, 01:34 Fabian Neumann @.***> wrote:

@rohanmahy https://github.com/rohanmahy I saw IETF's announcement of RFC 9582 the other day, and noticed that they use CBOR sequences to encode their messages instead of CBOR arrays ( https://www.rfc-editor.org/rfc/rfc9528.html#name-edhoc-message-1).

I wonder if that's worth a consideration for mimi-content as well?

  • Pro: It's a (tiny bit) closer to the structs that were used in the TLS-PL examples.
  • Pro: It saves the initial byte, the wrapping "array of length x".
  • Con: Decoder/parser support may be worse; at least Python's cbor2 currently does not support CBOR sequences in its API (interestingly enough it seems to support it in the CLI helper).

— Reply to this email directly, view it on GitHub https://github.com/ietf-wg-mimi/draft-ietf-mimi-content/pull/16#issuecomment-2153564583, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADSQPS2H2ZYAKSBVXQWDXTZGDWYDAVCNFSM6AAAAABI2UXGBGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJTGU3DINJYGM . You are receiving this because you were mentioned.Message ID: @.***>