[jose] Re: draft-ietf-jose-hpke-encrypt adoption call feedback and prototype

Orie Steele <orie@transmute.industries> Mon, 24 June 2024 16:49 UTC

Return-Path: <orie@transmute.industries>
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 44B93C1840ED for <jose@ietfa.amsl.com>; Mon, 24 Jun 2024 09:49:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.095
X-Spam-Level:
X-Spam-Status: No, score=-2.095 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, 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=transmute.industries
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 C8s6P5CGjQC5 for <jose@ietfa.amsl.com>; Mon, 24 Jun 2024 09:49:10 -0700 (PDT)
Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) (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 456B3C1930D8 for <jose@ietf.org>; Mon, 24 Jun 2024 09:49:10 -0700 (PDT)
Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f4c7b022f8so39763695ad.1 for <jose@ietf.org>; Mon, 24 Jun 2024 09:49:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=transmute.industries; s=google; t=1719247749; x=1719852549; 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=XcDiofGBz1w0q4+slokgG/J2ro6c/hGxF+lysiMZ2rc=; b=L92QBxs2wM1n9vgEAniBcPbhmzvfD+8NNaIhULgXq50Ra00fmeS8ElfwZ0/SviZomj 4fiWb7kvsmKDxlsqIiwk9LrUyfwiQRctM9O0r5muR21JjBg3+YX5DhKtLlp/A6Z2wBhQ v77VI+Ug0qZg+2KL/TIdsj+KhpYy5n3R5+zcwbAOqeIDT6OIPtpeKqtTwG9mceYP8Hgc Aycn+HbO0loalmJr5zf7I8V1Z/DGGd65pO9qTrYKnv/Uk4tL/w9N41l+RDaiuFFuOrwd Pe6LDe0ZS0SRfx2d6Uo0QSykSZrOwz5SEso24HFHMm5J5WMc0Ll0ZJCdu2iJt8SQ0EZu UDzA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719247749; x=1719852549; 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=XcDiofGBz1w0q4+slokgG/J2ro6c/hGxF+lysiMZ2rc=; b=KK49B8+DYE/doKJ86wYCYb6ytnaDNzF/lqkm5rUD7Fxjd/dv1I3TSAADJJbVmLi09W X7rDhBgqJmq/jxA5+FgnOuKikWe9bsZc4wVID/nMxZUEKrFj0QPsCAuV2wpD1/QmEnTY RpUtOKEpRbkzMUfcINdwKuW6iFTfr3aCjcK9DT7Zw4SYb+7QjtjTng9UtI7LC4caFNVt bB5CWphJ8YsHRtmu4zvhw7dwVMhZ95EP+ZJXU4tvl6QA9KBJi0On2qvUIF17drCS7D/c zkLGRWKjdGqWMIMimtK2MGn0tqBRPbx9MezqDNGsV8rCQxpj2lXVK2yeV3uqRt/K3jm7 gO7A==
X-Gm-Message-State: AOJu0YxXo7RX+cvhzemHqTQPT5e5uFiPaVdWlG7Jb5fC236DRhvy9D6A 2gBByJd0zsdEcNcXSO7C26Cpc1UcCGy7376ai18hHahBV0BOfX/OeiHwEbUrfla8aA8oRlJF2bQ adOoY1tiAlwtFmSmh+luE8L1S8N2hlJhsR6Jdhg==
X-Google-Smtp-Source: AGHT+IHEHmjTbvoVpPT2ELtWm70fDRsMZdf4VJrNjLdMZFsAqplp0evkRvu3BM11RABi+Zgwr9MVwRhoB2IBtiQHhgs=
X-Received: by 2002:a17:90a:ec02:b0:2b6:c650:fb54 with SMTP id 98e67ed59e1d1-2c8614acf87mr3702741a91.49.1719247749137; Mon, 24 Jun 2024 09:49:09 -0700 (PDT)
MIME-Version: 1.0
References: <CAN8C-_KLwCjfj2_gOUM6jF_4jv8-w7UZC1hzDWpNSHP6OpQe6Q@mail.gmail.com> <Znc3N4jZ9UpcCdcJ@LK-Perkele-VII2.locald>
In-Reply-To: <Znc3N4jZ9UpcCdcJ@LK-Perkele-VII2.locald>
From: Orie Steele <orie@transmute.industries>
Date: Mon, 24 Jun 2024 11:48:58 -0500
Message-ID: <CAN8C-_Jc9fk4Q2KhOnXmx+KTw5sijydUKWb0nqkeMgWYcrY3dg@mail.gmail.com>
To: Ilari Liusvaara <ilariliusvaara@welho.com>
Content-Type: multipart/alternative; boundary="0000000000005e6276061ba58f4e"
Message-ID-Hash: BRNAEPIF234NTFKRDSGTDVEBUVWJITED
X-Message-ID-Hash: BRNAEPIF234NTFKRDSGTDVEBUVWJITED
X-MailFrom: orie@transmute.industries
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 adoption call feedback and prototype
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/jose/K_TRJ2yxf85fxfWb22kyo_Pt1bU>
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>

I replied to Ilari offlist by accident, but I hope he will clarify some of
the comments he made regardless.

I just stumbled across this:
https://github.com/eu-digital-identity-wallet/eudi-doc-architecture-and-reference-framework/issues/200#issuecomment-2183701761

Which seems relevant to his comment about HPKE AuthMode at the end.

Regards,

OS

On Sat, Jun 22, 2024 at 3:42 PM Ilari Liusvaara <ilariliusvaara@welho.com>
wrote:

> On Sat, Jun 22, 2024 at 12:32:42PM -0500, Orie Steele wrote:
> > Hello,
> >
> > I've created yet another prototype HPKE implementation to consider
> feedback
> > we got from the adoption call.
> > I know folks are struggling to follow along with HPKE details, but I'm
> > going to address several points of feedback in this email to avoid
> creating
> > separate threads for each topic.
> > To make this bearable (bearer token joke), I have focused only on compact
> > JWEs for use as JWTs.
> >
> > As you can see from:
> >
> https://github.com/transmute-industries/hpke/blob/main/tests/jwt.test.ts#L26
> >
> > In the prototype, JWTs are built from { alg:
> > 'HPKE-Base-P256-SHA256-A128GCM', enc: 'A128GCM' }
> > The encapsulated key goes into the JWE Encrypted Key.
> > This is a change from the draft-ietf-jose-hpke-encrypt-00 where the "ek"
> > was placed in the protected header.
> > It eliminates double base64url encoding.
> > The enc value is set to `A128GCM`, this is a change from
> > draft-ietf-jose-hpke-encrypt-00.
>
> Redefining what enc: 'A128GCM' means in JWE is not acceptable.
>
> Any extensions to JWE itself must encode to currently invalid things
> (but compact and JSON serialization may still be used).
>
> And then alg: 'HPKE-Base-P256-SHA256-A128GCM' sounds like Key
> Encryption... And JWE is pretty explicit on how that works.
>
>
> > Another exciting topic has been AuthMode and PSK support.
> >
> > draft-ietf-jose-hpke-encrypt-00 requests psk_id and auth_kid headers to
> > support this use case, but does not request algorithms.
>
> For PSK, easiest would be to have presence of psk_id header to select
> PSK mode.
>
> - Senders have to be explicitly configured about PSK to use anyway.
> - Receiver not supporting PSK will get decryption failure anyway.
>
> Auth is rather nasty can of worms. It is trivially insecure in
> presence of multiple recipients, and still has security issues
> even with one recipient (because HPKE fails Insider-Auth).
>
>
> > I've now done a first attempt here:
> >
> https://github.com/transmute-industries/hpke/blob/main/tests/jwt-auth-psk.test.ts
> >
> > The headers  "psk_id" and "auth_kid" should be optional, but I believe it
> > is important to distinguish "auth mode psk" from "base" mode:
> >
> > - HPKE-Base-P256-SHA256-A128GCM
> > - HPKE-Auth-P256-SHA256-A128GCM
> > - HPKE-AuthPSK-P256-SHA256-A128GCM
> > - HPKE-PSK-P256-SHA256-A128GCM
> >
> > This is sad, because it will result in registry bloat per mode.
> >
> > We could consider making the "mode" a dependent parameter of the
> algorithm,
> > but then we lose the ability to distinguish keys which support auth mode
> > from those that do not.
>
> This sounds bit similar to ECDH-SS. While JOSE does not have that, COSE
> does. What does COSE do with ECDH-SS sender keys?
>
> And then one might want to restrict keys to HPKE, but no further.
>
>
> > Now seems like a great time to talk about use cases for HPKE based JWTs,
> so
> > we know which algorithms are actually needed.
>
> For base mode, the only algorithms that JWE has no substitute for is
> the post-quantum stuff.
>
> Yes, HPKE might be a bit more compact, but I doubt people seriously
> golfing bytes are using JWTs.
>
>
> > As you can see, the latest editors copy includes some guidance on use of
> > HPKE:
> >
> >
> https://paulbastian.github.io/draft-bastian-dvs-jose/draft-bastian-dvs-jose.html#name-designated-verifier-signatur
> >
> > If this document were to register algorithms there would be substantial
> > overlap with HPKE Encrypted JWT use cases.
> >
> > I believe that draft-ietf-jose-hpke-encrypt based JWTs can support the
> use
> > case that draft-bastian-jose-alg-ecdh-mac is targeting.
>
>
> HPKE auth mode has property that compromising receiver key allows
> unlimited forgery.
>
> And looks like to enable unlimited forgeries from a single sender, it
> requires leaking just a single DH result (receiver private key times
> sender public key).
>
>
>
>
>
> -Ilari
>
> _______________________________________________
> jose mailing list -- jose@ietf.org
> To unsubscribe send an email to jose-leave@ietf.org
>


-- 


ORIE STEELE
Chief Technology Officer
www.transmute.industries

<https://transmute.industries>