[saag] MAC first then encrypt or encrypt then MAC.

Phillip Hallam-Baker <hallam@gmail.com> Wed, 27 June 2012 17:26 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: saag@ietfa.amsl.com
Delivered-To: saag@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D44F121F86CB for <saag@ietfa.amsl.com>; Wed, 27 Jun 2012 10:26:34 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.599
X-Spam-Level:
X-Spam-Status: No, score=-3.599 tagged_above=-999 required=5 tests=[BAYES_00=-2.599, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YP6jCQ8g2WHv for <saag@ietfa.amsl.com>; Wed, 27 Jun 2012 10:26:33 -0700 (PDT)
Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by ietfa.amsl.com (Postfix) with ESMTP id C318A21F86B8 for <saag@ietf.org>; Wed, 27 Jun 2012 10:26:33 -0700 (PDT)
Received: by obbwc20 with SMTP id wc20so2000397obb.31 for <saag@ietf.org>; Wed, 27 Jun 2012 10:26:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=9ACU3P48fRTi1oQt5HKXiPEviCG5sX0Njdo0QCfBy6g=; b=b6jeYd3RiIh6TNwY7GJpQqEJJ7qpdRPbPNj1/7VAb3tNwe/gNUc4OIm2vfG4/mtvnb xHPRFguQctxJbHxxjrXxa4QQXKoZthpWmnoBdjbKSoRgwCpZJAWSuRl8YB7Qt4RDj4aR hPZp/SFCRuuJNYBvnPmaBU1clOTAKXRPScesleAeN4+5QoCMKHlFbbXtnKMKFPzWYwd8 qeKZg1qe1HPypEXa380Oz4O86mLrfK/JfRB+yS8jg8gjk//zFPOK6RolmJ4YT7kgHtNR LkXSBvRwg6lf/ua6Gp1+WAR4jo+v+6V1tGxP3ugsMW60pfmk6JqcgWgeTPrRON5T1n5n iA+g==
MIME-Version: 1.0
Received: by 10.182.12.74 with SMTP id w10mr21293346obb.54.1340817993319; Wed, 27 Jun 2012 10:26:33 -0700 (PDT)
Received: by 10.182.64.166 with HTTP; Wed, 27 Jun 2012 10:26:33 -0700 (PDT)
Date: Wed, 27 Jun 2012 13:26:33 -0400
Message-ID: <CAMm+LwgXaqr1Xoiib7Rq-63-j5fBmnx=CUgcsiK-_ym0dqV84g@mail.gmail.com>
From: Phillip Hallam-Baker <hallam@gmail.com>
To: saag@ietf.org
Content-Type: text/plain; charset="ISO-8859-1"
Subject: [saag] MAC first then encrypt or encrypt then MAC.
X-BeenThere: saag@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: Security Area Advisory Group <saag.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/saag>, <mailto:saag-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/saag>
List-Post: <mailto:saag@ietf.org>
List-Help: <mailto:saag-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/saag>, <mailto:saag-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 27 Jun 2012 17:26:34 -0000

OK, so I think I know the answer to this one, but every single time I
submit a spec doing it one way, someone will always tell me that the
other is the way to go. And very rarely will anyone give a reason
other than 'that is how to do it'.

And no, 'just use TLS or DTLS' is not an option in this particular protocol.

I have found http://world.std.com/~dtd/sign_encrypt/sign_encrypt7.html
but while the paper is very good and worth reading, it is focused on
public key issues. I am wondering if some of the 'you must sign first'
advice is coming from people translating advice specific to public key
back to symmetric key protocols.


What I am planning to do is:

1) Starting from a master shared secret km produce distinct keys ks,
ke for signing and encryption respectively.

[e.g. ks = MAC ("sign", km), ke = MAC ("encrypt", km)]

2) Construct either

Encrypt-then-sign  Message = Encrypt (Payload, ke) + Authenticate
(Encrypt (Payload, ke), ks)

Sign-the-encrypt  Message = Encrypt (Payload + Authenticate (Payload, ks), ke)

[I am aware that certain communities would advise

  P2 = Encrypt (Payload + Authenticate (Payload, ks), ke)
  Message = Encrypt (P2+ Authenticate (P2, ks), ke)

But I don't have the room for it]


What I am really looking for here is not so much an argument as a
reference I can cite.

Looking at the current JSON signature etc spec it looks to me like
Encrypt-then-sign is expected.


This is to be used in:
http://www.ietf.org/id/draft-hallambaker-omnibroker-00.txt in case you
need context.

-- 
Website: http://hallambaker.com/