Re: [jose] NIST Concat KDF

"Richard L. Barnes" <rbarnes@bbn.com> Fri, 09 November 2012 06:56 UTC

Return-Path: <rbarnes@bbn.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 81BA721F8B83 for <jose@ietfa.amsl.com>; Thu, 8 Nov 2012 22:56:42 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.849
X-Spam-Level:
X-Spam-Status: No, score=-106.849 tagged_above=-999 required=5 tests=[AWL=-0.250, BAYES_00=-2.599, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jS7tjeDXaJ4W for <jose@ietfa.amsl.com>; Thu, 8 Nov 2012 22:56:41 -0800 (PST)
Received: from smtp.bbn.com (smtp.bbn.com [128.33.0.80]) by ietfa.amsl.com (Postfix) with ESMTP id B3A0C21F8B80 for <jose@ietf.org>; Thu, 8 Nov 2012 22:56:41 -0800 (PST)
Received: from [128.89.253.120] (port=57398) by smtp.bbn.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from <rbarnes@bbn.com>) id 1TWiW5-000MDS-Q3; Fri, 09 Nov 2012 01:56:37 -0500
Content-Type: text/plain; charset="windows-1252"
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
From: "Richard L. Barnes" <rbarnes@bbn.com>
In-Reply-To: <255B9BB34FB7D647A506DC292726F6E115001D5886@WSMSG3153V.srv.dir.telstra.com>
Date: Fri, 09 Nov 2012 01:56:37 -0500
Content-Transfer-Encoding: quoted-printable
Message-Id: <E9C173CB-C714-453E-8392-9CF6FC77B91F@bbn.com>
References: <4E1F6AAD24975D4BA5B168042967394366880D09@TK5EX14MBXC285.redmond.corp.microsoft.com> <CE8995AB5D178F44A2154F5C9A97CAF40252198DCF55@HE111541.emea1.cds.t-internal.com> <4E1F6AAD24975D4BA5B16804296739436688123A@TK5EX14MBXC285.redmond.corp.microsoft.com> <CE8995AB5D178F44A2154F5C9A97CAF40252199B9114@HE111541.emea1.cds.t-internal.com> <BF7E36B9C495A6468E8EC573603ED94115076832@xmb-aln-x11.cisco.com> <4E1F6AAD24975D4BA5B16804296739436688296F@TK5EX14MBXC285.redmond.corp.microsoft.com> <CAHcDwFwAD-EJBytkYE0q0GPZduKJUnvO8s69wTbZjZt2Cgo+Lg@mail.gmail.com> <255B9BB34FB7D647A506DC292726F6E114FFB9FC5D@WSMSG3153V.srv.dir.telstra.com> <255B9BB34FB7D647A506DC292726F6E115001D5886@WSMSG3153V.srv.dir.telstra.com>
To: "Manger, James H" <James.H.Manger@team.telstra.com>
X-Mailer: Apple Mail (2.1499)
Cc: "jose@ietf.org" <jose@ietf.org>
Subject: Re: [jose] NIST Concat KDF
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: Fri, 09 Nov 2012 06:56:42 -0000

If implementing Concat is this much work, why not just use longer keys?

On Nov 7, 2012, at 8:18 PM, "Manger, James H" <James.H.Manger@team.telstra.com> wrote:

> JOSE is inching closer to properly using NIST 800-56A Concat key derivation function (KDF), but there is still a sizeable gap.
>  
> The latest changes (draft-ietf-jose-json-web-algorithms-07) add length prefixes to PartyUInfo and PartyVInfo.
> However, the AlgorithmID field doesn’t have a length prefix; nor does SuppPubInfo or SuppPrivInfo.
> The remaining ambiguity in the KDF input is less practical to exploit than the “JoBethAnne” example that was previously possible, but theoretical ambiguity remains. Can’t the spec just do what NIST 800-56A says if it really wants to use it?
>  
> Defining “apu” and “apv” to hold PartyUInfo and PartyVInfo values is only pretending to support NIST 800-56A. NIST 800-56A says they need to be mandatory (non-null) and they need to be explicitly checked by the recipient — not optional and blindly copied from apu/apv fields to the KDF input.
>  
> The AlgorithmID field is specified as indicating “how the derived keying material will be parsed and for which algorithm(s) the derived secret keying material will be used”. JOSE violates this. The same AlgorithmID value (eg “<00000100>A128CBC+HS256”) is sometimes used to derive a 128-bit AES key, and at other times used to derive a 256-bit HMAC key. The JOSE method is almost certainly “safe” as it uses different SuppPubInfo values (“Encryption” and “Integrity”) in these cases — but it is not NIST 800-56A Concat. A NIST 800-56A Concat approach would run the KDF once and get out a 384-bit secret that is split into the required 128-bit and 256-bit keys.
>  
> --
> James Manger
>  
> From: jose-bounces@ietf.org [mailto:jose-bounces@ietf.org] On Behalf Of Manger, James H
> Sent: Wednesday, 31 October 2012 12:13 AM
> To: jose@ietf.org
> Subject: [jose] NIST Concat KDF
>  
> JOSE still doesn’t use the NIST 800-56A Concat Key DF as that specification requires.
>  
> JWA allows PartyUInfo and/or PartyVInfo to be empty (if apu/apv/epu/epv are absent). That doesn’t comply with 800-56A that says “at a minimum, PartyUInfo shall include IDu, the identity of party U”. 800-56A also says “it is required that identifier for both parties to a key agreement transaction be included in the OtherInfo that is input to the key derivation function”.
>  
> 800-56A requires that the concatenation AlgorithmID || PartyUInfo || PartyVInfo be unambiguous. It allows two ways to achieve this: pre-define fixed sizes for components; or prefix each component with its length. JWA does neither of these.
>  
> Consider two JOSE messages (ignoring some irrelevant base64url encoding):
>   { ..., "apu":"JoBeth", "apv":"Anne" } and
>   { ..., "apu":"Jo", "apv":"BethAnne" }
> JWA implies both use the string "JoBethAnne" in the KDF despite the messages being between different parties, which defeats this part of the Concat KDF design.
>  
> JWA explicitly puts the key length and "alg" value into the AlgorithmID field that the KDF uses. However, the "alg" value alone must imply one specific key length for the rest of the JOSE processing to work so including the key length explicitly is redundant.
>  
> 800-56A is designed to derive integrity and encryption keys together. For instance, it says “AlgorithmID might indicate that bits 1-80 are to be used as an 80-bit HMAC key and that bits 81-208 are to be used as a 128-bit AES key”. JWA does not do this. JWA runs the KDF twice to derive integrity and encryption keys separately.
>  
> If we want to use NIST 800-56A Concat KDF then JWA/JWE needs lots of fixes.
> If we want a simpler KDF then JWA shouldn’t pretend it is the NIST 800-56A Concat KDF.
>  
> --
> James Manger
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose