Re: [Webpush] Major change to encryption

Peter Beverloo <beverloo@google.com> Mon, 31 October 2016 23:39 UTC

Return-Path: <beverloo@google.com>
X-Original-To: webpush@ietfa.amsl.com
Delivered-To: webpush@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ABB7B127078 for <webpush@ietfa.amsl.com>; Mon, 31 Oct 2016 16:39:15 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.197
X-Spam-Level:
X-Spam-Status: No, score=-4.197 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-1.497, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.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 7WLYk7tSnETO for <webpush@ietfa.amsl.com>; Mon, 31 Oct 2016 16:39:13 -0700 (PDT)
Received: from mail-wm0-x235.google.com (mail-wm0-x235.google.com [IPv6:2a00:1450:400c:c09::235]) (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 04308127077 for <webpush@ietf.org>; Mon, 31 Oct 2016 16:39:12 -0700 (PDT)
Received: by mail-wm0-x235.google.com with SMTP id t79so78862873wmt.0 for <webpush@ietf.org>; Mon, 31 Oct 2016 16:39:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PeE9WI2moDDL/BN5lPReM4NJGUUuIXZWln6AdJOgYv4=; b=SY/zmfhV3wZCvOBiSulmkSszGPeXYXICq4r6fq0OGcsGkaKY5Sd2fmB0PxBdEh7eo7 RwWXGb4ue03BFfu2PdX8v7qKLBtsq92Dz2dfk2PIMIl1EEepMoSD2glVGzCj/G3GiCtQ 8gnxm291VClgF/w/uxUkbN9laZI7TXXvHCqrv37uYLHpQfx4jDOwy2Cw7WZ2JFUoxENL GqMK80Bncnr2CR1zDj13oGaRaubSrk8Mn/ZBeOUYbMHOHvR+Yc3fa+SVpkTUDFx9B6+V jyKr2o2rvTvsCYkBscZLw4LBFtN0wroWW0te8nAqnjtZVxlhgOOxAr0movz37p20U5gy N1jw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PeE9WI2moDDL/BN5lPReM4NJGUUuIXZWln6AdJOgYv4=; b=Ts0ui/+SM6OoJZQt0n8F0Nl7bcsSO0sQyxudJmidGRa1mImZjZXdlYkD1vFLhkeSqa n4eJmSCADw6HxcY/c9c58BWHoeU4hNPvlAQsoS4YaknoRqsCsqfaXmCMnMnPWr+S12/t b3yVCFaR+Ys3dwNrOgEIw9EJ7ZdGU2zld3uwCiEdG/O9HubKPcJouxxmXRshT8jtf5sl RyHHMtBwQFNbnOQ2HtHhnC5eePuA+GBCU+8oX37ttngjhvTB+HHQ8LyuhWsaADlGkWkL 23wz059A09zlxMw15i7zsgwzoDdsmEF7R+pY/ap5flLsoZN8l9hVt9ye/NgQ/71XtRu5 /YtA==
X-Gm-Message-State: ABUngveaDstIxIKJbIVFxPCiMRlafimHPFAPOL1o5Ez8Lb8Laikx+tTbhFNfdli75uTNqqw6BzqhB/uaSJWluJIT
X-Received: by 10.28.27.2 with SMTP id b2mr9153984wmb.59.1477957151361; Mon, 31 Oct 2016 16:39:11 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.80.176.131 with HTTP; Mon, 31 Oct 2016 16:39:10 -0700 (PDT)
In-Reply-To: <da15e3e3-9d20-7e2c-eceb-d369a3529226@mozilla.com>
References: <CABkgnnUiLBOGQ6fSTiLcxn_RKbEHFYHzCAv3OMg_btETfKjRGA@mail.gmail.com> <da15e3e3-9d20-7e2c-eceb-d369a3529226@mozilla.com>
From: Peter Beverloo <beverloo@google.com>
Date: Mon, 31 Oct 2016 23:39:10 +0000
Message-ID: <CALt3x6mSBF9mhbzBZjH09Cm7h8FbU2Q4E9CJbX0QXUckT+V+=Q@mail.gmail.com>
To: jr conlin <jconlin@mozilla.com>
Content-Type: multipart/alternative; boundary=001a114b4210007c91054031b7d0
Archived-At: <https://mailarchive.ietf.org/arch/msg/webpush/da8essBXzrgpSllWzrEk1b2tHUk>
Cc: "webpush@ietf.org" <webpush@ietf.org>
Subject: Re: [Webpush] Major change to encryption
X-BeenThere: webpush@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Discussion of potential IETF work on a web push protocol <webpush.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/webpush>, <mailto:webpush-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/webpush/>
List-Post: <mailto:webpush@ietf.org>
List-Help: <mailto:webpush-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/webpush>, <mailto:webpush-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 31 Oct 2016 23:39:16 -0000

Hi jr,

Your understanding matches mine too.

On Mon, Oct 31, 2016 at 10:47 PM, jr conlin <jconlin@mozilla.com> wrote:

> Perhaps I'm just confused by the various PRs and comments, but if I may,
> i'd like to make sure I'm very clear on what the change is:
>
> The crux of the change is:
> 1) Encrypted content would be identified as "aes128gcm", which should
> not be confused with the now, long obsolete "aesgcm128".
>
> 2) salt, rs, and key_id are now prefixed to the encrypted content as:
> `salt(16)|rs(4)|id_len(1)|key_id(id_len)|encrypted_content`
>
> 3) The content encoding key (CEK) is set to
> ```
> HMAC-SHA-256(
>     HMAC-SHA-256(salt, key[key_id].secret),
>     "Content-Encoding: aes128gcm\x00\x01")  # from 2.2 of
> http://httpwg.org/http-extensions/encryption-preview.html
> ```
>

