Re: [Cbor] correctness of implied top level array?

Carsten Bormann <cabo@tzi.org> Sun, 24 February 2019 12:36 UTC

Return-Path: <cabo@tzi.org>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id B0948128CE4 for <cbor@ietfa.amsl.com>; Sun, 24 Feb 2019 04:36:21 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.2
X-Spam-Level:
X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] autolearn=ham autolearn_force=no
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E_Tukcct_FL3 for <cbor@ietfa.amsl.com>; Sun, 24 Feb 2019 04:36:20 -0800 (PST)
Received: from mailhost.informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A23E2128CB7 for <cbor@ietf.org>; Sun, 24 Feb 2019 04:36:19 -0800 (PST)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from submithost.informatik.uni-bremen.de (submithost2.informatik.uni-bremen.de [IPv6:2001:638:708:30c8:406a:91ff:fe74:f2b7]) by mailhost.informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id x1OCa9fW002075; Sun, 24 Feb 2019 13:36:14 +0100 (CET)
Received: from [192.168.217.106] (p54A6C2FE.dip0.t-ipconnect.de [84.166.194.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by submithost.informatik.uni-bremen.de (Postfix) with ESMTPSA id 446l1P3V6rz1Bp8; Sun, 24 Feb 2019 13:36:09 +0100 (CET)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <81789050-5133-48B0-BEE7-4F1E0BBB4C06@island-resort.com>
Date: Sun, 24 Feb 2019 13:36:08 +0100
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 572704566.569163-42266792cc27e07b2e31c24e74b07214
Content-Transfer-Encoding: quoted-printable
Message-Id: <40A3B694-80A4-4AD7-A2A6-C071C6E88D2D@tzi.org>
References: <81789050-5133-48B0-BEE7-4F1E0BBB4C06@island-resort.com>
To: Laurence Lundblade <lgl@island-resort.com>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/3MMQdOMd6ESrMQPFPzSORlsLfiY>
Subject: Re: [Cbor] correctness of implied top level array?
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 24 Feb 2019 12:36:22 -0000

Hi Laurence,

the construction you describe is different from a CBOR data item:
It is a CBOR Sequence.  You piqued me to finally write it up, see below.

More generally speaking, an encoded CBOR data item followed by residual data is a very valid construction, for instance for a piece of metadata tacked on as a header to a binary blob.  CBOR’s self-delimiting is all you need here.
The metadata part doesn’t stop to be well-formed by being followed by that binary blob.
But of course the whole thing *is* not, but still *has* a well-formed encoded CBOR data item.

Unfortunately, not very many CBOR libraries have an API that allows isolating that metadata header from its residual data.  Maybe it’s worth writing a draft about suggested API functionality as well.  (One other thing that recently came up and is supported by too few CBOR library APIs is using an already encoded CBOR data item during encoding an array, map, or Tag.)

Grüße, Carsten


Name:		draft-bormann-cbor-sequence
Revision:	00
Title:		Concise Binary Object Representation (CBOR) Sequences
Document date:	2019-02-24
Group:		Individual Submission
Pages:		8
URL:            https://www.ietf.org/internet-drafts/draft-bormann-cbor-sequence-00.txt
Status:         https://datatracker.ietf.org/doc/draft-bormann-cbor-sequence/
Htmlized:       https://tools.ietf.org/html/draft-bormann-cbor-sequence-00
Htmlized:       https://datatracker.ietf.org/doc/html/draft-bormann-cbor-sequence


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.