Re: [jose] Question regarding RFC 7515

Anders Rundgren <anders.rundgren.net@gmail.com> Sat, 05 December 2020 04:56 UTC

Return-Path: <anders.rundgren.net@gmail.com>
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 85ED13A0B74 for <jose@ietfa.amsl.com>; Fri, 4 Dec 2020 20:56:27 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.099
X-Spam-Level:
X-Spam-Status: No, score=-2.099 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=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 VRD230KINu9A for <jose@ietfa.amsl.com>; Fri, 4 Dec 2020 20:56:25 -0800 (PST)
Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 86D203A0B71 for <jose@ietf.org>; Fri, 4 Dec 2020 20:56:25 -0800 (PST)
Received: by mail-wm1-x333.google.com with SMTP id f190so8798129wme.1 for <jose@ietf.org>; Fri, 04 Dec 2020 20:56:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=8CSgfNba7GIfqKRu0iVZtIUcsKTcvEZibGavgsnpEuQ=; b=PcR0zhUy/SgMxUxGUv8pSqeydVgOW5fEKkmb2UU4YX0yap1qSqbV0CX5FbmH1/OgbH siv0paZxqFS/RtarFA+PihYeUIzmxUIGTQo816YaxHP4N33xogGeklwnaGQ0LSs6/AvQ sPSfq+mxGQOaJ0LNyylldpjY9qkVkjs8dr7eu6+tgn/CfwWSG28Ey+5U9ITfTSg5gv6H 2VgZtF1+t2/mZGALk8iS95RhYLt1YV7cD8Ka6KwtQRyEIUeEjAmk8/0+/tmv4XGtjEZy b/V68SGJyDFEQ714gRJh0TzG+XMeWUthlTsTk9BwoQ2gGSCq9Xmtu1QHjX6ciC6lRCdI y2xQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=8CSgfNba7GIfqKRu0iVZtIUcsKTcvEZibGavgsnpEuQ=; b=VX9ZXci29XZ0aoGP7F/8DD+UlqBPVUYYhNM+NyFmlhsDrH+9fbVQs7bATroUVv9Okg 12jzhc/iKGqmGdovm/8mdmKnXj4A7iXaa4TxUrPjUYsBNQTFP6XD3uvY+IkFrRol+tY5 Tk51l67vL+TBgFSrj8net+eaBrz8o19ERzwIA98Xffu2evqEleYIwM4/vbYK+V+v9zgg mYXhT8rtWmhg2QAYpkl8q4+yQ1dHkjZLUE1S+W7sv+jEndGQSK6VfZE1m7ADZUwLpl+W Kin4TcJtn1+rOEEbIBoacPNOcmJyrVrq/MLxlYKVvFdBjSoe4V028Uj0eCFqp0FqjGv0 peOg==
X-Gm-Message-State: AOAM531eYuKU8IjsVC4Jr/fJCG0ztUoXTgHFLj0BDsOXByGOB/skHjX/ +jVx5vBSofQIg2LQr126nSb6wOE1WOawtA==
X-Google-Smtp-Source: ABdhPJywTHzCsqJ3T+6eBtndJ3n/KXO6U+bMZ+y2T+crUP9OwGMf/xN+S25btgIItcaiIo/twUv5sw==
X-Received: by 2002:a7b:c2e8:: with SMTP id e8mr7334627wmk.103.1607144182868; Fri, 04 Dec 2020 20:56:22 -0800 (PST)
Received: from [192.168.1.79] (25.131.146.77.rev.sfr.net. [77.146.131.25]) by smtp.googlemail.com with ESMTPSA id y68sm4620402wmc.0.2020.12.04.20.56.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2020 20:56:22 -0800 (PST)
To: Arshad Noor <arshad.noor@strongkey.com>, jose@ietf.org
References: <d12dfc98-bf1a-66dc-6d60-0b53887114e7@strongkey.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <ba39b6ea-a1cc-2724-6988-2fd335c9a3aa@gmail.com>
Date: Sat, 5 Dec 2020 05:56:19 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1
MIME-Version: 1.0
In-Reply-To: <d12dfc98-bf1a-66dc-6d60-0b53887114e7@strongkey.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/tjvF1e5mFqNpkMGl8UQMl8pb_tw>
Subject: Re: [jose] Question regarding RFC 7515
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.29
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: <https://mailarchive.ietf.org/arch/browse/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: Sat, 05 Dec 2020 04:56:28 -0000

On 2020-12-02 04:26, Arshad Noor wrote:
> Hi,

Hi Arshad,

> 
> I have a few questions on the use of the "x5c" header parameter for
> which there is insufficient guidance.
> 
> 1) Section 4.1.6 (X.509 Certificate Chain) states that the "..chain is
> represented as a JSON array..". However, it is not clear whether a
> single certificate still needs to be enclosed within an array if one is
> using a self-signed certificate, and when using "Flattened JWS JSON
> Serialization Syntax".

It is always an array of JSON strings (=certificates).

> 2) Section 6 (Key Identification) states that "..Header parameters ..
> "x5c" .. MUST be integrity protected if the information ...is to be
> utilized in a trust decision. I take this to read that, when using the
> flattened JWS JSON serialization, "x5c" must be included in the
> "protected" attribute.
> 
> In Section 4.1.1 (Algorithm), the RFC states "This Header Parameter MUST
> be present .." and in Section 5.1 (Message Signature), "..(algorithm)
> Header Parameter MUST be present in the JOSE Header..". This implies
> that "alg" is part of the "protected" section of the JWS.
> 
> However, there is no guidance on how the "protected" attribute must be
> encoded when both, "alg" and "x5c" are present in the JWS. It seems
> logical that it would be encoded as a sub-JSON object; but there is
> neither any guidance nor an example of what is canonical here.

The contents of the "protected" attribute is identical to the header for compact serialization.  That is, a base64url encoded JSON object holding JOSE header data.

> 
> Second, if one creates a sub-JSON for "protected" in a "Flattened" JWS,
> should the "protected" attribute remain in text form or should it be
> Base64Url encoded before being signed?

Flattened JWS is just about taking the JWS compact elements apart.  You can create a valid Flattened JWS from a Compact JWS without any computations.

> 
> 3) Appendix B shows an example of an X.509 Certificate Chain using
> Base64-encoded strings to represent certificates. While this will work
> with most code, is there any rationale for departing from the PKI
> industry practice of using PEM encoded certificates for textual
> representations (considering the JWS JSON Serialization is not concerned
> with space limitations)? This advice is mandated in Section 4.1.5 for
> "x5u", referencing Section 6.1 of RFC 4945, but not so for "x5c".

The rationale for the "x5c" syntax is that it is "closer" to PEM than base64url :)

If you are looking for a more JSON-oriented signature solution you might take a look at:
https://www.ietf.org/archive/id/draft-jordan-jws-ct-00.html

Regards,
Anders

> 
> Thank you.
> 
> Arshad Noor
> StrongKey
> 
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose
>