rfc-8742

Concise Binary Object Representation (CBOR) Sequences

C. Bormann
date2020-02 streamIETF areaart wgcbor statusPROPOSED STANDARD pages10 canonicalhttps://www.rfc-editor.org/rfc/rfc8742 doi10.17487/RFC8742
This document describes the Concise Binary Object Representation (CBOR) Sequence format and associated media type "application/cbor-seq". A CBOR Sequence consists of any number of encoded CBOR data items, simply concatenated in sequence. Structured syntax suffixes for media types allow other media types to build on them and make it explicit that they are built on an existing media type as their foundation. This specification defines and registers "+cbor-seq" as a structured syntax suffix for CBOR Sequences.

Extracted elements (15)

design-rationale §2

CBOR Sequences do not use a marker between items (unlike JSON Text Sequences), because CBOR-encoded data items are self-delimiting and the end can always be calculated from the encoding itself.

cbor

design-rationale §4.3

For applications requiring efficient element skipping or multi-threaded decoding fan-out, byte strings (which carry length information) containing embedded CBOR can be used as CBOR Sequence elements, enabling skip-without-decode and partial error recovery.

cbor

design-rationale §2

There is no end-of-sequence indicator in CBOR Sequences. If an end marker is needed, encoding the values as a single CBOR array (definite or indefinite length) is more appropriate.

cbor

interoperability-note §2

CBOR Sequence format can reliably detect truncation of the last CBOR data item in the sequence, but cannot detect entirely missing CBOR data items at the end. A streaming decoder may pause and resume decoding when a truncated final item is being received.

cbor

interoperability-note §2

If any data item in the sequence is not well formed, it is not possible to reliably decode the rest of the sequence. Handling malformed data is outside the scope of this specification.

cbor

interoperability-note §4.1

In CDDL, CBOR Sequences are supported as byte string contents via the '.cborseq' control operator, but CDDL does not yet provide for unadorned CBOR Sequences as a top-level subject; the workaround is to use an array for the top-level rule with explanatory text.

cbor

normative-requirement §5 MUST

Decoders MUST fail gracefully in the face of malicious inputs, since they must operate on input that is assumed to be untrusted.

cbor, security

normative-requirement §6.3 SHOULD

Fragment identifier syntax and semantics for '+cbor-seq' media types SHOULD be the same as specified for 'application/cbor-seq'. For specific 'xxx/yyy+cbor-seq' types, if the fragment identifier resolves per '+cbor-seq' rules it SHOULD be processed as such; otherwise process per 'xxx/yyy+cbor-seq'.

cbor, registry

normative-requirement §3 SHOULD

The '+cbor-seq' structured syntax suffix SHOULD be used by a media type when the result of parsing its bytes as a CBOR Sequence is meaningful and is at least sometimes not just a single CBOR data item.

cbor, registry

protocol-element §2

A CBOR Sequence is a sequence of bytes defined as either an empty (zero-length) sequence of bytes, or the concatenation of one or more encoded CBOR data items. Concatenating zero or more CBOR Sequences also results in a valid CBOR Sequence.

cbor

protocol-element §2

Decoding a CBOR Sequence proceeds by repeatedly decoding a single CBOR data item from the byte stream and collecting results; a streaming decoder delivers zero or more CBOR data model values as bytes become available.

cbor

registry §6.2

IANA has assigned CoAP Content-Format ID 63 for the media type 'application/cbor-seq' in the 'CoAP Content-Formats' subregistry of the 'Constrained RESTful Environments (CoRE) Parameters' registry.

cbor, registry

registry §6.3

IANA has registered the '+cbor-seq' structured syntax suffix in the 'Structured Syntax Suffix Registry', with encoding considerations of binary and security considerations referencing RFC 8742 Section 5.

cbor, registry

registry §6.1

IANA has registered the media type 'application/cbor-seq' in the 'Media Types' registry. Type: application, Subtype: cbor-seq, encoding: binary, no required or optional parameters.

cbor, registry

security-consideration §5

The security considerations of CBOR (RFC 7049) apply to CBOR Sequences. The format provides no cryptographic integrity protection of any kind, but can be combined with CBOR Object Signing and Encryption (COSE) to do so. COSE protections can be applied to an entire sequence or to each element independently.

cbor, security, crypto