[Docs] [txt|pdf] [Tracker] [Email] [Nits]

Versions: 00

Network Working Group                                         C. Bormann
Internet-Draft                                   Universitaet Bremen TZI
Intended status: Standards Track                       February 24, 2019
Expires: August 28, 2019


         Concise Binary Object Representation (CBOR) Sequences
                     draft-bormann-cbor-sequence-00

Abstract

   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.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at https://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on August 28, 2019.

Copyright Notice

   Copyright (c) 2019 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (https://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents



Bormann                  Expires August 28, 2019                [Page 1]


Internet-Draft               CBOR Sequences                February 2019


   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1.  Conventions Used in This Document . . . . . . . . . . . .   3
   2.  CBOR Sequence Format  . . . . . . . . . . . . . . . . . . . .   3
   3.  The "+cbor-seq" Structured Syntax Suffix  . . . . . . . . . .   4
   4.  Security Considerations . . . . . . . . . . . . . . . . . . .   4
   5.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   4
     5.1.  Media Type  . . . . . . . . . . . . . . . . . . . . . . .   4
     5.2.  CoAP Content-Format Registration  . . . . . . . . . . . .   5
     5.3.  Structured Syntax Suffix  . . . . . . . . . . . . . . . .   6
   6.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   7
     6.1.  Normative References  . . . . . . . . . . . . . . . . . .   7
     6.2.  Informative References  . . . . . . . . . . . . . . . . .   7
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .   8
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .   8

1.  Introduction

   The Concise Binary Object Representation (CBOR) [RFC7049] can be used
   for serialization of data in the JSON [RFC8259] data model or its
   own, somewhat expanded data model.  When serializing a sequence of
   such values, it is sometimes convenient to have a format where these
   sequences can simply be concatenated to obtain a serialization of the
   concatenated sequence of values, or to encode a sequence of values
   that might grow at the end by just appending further CBOR data items.

   This document describes the concept and format of "CBOR Sequences",
   which are composed of zero or more encoded CBOR data items.  CBOR
   Sequences can be consumed (and produced) incrementally without a
   streaming parser (or streaming encoder).

   This document defines and registers the "application/cbor-seq" media
   type in the media type registry.  Media type structured syntax
   suffixes [RFC6838] were introduced as a way for a media type to
   signal that it is based on another media type as its foundation.
   CBOR [RFC7049] defines the "+cbor" structured syntax suffix.  This
   document defines and registers the "+cbor-seq" structured syntax
   suffix in the "Structured Syntax Suffix Registry".






Bormann                  Expires August 28, 2019                [Page 2]


Internet-Draft               CBOR Sequences                February 2019


1.1.  Conventions Used in This Document

   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
   "OPTIONAL" in this document are to be interpreted as described in
   BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all
   capitals, as shown here.

2.  CBOR Sequence Format

   Formally, a CBOR Sequence is a sequence of bytes that is either

   o  an empty (zero-length) sequence of bytes

   o  the sequence of bytes making up an encoded CBOR data item
      [RFC7049], followed by a CBOR Sequence.

   In short, concatenating zero or more encoded CBOR data items
   generates a CBOR Sequence.

   There is no end of sequence indicator.  (If one is desired, CBOR-
   encoding an array of the CBOR data model values being encoded --
   employing either a definite or an indefinite length encoding -- as a
   single CBOR data item may actually be the more appropriate
   representation.)

   This specification makes use of the fact that CBOR data items are
   self-delimiting.  Decoding a CBOR Sequence works as follows:

   o  If the CBOR Sequence is an empty sequence of bytes, the result is
      an empty sequence of CBOR data model values.

   o  Otherwise, decode a single CBOR data item from the bytes of the
      CBOR sequence, and insert the resulting CBOR data model value at
      the start of the result of decoding the rest of the bytes as a
      CBOR sequence.

   This means that if any data item in the sequence is not well-formed,
   it is not possible to reliably decode the rest of the sequence.  (An
   implementation may be able to recover from some errors in a sequence
   of bytes that is almost, but not entirely a well-formed encoded CBOR
   data item.  Handling malformed data is outside the scope of this
   specification.)

   This also means that the CBOR Sequence format can reliably detect
   truncation of the last CBOR data item in the sequence, but not
   entirely missing CBOR data items at the end.  A CBOR Sequence decoder
   that is used for consuming streaming CBOR Sequence data may simply



Bormann                  Expires August 28, 2019                [Page 3]


Internet-Draft               CBOR Sequences                February 2019


   pause for more data (e.g., by suspending and later resuming decoding)
   in case a truncated final item is being received.

3.  The "+cbor-seq" Structured Syntax Suffix

   The use case for the "+cbor-seq" structured syntax suffix is the same
   as for "+cbor": It SHOULD be used by a media type when parsing the
   CBOR Sequence of the object of the media type leads to a meaningful
   result, by simply using the generic CBOR Sequence processing.

   Applications encountering such a media type can then either simply
   use generic processing if all they need is a generic view of the CBOR
   Sequence, or they can use generic CBOR Sequence tools for initial
   parsing and then implement their own specific processing on top of
   that generic parsing tool.

4.  Security Considerations

   The security considerations of CBOR [RFC7049] apply.  This format
   provides no cryptographic integrity protection of any kind, but can
   be combined with security specifications such as COSE [RFC8152] to do
   so.

   As usual, decoders must operate on input that is assumed to be
   untrusted.  This means that decoders must fail gracefully in the face
   of malicious inputs.

5.  IANA Considerations

5.1.  Media Type

   Media types are registered in the media types registry
   [IANA.media-types].  IANA is requested to register the MIME media
   type for CBOR Sequence, application/cbor-seq, as follows:

   Type name: application

   Subtype name: cbor-seq

   Required parameters: N/A

   Optional parameters: N/A

   Encoding considerations: binary

   Security considerations: See RFCthis, Section 4.

   Interoperability considerations: Described herein.



Bormann                  Expires August 28, 2019                [Page 4]


Internet-Draft               CBOR Sequences                February 2019


   Published specification: RFCthis.

   Applications that use this media type: Data serialization and
   deserialization.

   Fragment identifier considerations: N/A

   Additional information:

   o  Deprecated alias names for this type: N/A

   o  Magic number(s): N/A

   o  File extension(s): N/A

   o  Macintosh file type code(s): N/A

   Person & email address to contact for further information:
      cbor@ietf.org

   Intended usage: COMMON

   Author: Carsten Bormann (cabo@tzi.org)

   Change controller: IETF

5.2.  CoAP Content-Format Registration

   IANA is requested to assign a CoAP Content-Format ID for the media
   type "application/cbor-seq", in the CoAP Content-Formats subregistry
   of the core-parameter registry [IANA.core-parameters], from the
   "Expert Review" (0-255) range.  The assigned ID is shown in Table 1.

          +----------------------+----------+-------+-----------+
          | Media type           | Encoding | ID    | Reference |
          +----------------------+----------+-------+-----------+
          | application/cbor-seq | -        | TBD63 | RFCthis   |
          +----------------------+----------+-------+-----------+

                      Table 1: CoAP Content-Format ID

   RFC editor: Please replace TBD63 by the number actually assigned and
   delete this paragraph.








Bormann                  Expires August 28, 2019                [Page 5]


Internet-Draft               CBOR Sequences                February 2019


5.3.  Structured Syntax Suffix

   Structured Syntax Suffixes are registered within the "Structured
   Syntax Suffix Registry" maintained at
   [IANA.media-type-structured-suffix].  IANA is requested to register
   the "+cbor-seq" structured syntax suffix in accordance with
   [RFC6838], as follows:

      Name: CBOR Sequence

      +suffix: +cbor-seq

      References: RFCthis

      Encoding considerations: binary

      Fragment identifier considerations: The syntax and semantics of
      fragment identifiers specified for +cbor-seq SHOULD be as
      specified for "application/cbor-seq".  (At publication of this
      document, there is no fragment identification syntax defined for
      "application/cbor-seq".)



         The syntax and semantics for fragment identifiers for a
         specific "xxx/yyy+cbor-seq" SHOULD be processed as follows:





            For cases defined in +cbor-seq, where the fragment
            identifier resolves per the +cbor-seq rules, then process as
            specified in +cbor-seq.





            For cases defined in +cbor-seq, where the fragment
            identifier does not resolve per the +cbor-seq rules, then
            process as specified in "xxx/yyy+cbor-seq".









Bormann                  Expires August 28, 2019                [Page 6]


Internet-Draft               CBOR Sequences                February 2019


            For cases not defined in +cbor-seq, then process as
            specified in "xxx/yyy+cbor-seq".

      Interoperability considerations: n/a

      Security considerations: See RFCthis, Section 4

      Contact: CBOR WG mailing list (cbor@ietf.org), or any IESG-
      designated successor.

      Author/Change controller: IETF

6.  References

6.1.  Normative References

   [IANA.core-parameters]
              IANA, "Constrained RESTful Environments (CoRE)
              Parameters",
              <http://www.iana.org/assignments/core-parameters>.

   [IANA.media-type-structured-suffix]
              IANA, "Structured Syntax Suffix Registry",
              <http://www.iana.org/assignments/
              media-type-structured-suffix>.

   [IANA.media-types]
              IANA, "Media Types",
              <http://www.iana.org/assignments/media-types>.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <https://www.rfc-editor.org/info/rfc2119>.

   [RFC7049]  Bormann, C. and P. Hoffman, "Concise Binary Object
              Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049,
              October 2013, <https://www.rfc-editor.org/info/rfc7049>.

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <https://www.rfc-editor.org/info/rfc8174>.

6.2.  Informative References







Bormann                  Expires August 28, 2019                [Page 7]


Internet-Draft               CBOR Sequences                February 2019


   [RFC6838]  Freed, N., Klensin, J., and T. Hansen, "Media Type
              Specifications and Registration Procedures", BCP 13,
              RFC 6838, DOI 10.17487/RFC6838, January 2013,
              <https://www.rfc-editor.org/info/rfc6838>.

   [RFC7464]  Williams, N., "JavaScript Object Notation (JSON) Text
              Sequences", RFC 7464, DOI 10.17487/RFC7464, February 2015,
              <https://www.rfc-editor.org/info/rfc7464>.

   [RFC8091]  Wilde, E., "A Media Type Structured Syntax Suffix for JSON
              Text Sequences", RFC 8091, DOI 10.17487/RFC8091, February
              2017, <https://www.rfc-editor.org/info/rfc8091>.

   [RFC8152]  Schaad, J., "CBOR Object Signing and Encryption (COSE)",
              RFC 8152, DOI 10.17487/RFC8152, July 2017,
              <https://www.rfc-editor.org/info/rfc8152>.

   [RFC8259]  Bray, T., Ed., "The JavaScript Object Notation (JSON) Data
              Interchange Format", STD 90, RFC 8259,
              DOI 10.17487/RFC8259, December 2017,
              <https://www.rfc-editor.org/info/rfc8259>.

Acknowledgements

   This draft has mostly been generated from [RFC7464] by Nico Williams
   and [RFC8091] by Erik Wilde, which do a similar, but slightly more
   complicated exercise for JSON [RFC8259].  Laurence Lundblade raised
   an issue on the CBOR mailing list that pointed out the need for this
   document.

Author's Address

   Carsten Bormann
   Universitaet Bremen TZI
   Postfach 330440
   Bremen  D-28359
   Germany

   Phone: +49-421-218-63921
   Email: cabo@tzi.org











Bormann                  Expires August 28, 2019                [Page 8]


Html markup produced by rfcmarkup 1.129c, available from https://tools.ietf.org/tools/rfcmarkup/