Re: [COSE] Assigning CBOR tags to key structures

Renzo Navas <renzoefra@gmail.com> Tue, 18 April 2017 09:47 UTC

Return-Path: <renzoefra@gmail.com>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 771CF129AB2 for <cose@ietfa.amsl.com>; Tue, 18 Apr 2017 02:47:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 r70HiM3TotLL for <cose@ietfa.amsl.com>; Tue, 18 Apr 2017 02:47:09 -0700 (PDT)
Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6854F12714F for <cose@ietf.org>; Tue, 18 Apr 2017 02:47:09 -0700 (PDT)
Received: by mail-qk0-x233.google.com with SMTP id p68so125099890qke.1 for <cose@ietf.org>; Tue, 18 Apr 2017 02:47:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=qD9TU2WRkHtUShC0NzImoR1iC6q4vrzZ5NY3zqzqZGs=; b=cuh1FCdlpL3Lr+sPGWQm3LNf+zYpftCok22DZIy9K62qOh9ckxf/TGeWm/oK6yVRm/ k6wxeiSQE+ar0h2TDcCTz5iyYF2uu/wViba2Ndw8iMWz4wrjcZy5yEa+kU8Pe/Gx0Yi+ 2lVifHXU3xaMq/35WF+vNXk6gZY9tTxgFHeDSRgZcruEYAmBOlHyCjQt/0y5VUxn1Psl L8lUYn2p3fqg2rRU3GdyU1iLOYGJ6pImgLM2OFBbVmOpyR5rV7xjRYn4/WnxLvl6gpDl 0NWayubUgKBoj3NtTgT3oU1vjk2EUZcMrHCn7HFRfdOgFV+LsUwl/731h1NgpBoC7cTQ Pc1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=qD9TU2WRkHtUShC0NzImoR1iC6q4vrzZ5NY3zqzqZGs=; b=kNKw7D5168zIFjPxbT66PmEXqXtbT35ykBO/mHilqJkCjZ/EMtdDfpo4melDYb/HDT bYWizUvdrvY37J1Hxy4OarxtH3e7XcPdwASPZMytO/VXwUxJwc+mi/IQthwGFOnaRKRX z9egmX03gn3lvlcPFc8qm+UIFkxrsHXHDK7wZOMSOW4W/Q+GV1Qxcf+AwFdOZtdP7SID hVK3GOdCZOqUW2FSJJOwxaUBYiISFeCLAdu41OpJQ08ravmCcwrVgbNW50TU9gda0t6c I0Jf7RP5KgIM+2VREnsFOvL0tnTsM5kJePysWUCq37V2ZAMWpex4L2CHyIinXiZgeMB0 sPrA==
X-Gm-Message-State: AN3rC/5svnYt7qwrJhjrF0VFeSYLOpnKmx7/so+6+MkQXFnLvwiPVELU n6+JRmdPfMbZlwX7R0qR8vu3PD+PVg==
X-Received: by 10.55.34.10 with SMTP id i10mr13682621qki.138.1492508828616; Tue, 18 Apr 2017 02:47:08 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.200.58.102 with HTTP; Tue, 18 Apr 2017 02:46:48 -0700 (PDT)
In-Reply-To: <507AF7D7-6060-4D8A-A4E8-502C82D5CC50@tzi.org>
References: <08eb01d103c8$3deade00$b9c09a00$@augustcellars.com> <561A2C9B.5060104@tzi.org> <094001d10451$cccec4e0$666c4ea0$@augustcellars.com> <CAD2CPUGTgSiNBVkrvYLnk6=OmwNwQu-z=mSwo_r=j8RHVtX2VQ@mail.gmail.com> <507AF7D7-6060-4D8A-A4E8-502C82D5CC50@tzi.org>
From: Renzo Navas <renzoefra@gmail.com>
Date: Tue, 18 Apr 2017 11:46:48 +0200
Message-ID: <CAD2CPUE2jXPriDEQT+L_WAfGLLuR7BEHOCfD_aHGwG1Y10E=kA@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>, Jim Schaad <ietf@augustcellars.com>
Cc: cose <cose@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/gOc_4tSZtCMzXrUZRxak3qx8B2M>
Subject: Re: [COSE] Assigning CBOR tags to key structures
X-BeenThere: cose@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cose>, <mailto:cose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose/>
List-Post: <mailto:cose@ietf.org>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cose>, <mailto:cose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Apr 2017 09:47:13 -0000

Hello Cose ML!
(Sorry for the late reply, I didn't see the replies the same day; then
I was on holidays)

Jim:
thanks for the suggestion. Indeed I think I will go for this option to
keep the solution non-homebrew. I will  borrow from the CoAP
Content-Formats (application/cose-key : 101) and put this in the
protected headers.
I think this solution will be 3  bytes (1B content-type label + 2B to
represent "101") instead of 1 byte of the hypothetical CBOR Tag for
COSE-Key (19 or 20 looked nice).

Carsten:
I am using CoAP (..for now) but I want the least possible COSE
metadata on the CoAP header; to make the COSE message as agnostic as
possible of the transport (maybe we will transport this message
over-foo). In my particular case, I simply use the CoAP Content-format
60 to indicate that this is an "application/cbor" payload.
Then I use the CBOR-Tag 16 (COSE_Encrypt0), because indeed that is
what this CBOR message is. So even if I use CoAP metadata for COSE I
should indicate this message as "application/cose;
cose-type="cose-encrypt0" (16).

 My 'problem' arose when, once decrypted; the plaintext part of the
COSE_Encrypt0 contains , in some cases, a COSE_Key object; and I
simply wanted to indicate that with a 1-byte tag . Jim's suggestions
of content-type in protected header solves my problem indeed.


So maybe the question I want to ask to the ML is:

why you discarded defining the COSE_Key/COSE_KeySet CBOR tag? ( I see
the pretty tags 19 and 20 unassigned)
Carsten, I really agree with your opinion from 2015 :

>I'd propose this rule:
>If there is a media type, there should be a CBOR tag for those
>environments that don't benefit from media types.
In the end, it's a matter of 2 bytes, 1 byte tag, vs 3 byte protected
header content-type.
The COSE messages are around 52 Bytes, so It's a matter of 4% longer
Messages/Energy.

I found it strange not to find a CBOR tag for a mayor COSE type.

These are my 2 cents,

Thank you for your quick reply Jim and Carsten!

Renzo


On Fri, Apr 7, 2017 at 6:14 PM, Carsten Bormann <cabo@tzi.org> wrote:
> Hi Renzo,
>
> where would you put such a tag?
>
> Starting the encoded CBOR with a tag would amount to a magic number unless the media type already indicates that this is CBOR-encoded.  But then it could indicate that this is a application/cose-key in the first place (Content-Format 101):
>
> https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats
>
> Grüße, Carsten
>