Re: [jose] FW: Should we delete the "typ" header field

Richard Barnes <rlb@ipv.sx> Thu, 30 May 2013 14:42 UTC

Return-Path: <rlb@ipv.sx>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 7088F21F8FF3 for <jose@ietfa.amsl.com>; Thu, 30 May 2013 07:42:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.41
X-Spam-Level:
X-Spam-Status: No, score=-1.41 tagged_above=-999 required=5 tests=[AWL=0.415, BAYES_00=-2.599, FH_RELAY_NODNS=1.451, FM_FORGED_GMAIL=0.622, GB_I_INVITATION=-2, HTML_MESSAGE=0.001, J_CHICKENPOX_33=0.6, RDNS_NONE=0.1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BNemabFN0wVF for <jose@ietfa.amsl.com>; Thu, 30 May 2013 07:42:45 -0700 (PDT)
Received: from mail-ob0-x22a.google.com (mail-ob0-x22a.google.com [IPv6:2607:f8b0:4003:c01::22a]) by ietfa.amsl.com (Postfix) with ESMTP id 9E22821F9121 for <jose@ietf.org>; Thu, 30 May 2013 07:42:40 -0700 (PDT)
Received: by mail-ob0-f170.google.com with SMTP id ef5so735018obb.15 for <jose@ietf.org>; Thu, 30 May 2013 07:42:24 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=xFux3TIVpImkEVIBYTV3aWJcvWI9vAn0eSZXlnI6g18=; b=pbS0RUIwoQgf3PCi2mF53Vuz8EKc6+PhSHhJlZk4VMCsIS22WIr+Lbh1lAnnl7lFDu 6zLgVBBGQ0h2vSiJdz/y4zJEGgJtP0VoL7r10E0FzoqTOMhjDC5cn+SoVkTtBCHlLxsk wJJhuA2IR+kyq/au1RR3HGBH1GSpU9sByILEbwRi2sneV65KAY9TUQ1rAV5R+VSxXe7k xmHpCnZq5dKCA1qYFmz9GQGeF8j2nYXOt4IUTTAf6+IE8sB/SUvn1fzFwkD4w5Y/xBkB x6hpojk+SXLjrvUeQ0qzaJntmYVPce+QZVdGGFvAwTQC3ezRrzzbBD7l32aJDdB1EYzQ AvAA==
MIME-Version: 1.0
X-Received: by 10.60.133.134 with SMTP id pc6mr4184872oeb.87.1369924944045; Thu, 30 May 2013 07:42:24 -0700 (PDT)
Received: by 10.60.84.8 with HTTP; Thu, 30 May 2013 07:42:23 -0700 (PDT)
X-Originating-IP: [192.1.255.206]
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E1151AD1BC01@WSMSG3153V.srv.dir.telstra.com>
References: <255B9BB34FB7D647A506DC292726F6E1151AD1BB79@WSMSG3153V.srv.dir.telstra.com> <4E1F6AAD24975D4BA5B1680429673943677C8025@TK5EX14MBXC285.redmond.corp.microsoft.com> <255B9BB34FB7D647A506DC292726F6E1151AD1BC01@WSMSG3153V.srv.dir.telstra.com>
Date: Thu, 30 May 2013 10:42:23 -0400
Message-ID: <CAL02cgR8AU1cHHii3LPTmnEwBsrh-QVAgpgZr34XNX0UgTmLuA@mail.gmail.com>
From: Richard Barnes <rlb@ipv.sx>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
Content-Type: multipart/alternative; boundary="047d7b47249ea8b71b04ddf081fd"
X-Gm-Message-State: ALoCoQmgI7vrOGFQZM5aE7mQvYLmrTL2nXsAV3Sq5zIKZACAntSRgOjrHE+7LHuoy4cdzu0IuSnb
Cc: Mike Jones <Michael.Jones@microsoft.com>, "jose@ietf.org" <jose@ietf.org>
Subject: Re: [jose] FW: Should we delete the "typ" header field
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/jose>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 30 May 2013 14:42:49 -0000

+1 to everything James says here.

"cty" == Content-Type.  It's just a MIME type for the encapsulated content.

The "application/" hack is clever.  I would like some apps people to
review, but it seems workable to me at first blush.


On Thu, May 30, 2013 at 4:09 AM, Manger, James H <
James.H.Manger@team.telstra.com> wrote:

> > The purpose of the “JWS” and “JWE” types is to provide standard
> identifiers for applications that may want to use them, either in the “typ”
> field****
>
> ** **
>
> Don’t do that. We already know it’s a JOSE message. We already know it’s a
> JWE or JWS by alg or enc (or [2]). So typ:JWE or typ:JWS can add nothing
> but confusion. If an app has no extra semantics above it being a JOSE
> message, then they should omit “typ”.****
>
> ** **
>
> > or the “cty” field (the values of which are in the same namespace).  ***
> *
>
> ** **
>
> > I’ll plan to similarly clarify that the semantics of “cty” are
> application-specific and the contents of “cty” do not affect the JOSE
> processing.****
>
> ** **
>
> Don’t do that. “cty” is the media type of the content. It is clear that
> this is metadata about the content and doesn’t affect JOSE processing (of
> this message). Media types are well defined so there is no need to call
> them application-specific.****
>
> ** **
>
> Suggested simplification: Define “cty” as holding the media type of the
> content. State that an “application/” prefix may be omitted to save a few
> bytes for this common case. To reconstruct the full media type, add a
> “application/” prefix if and only if there is no “/” before the first “;”
> in the value.****
>
> No registry needed.****
>
> ** **
>
> --****
>
> James Manger****
>
> ** **
>
> *From:* Mike Jones [mailto:Michael.Jones@microsoft.com]
> *Sent:* Thursday, 30 May 2013 5:22 PM
>
> *To:* Manger, James H; jose@ietf.org
> *Subject:* RE: [jose] FW: Should we delete the "typ" header field****
>
> ** **
>
> I agree, given this thread, that clarified wording is in order along the
> lines of that which you suggest.  Thanks for writing it.  I’ll put doing so
> on my to-do list.****
>
> ** **
>
> The purpose of the “JWS” and “JWE” types is to provide standard
> identifiers for applications that may want to use them, either in the “typ”
> field or the “cty” field (the values of which are in the same namespace).
> I’ll plan to similarly clarify that the semantics of “cty” are
> application-specific and the contents of “cty” do not affect the JOSE
> processing.****
>
> ** **
>
>                                                             Best wishes,**
> **
>
>                                                             -- Mike****
>
> ** **
>
> *From:* jose-bounces@ietf.org [mailto:jose-bounces@ietf.org<jose-bounces@ietf.org>]
> *On Behalf Of *Manger, James H
> *Sent:* Thursday, May 30, 2013 12:17 AM
> *To:* jose@ietf.org
> *Subject:* [jose] FW: Should we delete the "typ" header field****
>
> ** **
>
> > The purpose of “typ” is your 3.****
>
> ** **
>
> Then why define "typ":"JWS", "typ":"JWS+JSON", "typ":"JWE", and
> "typ":"JWE+JSON"?****
>
> These values cause confusion as they only make sense for purposes [1] and
> [2].****
>
> ** **
>
> The text describing "typ" says it declares the “type of this object”.****
>
> This clearly also causes massive confusion. The object is obviously a JOSE
> message; it is also obviously a JWS or JWE; it might also be a JWT, or a
> missile launch instruction, or a meeting invitation, or anything. “type”
> and “object” are too generic for readers to get the same understanding.***
> *
>
> ** **
>
> At a minimum it should be radically rephrased. Perhaps:****
>
> “The "xxx" header parameter can be used to hold an application-specific
> string identifying the meaning of a JOSE message to an application. This
> parameter has no affect on JOSE processing.”****
>
> ** **
>
> --****
>
> James Manger****
>
> ** **
>
> *From:* Mike Jones [mailto:Michael.Jones@microsoft.com<Michael.Jones@microsoft.com>]
>
> *Sent:* Thursday, 30 May 2013 4:45 PM
> *To:* Manger, James H; jose@ietf.org
> *Subject:* RE: [jose] Should we delete the "typ" header field****
>
> ** **
>
> The purpose of “typ” is your 3.****
>
> ** **
>
> There can already be no confusion about 1 because they’re syntactically
> completely different.  2 is unnecessary because the “alg” value (or the
> existence of “enc”) already distinguishes between JWS and JWE semantics.**
> **
>
> ** **
>
>                                                             -- Mike****
>
> ** **
>
> *From:* jose-bounces@ietf.org [mailto:jose-bounces@ietf.org<jose-bounces@ietf.org>]
> *On Behalf Of *Manger, James H
> *Sent:* Wednesday, May 29, 2013 11:08 PM
> *To:* jose@ietf.org
> *Subject:* Re: [jose] Should we delete the "typ" header field****
>
> ** **
>
> > Can anybody justify why this field should be present in the document –
> or should it just disappear?****
>
> ** **
>
> It seems there are at least 3 different meanings given to "typ" in the
> header of a JOSE message:****
>
> ** **
>
> [1] The "typ" value indicates the serialization of the JOSE message. For
> example, "typ":"JWE" and "typ":"JWE+JSON" distinguish the compact
> (dot-separated-b64-blobs) and JSON serializations.****
>
> ** **
>
> [2] The "typ" value indicates the high-level semantics of the JOSE
> structure. For example, "typ":"JWE" and "typ":"JWS" distinguish the
> semantics defined in the separate JWE and JWS specifications.****
>
> ** **
>
> [3] The "typ" value indicates the application-layer semantics of the
> message. For example, "typ":"JWT" value indicates that the message conveys
> a set of claims (as a JSON object) wrapped as a JOSE message (either
> unprotected, signed, MACed, encrypted, or signed then encrypted) that use
> the compact serialization.****
>
> ** **
>
> Indicating the serialization [1] does not seem helpful as the recipient
> needs to know the serialization before they can extract the header to see
> the "typ" value. Indicating the serialization is actually harmful as it
> tightly couples a message to one serialization, whereas serialization is
> generally thought of as a transport-layer choice that is independent of the
> message security or semantics.****
>
> ** **
>
> Indicating the high-level semantics of the JOSE structure [2] is slightly
> useful so a message can be switched to different code according to its
> structure. It is not that useful, however, as further switching is required
> to distinguish different modes (eg unprotected vs asymmetric signature vs
> MAC). This meaning only helps if the field is made mandatory, and the
> presence/absence of the "enc" field or looking up the class of the "alg"
> value are not specified as alternatives.****
>
> ** **
>
> Being able to indicate application-layer semantics [3] could theoretically
> be useful. Perhaps the "profile" attribute or "rel=’profile’" link relation
> in HTML5 is analogous. In this case JOSE should not define values for the
> field. "JWS", "JWS+JSON", "JWE", and "JWE+JSON" make no sense as
> application-layer semantics — and certainly not inside the JOSE message.**
> **
>
> ** **
>
> Most (all?) of the many specs mentioning the "typ" field make it optional,
> and if they suggest particular "typ" values those are only “MAY”s or
> “SHOULD”s — not “MUST”s. Consequently, apps cannot rely on "typ" regardless
> of its meaning.****
>
> ** **
>
> ** **
>
> My suggestions:****
>
> ** **
>
> * For [1], define two media types to distinguish the two serializations,
> not a header field.****
>
> ** **
>
> *  1st preference for [3], drop it from JOSE specs; let an application
> using JOSE (eg JWT) define a field (and value) for this. If the application
> defines the field in a generic fashion for reuse by other applications that
> is a nice bonus.****
>
> ** **
>
> * 2nd preference for [3], define a field (but no values) that can hold an
> application-layer semantics identifier – but only put this definition in a
> spec that defines JOSE messages as a whole (not specs specific to JWE or
> JWS). Use a different name: "app" or "profile" or "mean"ing or "pur"pose.*
> ***
>
> ** **
>
> * For [2], define a mandatory field that indicates the semantics of the
> JOSE structure at a low enough level that a JOSE implementation built on
> top of a crypto library could (almost) work without needing to recognize
> the "alg" value. "typ" would have been a reasonable name for this field but
> is now too polluted with confusion. How about "t"?****
>
> Consider for instance a JOSE implementation that only supports
> "alg":"HS256". To add support for "alg":"HS3" (HMAC with SHA-3) minimal (if
> any) new code is needed in a JOSE layer: perhaps an extra table entry
> mapping the JOSE label "HS3" to a crypto library label (eg "HmacSHA3").
> "t":"mac" can accompany both these algs. To support "alg":"RS512", in
> contrast, requires calls to different crypto library functions (knowing the
> difference between public & private keys for instance). This deserves a
> separate value, say, "t":"sig".****
>
> ** **
>
> --****
>
> James Manger****
>
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose
>
>