Re: [Acme] Specify which JWS serialization is used

Logan Widick <logan.widick@gmail.com> Sun, 04 March 2018 15:43 UTC

Return-Path: <logan.widick@gmail.com>
X-Original-To: acme@ietfa.amsl.com
Delivered-To: acme@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 96A9812711A for <acme@ietfa.amsl.com>; Sun, 4 Mar 2018 07:43:14 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 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, HTML_MESSAGE=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 Wl5KdF1tFBNg for <acme@ietfa.amsl.com>; Sun, 4 Mar 2018 07:43:12 -0800 (PST)
Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::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 6C0431270AC for <acme@ietf.org>; Sun, 4 Mar 2018 07:43:12 -0800 (PST)
Received: by mail-it0-x233.google.com with SMTP id u66so6669445ith.1 for <acme@ietf.org>; Sun, 04 Mar 2018 07:43:12 -0800 (PST)
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; bh=05ypymKAMTBncdza6L8PPG5NW31e5OIqzxpfbIVPGT8=; b=fecDxbPPamT/G/e79UxLHIj2N+Jqye8xcRznb509oGj61O7OvQnhWx+nNXuxnhq5ZE RtgdVRI6QhC+bf1v+j8mZWV+0nRiFs/tII0ZltK95hKWpAMh8d/YzrkHdgJYOu3edYTP D+ZvkuIvSLO1AK9924MAhhtH13cPoic1gbQcUONlWMFZz/wcpC30otOxsNsCwvurGyqE 2vKRtZ8sm3XOr9EZOOFg894vDUXsv6wQuzeSZUV9FYMfRt6d7ycdbVAcaXQMr/cGMlUI 7nkaUPLS72UIC8D9afvelNswW+F/rFxeRQkIewc/LZLuq6Zf+8mHBsaIIU/HeTm+i5XQ I9Rw==
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; bh=05ypymKAMTBncdza6L8PPG5NW31e5OIqzxpfbIVPGT8=; b=OwzOCNIRTcqg16Y3geaSVLQTbOqS+guH7gORu+HDnbzpxUSwKMqHjgIXMEmEY/xUkZ vLK/WepuSYUF5HTC+byiAjhOxLWI+03FwAk65c3iDIsTMJCB8pzCLZA3fFZrn/86LMKo +1YX/4VOvp8Rys9Z0y9754+Bq9zKdQEyHnqZs/ytqErtdCEWHHezBAIiuwQFvFQ+99ff FCVBA9bc2lzyXvRSLqRPX4ROZFug0Fq2YFFP03sUPq3BjYJ+r1dq5X986C7LA+YEKPZb vLAju0kFlnjPqWNncsTT4GkSE3SYt9xo3/sy+xCDCSOOi6UnP4gZiLjsGOgLki12zoCH z+XA==
X-Gm-Message-State: AElRT7FLEvfs1X7uHtaWTi82YJAMXDtJQyWwPprSXxTBGSN4nqjkeMtp /FAy/6w+HksFVKUWp+pXUwm5ulj0SA4o/SaX5O4=
X-Google-Smtp-Source: AG47ELt53OZ3B/Jc8JJSodUvgkaD86OD5tb7qYSRhcVB2ePFAhu0Jyn9I+m5qxN6KDkCP3Po2WUX91EkcuBnoe67ynQ=
X-Received: by 10.36.123.65 with SMTP id q62mr10433746itc.120.1520178191575; Sun, 04 Mar 2018 07:43:11 -0800 (PST)
MIME-Version: 1.0
Received: by 10.2.27.77 with HTTP; Sun, 4 Mar 2018 07:43:11 -0800 (PST)
In-Reply-To: <20180304143300.GI2161@carrot.tutnicht.de>
References: <CAMmAzEKJhMaUBtCWSNZyGv-f+-edZ-WTq3=WFD_b1bXfvua89A@mail.gmail.com> <20180106001126.GB3076@carrot.tutnicht.de> <CAMmAzELgjpAmVCX6YB0VMvNQV3NH3NDdM_pdcz6d+h=ZO2rJww@mail.gmail.com> <CAMmAzEKMffffrxAihotVWPpqy=LaRkpSJuW9CpSVoQfLQ-nBwQ@mail.gmail.com> <CAL02cgRLXkkQECF5ssGh39uFL0xJp-3EODxGSQVzfPuEnE7FgA@mail.gmail.com> <63F4F466-8398-41E6-BD25-5414ADA9D1B3@felipegasper.com> <CAMmAzEKksnuBi0LPHsAsd2qs1brbMqrJBdtsbArTr6HhGrkN+A@mail.gmail.com> <CAL02cgRrH9fG-E9_oc4naSNvE4igaUcs9wXDfTtCTUCx+c4wbg@mail.gmail.com> <20180304125854.GH2161@carrot.tutnicht.de> <CAMmAzEJ0A2iOd2ASSHGJRfuB6Ss-BaOCXWsxUKUZx9UUzbT1ng@mail.gmail.com> <20180304143300.GI2161@carrot.tutnicht.de>
From: Logan Widick <logan.widick@gmail.com>
Date: Sun, 04 Mar 2018 09:43:11 -0600
Message-ID: <CAMmAzELuDLp4KxPtLgHp8AoyKGLOOjx4HPSrhDJ=yJ9RytU_vw@mail.gmail.com>
To: Jörn Heissler <acme-specs@joern.heissler.de>
Cc: Richard Barnes <rlb@ipv.sx>, Felipe Gasper <felipe@felipegasper.com>, ACME WG <acme@ietf.org>, Fraser Tweedale <frase@frase.id.au>
Content-Type: multipart/alternative; boundary="001a114749d21ab162056698119e"
Archived-At: <https://mailarchive.ietf.org/arch/msg/acme/0e26fJ0T6PBcTqXFU-flPOUVM3o>
Subject: Re: [Acme] Specify which JWS serialization is used
X-BeenThere: acme@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Automated Certificate Management Environment <acme.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/acme>, <mailto:acme-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/acme/>
List-Post: <mailto:acme@ietf.org>
List-Help: <mailto:acme-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/acme>, <mailto:acme-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 04 Mar 2018 15:43:15 -0000