Yes, if key[key_id].secret contains the IKM that has already seen the
HMAC with the "WebPush: info" info (the context replacement).

   PRK_key = HMAC-SHA-256(auth_secret, ecdh_secret)
   key_info = "WebPush: info" || 0x00 || ua_public || as_public
   IKM = HMAC-SHA-256(PRK_cek, key_info || 0x01)

(So it's not just the shared ECDH secret.)

The majority case will be that `key_id` is not defined (or is ''), in
> which case, we'd use the locally derived key.
>

To be clear, section 4 of webpush-encryption mandates that the `id` field
in the header is the empty string.

Thanks,
Peter


>
> 4) There's no longer a need for "context" to be appended to the key info
> and nonce info, although the Content-Encoding for the new content type
> will use the now obsolete "aesgcm128"
> https://github.com/martinthomson/encrypted-content-encoding/pull/28/
> files#diff-6ee19a23c153fa68b2910aeb69bde1ddR213
>
> 5) The DH secret is now derived from running an HMAC-SHA-256 over
> ```'WebPush: info\x00' + receiverPublicKey + senderPublicKey```
>
> Is that correct? Am I missing something?
>
> On 10/31/2016 3:38 AM, Martin Thomson wrote:
> > Discussion in the HTTP working group has lead to some fairly
> > substantial changes to the spec that we rely on.  These are breaking
> > changes.  See the changes here:
> > https://github.com/httpwg/http-extensions/pull/252
> >
> > In short, several of the parameters that were in header fields are now
> > in the body of the message and the Encryption header field is now
> > gone.
> >
> > This completely messes with the use of that spec in Webpush.  It's
> > easy to detect which version is in use because the identifier has
> > changed, and there are small gains to be had.  The overall message
> > size is now slightly smaller, and the key derivation is now slightly
> > simpler.  The specs also have fewer interdependencies as a result.
> >
> > I've put together a revision of the webpush-encryption draft.  I've
> > taken this opportunity to simplify things a little.  You can see a
> > preview in the editor's draft:
> >
> >   https://webpush-wg.github.io/webpush-encryption/
> >
> > I realize that this is a fairly big (and late) change.  I remain
> > optimistic that it will be the last. Feedback on the changes are
> > positive so far [1].
> >
> > I plan to submit this doc very soon, ahead of the draft submission
> > deadline.  I realize that's short notice, but I'm fully prepared to
> > back out this change if necessary.
> >
> > --Martin
> >
> > [1] Costin suggested that we might also remove Crypto-Key.  That is
> > technically possible, though it's probably excessively kludgy, the DH
> > key could be moved to the keyid field.  I'm leery of that sort of
> > optimization, but I'm willing to be convinced that this is a special
> > enough case (I don't think that it is that special, but have at it).
> >
> > _______________________________________________
> > Webpush mailing list
> > Webpush@ietf.org
> > https://www.ietf.org/mailman/listinfo/webpush
>
>
> _______________________________________________
> Webpush mailing list
> Webpush@ietf.org
> https://www.ietf.org/mailman/listinfo/webpush
>