Re: [Cfrg] Multi-recipient public key authenticated encryption

Neil Madden <> Mon, 27 April 2020 15:53 UTC

Return-Path: <>
Received: from localhost (localhost []) by (Postfix) with ESMTP id 56D933A0864 for <>; Mon, 27 Apr 2020 08:53:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Status: No, score=-2.097 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: (amavisd-new); dkim=pass (2048-bit key)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id 2MyHlxmbYJfs for <>; Mon, 27 Apr 2020 08:53:46 -0700 (PDT)
Received: from ( [IPv6:2a00:1450:4864:20::32a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by (Postfix) with ESMTPS id B2B383A0775 for <>; Mon, 27 Apr 2020 08:53:46 -0700 (PDT)
Received: by with SMTP id x4so178462wmj.1 for <>; Mon, 27 Apr 2020 08:53:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=7ehH0chgnEw1zWoJw3E1SJY5lTPl/+SfQ347dVI/4oY=; b=FHug8Ki1xJ3G/Frkny2WnHWH0CgD6smD5h32k9Yuy26MdbJClsqCMJzPixg69jdp0X L/PuNOcCsT9Hn0zIXK4R+3tNGTf7AJuWhP8ZZ9fLnQ0yC9dqXvYH7yqylSEyzGfqSWWn qoxfgMhLkq9INl7yJAcqHbuZiNsot01/F7zgR9uBOvWkHy6AudelZOOC3/tT/99j1/Vv 9WtC3GUzwrOAlLt8c1GVluEVG2tHJqoVhb1PNeBZ8YUOZiT0RsY4yAmUzDJrZByBvfJb lGOl/UlQ6hze+C2s6zJgIeAN3K7xP5d0UavldjIZCc4yIGppBrKMCG0SAZ0y6c9QVK05 pDGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=7ehH0chgnEw1zWoJw3E1SJY5lTPl/+SfQ347dVI/4oY=; b=jl23xdvlu6EoDgouC9iWQzbPnQtPAbo98nOM1fKh2mfT9oJKv3GWqKqmxivn87XYxZ I2cE3USe+GAuX+ZmrGcHkH5Ahz0iUyRNOsfKSD9G/A8VVNc5c9uDvvm+sh9Yj2XIuRvf NQYXEpTeEwHKu/pVAlLmnEtviQNvgqC93wYOxWr/GKrS+0D2qgQ/NmScebSP1B1itxC0 R5f3qsndN33Hf+KeuS8lz1eefPfrgpnoSwDkwFA2LrkCuau5nSWWXmBxXsdO1/cnm2NC HHVSgY9qLWYXWxyUk6q8hkOQJpnSwir1ogljHNkTF6hRVM6umXPVZuT81ziHhTVoQ5JB tgEw==
X-Gm-Message-State: AGi0Pub5lhshWXOWLGJIRZNpVkBY46lz3j2Fak7BFgKiaqeq+Z8QqmKC DfG1S+lcXXxKFNhrubRH6A0=
X-Google-Smtp-Source: APiQypI4g+0LEjnk4zi4Y1aVjwEatJMLKCcQPnntoTkr1VjR0LmLVXFWBWctgHo4/dBNPkHTFQJKdA==
X-Received: by 2002:a05:600c:c5:: with SMTP id u5mr156490wmm.134.1588002825059; Mon, 27 Apr 2020 08:53:45 -0700 (PDT)
Received: from [] ( []) by with ESMTPSA id p6sm21465756wrt.3.2020. (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2020 08:53:44 -0700 (PDT)
From: Neil Madden <>
Message-Id: <>
Content-Type: multipart/alternative; boundary="Apple-Mail=_2D424718-A0C5-428E-AAC3-0591DA7C74FB"
Mime-Version: 1.0 (Mac OS X Mail 13.0 \(3608.\))
Date: Mon, 27 Apr 2020 16:53:43 +0100
In-Reply-To: <>
Cc: CFRG <>
To: Paul Grubbs <>
References: <> <>
X-Mailer: Apple Mail (2.3608.
Archived-At: <>
Subject: Re: [Cfrg] Multi-recipient public key authenticated encryption
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Crypto Forum Research Group <>
List-Unsubscribe: <>, <>
List-Archive: <>
List-Post: <>
List-Help: <>
List-Subscribe: <>, <>
X-List-Received-Date: Mon, 27 Apr 2020 15:53:49 -0000

The details of the original proposed scheme are in the linked draft or are in NIST SP 800-56A. To summarise, if Alice wants to encrypt a message and send it to both Bob and Charlie she carries out the following steps (with some minor details of syntax elided):

1. Generate a random CEK and use it to encrypt the message content using some symmetric AEAD scheme producing authenticated ciphertext, C.
2. kek_bob = KDF(ECDH(ephemeral_private, bob_public) || ECDH(alice_private, bob_public) || context_bob)
3. kek_charlie = KDF(ECDH(ephemeral_private, charlie_public) || ECDH(alice_private, charlie_public) || context_charlie)
4. bob_box = AES-KW(kek_bob, CEK)
5. charlie_box = AES-KW(kek_charlie, CEK)
6. Send bob_box || charlie_box || ephemeral_public || C

Here the context arguments are typically the public keys involved and any additional identifiers for the parties involved. The new proposal is to also mix in SHA-512(C) into this KDF calculation as additional context.

The threat model here is that Alice sends a message to Bob and Charlie stating that Bob is in charge while she is on holiday. Charlie uses the shared CEK to create a new message saying “Oops, I meant that Charlie is in charge.” and sends that to Bob with the original encrypted keys (i.e., Charlie just replaces C). This new message from Charlie validates as if it came from Alice. I’d like to stop this kind of attack.

My assertion is that if you mix SHA-512(C) into the KDF calculation then Charlie needs to find a 2nd preimage of SHA-512 to pull off this attack. (I’m using SHA-512 as an example, actually JOSE already uses SHA-256 in its KDF so I’ll probably use that).

— Neil

> On 27 Apr 2020, at 16:10, Paul Grubbs <> wrote:
> This sounds like a really interesting question, but I'm having trouble understanding your proposed scheme - can you give a bit more detail? 
> I also don't quite understand the threat model. Are you trying to prevent a malicious receiver from "forging" a new payload that looks like it came from the sender?
> On Mon, Apr 27, 2020 at 10:12 AM Neil Madden < <>> wrote:
> Hi all,
> I am working on an enhancement to the JOSE standards and would like feedback from members of CFRG about solutions to a particular issue if any of you have time.
> In JOSE currently if you wish to create a message that has both confidentiality and sender authentication using public key cryptography then the only option is to both sign and then encrypt the message. This is expensive because it involves multiple passes over the message and results in a very bulky nested message structure with two layers of base64-encoding.
> Given that many uses of this sign-then-encrypt pattern do not require the strong security properties of signatures, I have proposed [1] a public key authenticated encryption mode based on NIST’s one-pass unified model from SP 800-56A. This avoids the nested structure and means that you don’t need multiple cryptographic primitives. The proposed algorithm uses two ECDH key agreements: one between the sender’s ephemeral private key and the recipient’s long-term public key; and a second between the two parties’ long term keys. The two shared secrets are concatenated and passed through a KDF along with some context arguments. For a single recipient this achieves sender authentication (subject to replay), and the single recipient case is what I am primarily concerned about.
> (If you squint this is also roughly similar to the Noise framework “K” one-way pattern, but my hands are waving quite a lot here).
> To support multiple recipients I copied the existing pattern used in JOSE’s ECDH-ES+A256KW algorithm family in which the message is encrypted using a random Content Encryption Key (CEK) and then the CEK is encrypted for each recipient using AES-KeyWrap with the ECDH-derived key. As I then mention in the security considerations this leads to any recipient being able to produce a forgery using that CEK and claim it came from the original sender:
>    When Key Agreement with Key Wrapping is used, with the same Content
>    Encryption Key (CEK) reused for multiple recipients, any of those
>    recipients can produce a new message that appears to come from the
>    original sender.  The new message will be indistinguishable from a
>    genuine message from the original sender to any of the other
>    participants.  To avoid this attack, the content SHOULD be encrypted
>    separately to each recipient with a unique CEK or a nested signature
>    over the content SHOULD be used.
> Because I am primarily interested in single-recipient use cases, this seemed like an acceptable trade-off. However, I have since been contacted by people who would like to use this draft for multi-recipient messages and would not like to fall back on a nested signature structure.
> An initial proposal was to solve this by simply including the MAC tag from the content encryption in either the per-recipient payload (encrypted using AES-KeyWrap) or as an additional context field to the KDF. But the MAC is computed using the CEK that is known to all recipients, so for this to be secure would require second preimage resistance of the MAC with a known key, which cannot be guaranteed for JOSE because it supports content encryption using AES-GCM for which second preimages can be trivially computed if you know the key.
> Assuming that a per-recipient MAC is too much overhead, an alternative would be to include a collision-resistant hash of entire ciphertext (and IV and associated data) in the KDF. This is unfortunate as it requires another pass over the entire message when we’ve already encrypted and MACed, but it appears to be a solution and at least is no more inefficient than the original signed-then-encrypted approach which also needs to hash the entire message.
> So two questions:
> 1. Is including a hash (e.g., SHA-512) of the ciphertext (assuming symmetric AE) in the per-recipient KDF calculation sufficient to prevent forgeries in the multi-recipient setting?
> 2. Are there more efficient alternatives that don’t assume 2nd preimage resistance of the underlying symmetric MAC?
> [1]: <>
> Kind regards,
> Neil Madden
> _______________________________________________
> Cfrg mailing list
> <>
> <>