How about this: Specify a default format (either "application/jose" for
Compact Serialization, or "application/jose+json" with Flattened
Serialization - I have no preference which one), with optional support for
other formats if needed? Even with JOSE libraries that don't support all
serializations and/or don't provide control over which serialization is
used, a programmer would at least need to know (or experimentally find out)
if a JSON serialization or if the compact one is being produced. If a JSON
serialization is selected as the default, a programmer should be able to
convert between the two JSON serializations easily as needed before and/or
after using a JOSE library. If a JSON format is declared as the default but
the JOSE library only has the compact one, or vice-versa, conversion before
and/or after the JOSE library would be more complex but should still be
doable with guidance.

The directory meta item could be defined as something like:

   - supportedSerializations: An array of supported serialization formats
   as described in {{jws-serialization-formats}}. If this is not specified,
   assume that the server only supports [insert selected default here].

Then, the JWS Serialization Formats section could be changed to something
like the following:

The JSON Web Signature (JWS) specification {{!RFC7515}} contains multiple
JWS serialization formats. When sending an ACME request with a non-empty
body, an ACME client implementation SHOULD use the HTTP Content-Type
{{!RFC7231}} header to indicate which JWS serialization format is used for
encapsulating the ACME request payload.

Each serialization format defined for use in ACME is described with a
content type, and a series of ACME-specific restrictions on root JWS and
nested JWS instances.  A "root JWS" is a JWS used to encapsulate an entire
ACME request payload, and a "nested JWS" is a JWS contained within the ACME
request payload (such as the "externalAccountBinding" described in
{{external-account-binding}} or the "key-change" object described in
{{account-key-roll-over}}). Below are the JWS serialization formats that
are defined for use in ACME:

[same list as before but with the default format coming first]

If no Content-Type is provided, the default serialization type is [insert
selected default here]. Servers MUST support [insert selected default
here]. [NOTE: If a JSON format is selected as the default, say that a
server SHOULD support the other JSON format.] A server MAY support
additional serializations, such as [insert serialization(s) not picked
here], by including a "supportedSerializations" field in the directory
"meta" object as described in {{directory}}.

If a server receives a request using a serialization it does not support,
the server MUST send a response with HTTP status code 415 (Unacceptable
Media Type) and a problem document with error type
"unsupportedSerialization". This problem document SHOULD contain a
"supportedSerializations" array of strings indicating the acceptable
serialization content types.

[TODO: If a client uses the General JSON Serialization but it turns out the
server only supports the Flattened JSON Serialization (or vice-versa),
explain that a 415 response indicates that the client will need to switch
JSON formats]

[TODO: Insert a sentence or two specifying what happens if a supported
serialization is used but the serialization is malformed? Should this be
400 Bad Request + malformed error code + supportedSerializations?]

In the examples below, JWS objects are shown in the Flattened JSON
serialization, with the protected header and payload expressed as
base64url(content) instead of the actual base64-encoded value, so that the
content is readable. [Example readability is a very high priority
regardless of which serialization format is actually chosen as the default,
and the current convention of Flattened JSON + base64url(content) is about
as readable as it gets, so I don't think any changes will need to be made
here]


On Sun, Mar 4, 2018 at 8:33 AM, Jörn Heissler <acme-specs@joern.heissler.de>
wrote:

> On Sun, Mar 04, 2018 at 07:45:36 -0600, Logan Widick wrote:
> > Good catch. Should it be 415 (Unsupported Media Type) plus which of the
> > following (or which combination of the following):
> >
> >    - A new problem document field (tentatively named
> >    "supportedSerializations": an array of media type strings)?
> >    - A new directory field (tentatively named "supportedSerializations":
> an
> >    array of media type strings)?
> >       - Should this go in the directory's "meta" object, or in the
> >       directory object itself?
> >    - A HTTP header?
> >    - Something else?
>
> I like the directory approach with meta. Then a client could
> use this information before sending the first POST. Else the client
> would need to change an internal state after receiving the error
> message. For my own client, I'm planning to support the OpenPGP smart
> card. It takes 3 seconds to generate a signature. If a signature is
> wasted to find out that the default serialization is not supported, it
> would be annoying. Having to write a configuration file "use compact by
> default for CA foo" would be stupid too.
>
> This, and the problem document field. "supportedSerializations" sounds
> fine.
>
> Should the two features be OPTIONAL?
>
> I don't like HTTP headers, it's quite complicated to parse them correctly.
> JSON is so much easier.
>
>
> Or... specify that flattened MUST BE used :-)
>
> Cheers
> Joern Heissler
>