[jose] Re: draft-ietf-jose-hpke-encrypt-01

Les Hazlewood <lhazlewood@gmail.com> Mon, 08 July 2024 17:06 UTC

Return-Path: <lhazlewood@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 790A1C14F74A for <jose@ietfa.amsl.com>; Mon, 8 Jul 2024 10:06:03 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.094
X-Spam-Level:
X-Spam-Status: No, score=-2.094 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3ZK3xI_wE-aj for <jose@ietfa.amsl.com>; Mon, 8 Jul 2024 10:05:59 -0700 (PDT)
Received: from mail-yw1-x112e.google.com (mail-yw1-x112e.google.com [IPv6:2607:f8b0:4864:20::112e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B78CBC1E0441 for <jose@ietf.org>; Mon, 8 Jul 2024 10:05:54 -0700 (PDT)
Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-64b3655297aso40468427b3.1 for <jose@ietf.org>; Mon, 08 Jul 2024 10:05:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720458353; x=1721063153; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=5+l54KGm9ENhAaPeI98QMFhseV0yNmU5QDjR8zqNqZI=; b=nni/4W0jFcD+hC51tJwQQj/+5EzKsrXdW5T4bpM0kEbIIeJfFOZcTqGiiElLhkmGF3 sPo70PQf7uTs+nWFAybvBwwysY8TIbA2ZBTRrzl4G7w2bOg96NMJ05eUzTI9qRGpRnbJ J2C0UKGXlNBfc/HKGpDvYcbHBQXUC+2N6+2W9DkoMjS5YI/hVWMqIMsTd4So+7dgJ1jl yoXmiFyMYkh+s8Yk4zEu9shI/Bg1K4pgxZnr5D109zZFpt7/xe22s9xF5H+xpllHBAR0 M+6IACRp6ogw0nLfAWJdVozrPPZcsjrq34cu+y3MHZ1xb13PscKVUiy5KQ7PAx8M03NE VzVA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720458353; x=1721063153; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5+l54KGm9ENhAaPeI98QMFhseV0yNmU5QDjR8zqNqZI=; b=haPJKg2soWWhcy2Yrz+2BUYAaFJrhtly4MPUPjaBokqPh4Sk7QnxCUyjQvguIzq3JZ eUilCsA4Crl4o5u97HpONvacG5/0NrQ/lqC1obEqA6s70wbCnWLd0uJHro83YCBtui86 drJ0JYQei6JXznx1XDBAom7oydnAtZdqbL9HXuPkvbkrC5Ny2TOnX3Tx2B0R0eCack2F 4Hzjk+wAYGkwHxGBlnCTdoXVxu34w1OO8SiozwLbQVUMhy+/DCgWLhj4hlOE3yl+YAka FxehoFzfrsk2sRRH2t3xSQQX96ZnjQ5WFwitpuP12A91w8P9CFMkxvI6ODdhD0jvc4RM uzPg==
X-Gm-Message-State: AOJu0Yx8CHO+pVhz7BFCUBjY59Co06W3+Wl+0IV6IPqF6T+I/j4uQv7b 5Pg8zFBTDqNtP15F/GhXdMSZhyAbaE9ZnC/hsEyK0GGVwczo2zfGhprjm3JH+KpW9D20hd5npgu JHPEj9esP18vrWMqWcPPOfWDJBSU=
X-Google-Smtp-Source: AGHT+IHC/VTnD07o/005AQGkCVSrNtTww+M5ZG/qmSYeTF6lfcyJZm73+yDJg7f18863QA+PfBuIGs+UT9+fRndBXjk=
X-Received: by 2002:a05:690c:3385:b0:62f:2553:d3b3 with SMTP id 00721157ae682-658ef3414eemr4485177b3.29.1720458353326; Mon, 08 Jul 2024 10:05:53 -0700 (PDT)
MIME-Version: 1.0
References: <CAN8C-_KMx_M9vL3kwoohkiVrndU_MohxdGC_vLkBo7R_+-6T2g@mail.gmail.com> <CACVbtYOsf7MkHPOzFgE14JhKrSzAd8EkZ0Sr4X0XRMzdCUtbkA@mail.gmail.com>
In-Reply-To: <CACVbtYOsf7MkHPOzFgE14JhKrSzAd8EkZ0Sr4X0XRMzdCUtbkA@mail.gmail.com>
From: Les Hazlewood <lhazlewood@gmail.com>
Date: Mon, 08 Jul 2024 10:05:41 -0700
Message-ID: <CACVbtYOOpwTKZt7dH7JV983SmU7gRbsaXY8ru4Ty-+S081oTEQ@mail.gmail.com>
To: Orie Steele <orie@transmute.industries>
Content-Type: multipart/alternative; boundary="0000000000000040fa061cbf6db6"
Message-ID-Hash: R2NQ76DNC7JRISYN2MHNM6KN7DJKOU5I
X-Message-ID-Hash: R2NQ76DNC7JRISYN2MHNM6KN7DJKOU5I
X-MailFrom: lhazlewood@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-jose.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: JOSE WG <jose@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [jose] Re: draft-ietf-jose-hpke-encrypt-01
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/CC8y3YyvHX3v769GJwiBS9Xqak0>
List-Archive: <https://mailarchive.ietf.org/arch/browse/jose>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Owner: <mailto:jose-owner@ietf.org>
List-Post: <mailto:jose@ietf.org>
List-Subscribe: <mailto:jose-join@ietf.org>
List-Unsubscribe: <mailto:jose-leave@ietf.org>

Apologies, I misread the compact form in the version 01 draft - it does
indeed included the cek ciphertext, but not the iv or aad tag.  But my
comments/questions about mandatory `alg` and `enc` values are still valid I
believe.

On Mon, Jul 8, 2024 at 9:58 AM Les Hazlewood <lhazlewood@gmail.com> wrote:

> Thanks Orie,
>
> As a long-time implementer and maintainer of a widely used JOSE library,
> I'm have some concerns that I hope could be addressed.  Admittedly, most of
> my questions are relevant to single recipient and compact (JWT) forms.
>
> I don't think for JWE there should ever be an omitted `alg` header
> parameter: its omission and/or 'none' value can and has caused security
> problems in the past for parsers and this feels like opening a can of worms
> again.  Further, it adds cyclomatic complexity (conditionals) for
> validation assertions that, I hope, shouldn't ever be necessary.
> Non-absent deterministic values are so much nicer and reduce potential
> problems.
>
> The way `alg` has always worked (conceptually at least) IMO from a library
> implementor point of view is it means "the algorithm used to obtain the
> AEAD content encryption key and its potentially associated ciphertext".
>  `enc` is "the algorithm used to AEAD encrypt the payload".  That is,
> (pseudocode):
>
> enc_alg = enc_registry.find( header['enc'] )
> key_alg = alg_registry.find( header['alg'] )
> kek = keystore.find( header['kid'] )
> cek, cek_ciphertext = key_alg((kek, encAlg, header)
>
> For JWE:
>
> - No `alg` inherently means "there isn't a way to obtain an cek/cdk".
> - No `enc` means "the payload is not encrypted", so both must always be
> present for JWE.
> - No JWE ciphertext token in the compact JWE string means 'there is no
> encrypted key ciphertext', when clearly there is (encapsulation).
>
> I could be missing something (and happy to be educated accordingly), but I
> would really like to see the HPKE work maintain these existing constructs -
> changing them to introduce additional complexity is not an intuitive, nor
> safe, idea IMO.
>
> Respectfully,
>
> Les Hazlewood
> JJWT author/maintainer
>
> On Sun, Jul 7, 2024 at 3:17 PM Orie Steele <orie@transmute.industries>
> wrote:
>
>> Hello,
>>
>> I have done my best to apply all the feedback gathered from the adoption
>> call, and I want to draw your attention to the latest draft, and its
>> primary remaining obstacles for discussion at ietf 120.
>>
>> In my haste, I may have destroyed something essential. Apologies to my
>> co-authors, feel free to roast me at the mic line.
>>
>> Be advised the github repo for the working group adopted draft is
>> currently here, PRs are welcome:
>>
>> https://github.com/OR13/draft-ietf-jose-hpke-encrypt
>>
>> As you can see from the document history -01 addresses several points of
>> feedback, and uses the terminology and guidance regarding algorithm names
>> provided by Ilari and others.
>>
>> Major changes in this version:
>>
>> - JWK is no longer used for encapsulated keys, but "encrypted_key" JWE
>> member and "ek" header parameter are.
>> - HPKE mode (base / auth / psk / psk_auth) is no longer included in
>> algorithm registrations.
>> - HPKE Setup info and aad are addressed in a single location for both
>> integrated and key encryption with hpke.
>> - "dir" approach has been replaced with "enc": <some registered aead>.
>> - "jwe aad" examples have been added.
>> - "psk_id" and "auth_kid" examples have been added.
>>
>> I've implemented version -01, and the examples are produced from my
>> prototype.
>>
>> Risk areas, and things which we would like to resolve ASAP.
>>
>> ### Fully specified HPKE algorithms
>>
>> It would be nice to have confidence that the algorithm names will not
>> change.
>>
>> For example where we currently see:
>>
>> ```
>> "alg": "HPKE-P256-SHA256-A128GCM",
>> "enc": "A128GCM",
>> ```
>>
>> We might see:
>>
>> ```
>> "alg": "HPKE-P256-SHA256",
>> "enc": "A128GCM",
>> ```
>>
>> Or whatever the working group decides counts as a "fully specified HPKE
>> algorithm".
>>
>> ```
>> "alg": "HPKE-P256-SHA256+A128KW", ?
>> ```
>>
>> ### HPKE AAD vs JWE AAD
>>
>> I think the current approach is better than computing some custom KDF
>> info from apu / apv... But is setting the following as HPKE AAD enough?
>>
>> hpke-info = empty
>> hpke-aad = encode-protected-header . aad (when JWE aad is available)
>>
>> Where encoded protected header is either the protected header for
>> hpke jwe integrated encryption, or the protected header used in content
>> encryption, for which the content encryption key is being encrypted?
>>
>> ### Lossy conversions
>>
>> It's possible to express things in JSON Serialization that can't be
>> expressed in Compact serialization.
>> I tried to make this explicit, but we could decide to simply forbid
>> conversions from JSON to Compact that lose information, or that would move
>> things around "ek" to "encrypted_key".
>>
>>
>> Thanks for all the feedback during the adoption call.
>>
>> Regards,
>>
>> OS
>>
>> --
>>
>>
>> ORIE STEELE
>> Chief Technology Officer
>> www.transmute.industries
>>
>> <https://transmute.industries>
>> _______________________________________________
>> jose mailing list -- jose@ietf.org
>> To unsubscribe send an email to jose-leave@ietf.org
>>
>