Re: [COSE] draft-ietf-cose-hpke-00 and proposed changes for -01

Hannes Tschofenig <Hannes.Tschofenig@arm.com> Tue, 18 January 2022 11:20 UTC

Return-Path: <Hannes.Tschofenig@arm.com>
X-Original-To: cose@ietfa.amsl.com
Delivered-To: cose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 04DC53A085B for <cose@ietfa.amsl.com>; Tue, 18 Jan 2022 03:20:58 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.901
X-Spam-Level:
X-Spam-Status: No, score=-1.901 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H2=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.b=Ls7CNdJh; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.b=Ls7CNdJh
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 isQg9Q8jOS_C for <cose@ietfa.amsl.com>; Tue, 18 Jan 2022 03:20:53 -0800 (PST)
Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60052.outbound.protection.outlook.com [40.107.6.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id A1D2A3A0860 for <cose@ietf.org>; Tue, 18 Jan 2022 03:20:53 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5gZKvADjH9kNUEUudY0oF9qpegUIPzlIatdp6mcXfw0=; b=Ls7CNdJhY315oDKNZwW6vjtU004GuoPouRt05bC6dOZtWrXOAnmEg1g9OwIzPYiELOQ5cJ3NDE+rUPeuH0KkUxGAIg3VSLqMaIDHTjg4/cGOoKNB/+lxaAk48dOaWLqZanSq9smoeIoC3EBFwVHGkHBmS8C/FC1tIVOveK8tRIs=
Received: from AM7PR04CA0017.eurprd04.prod.outlook.com (2603:10a6:20b:110::27) by DB7PR08MB4219.eurprd08.prod.outlook.com (2603:10a6:10:34::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 11:20:44 +0000
Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::50) by AM7PR04CA0017.outlook.office365.com (2603:10a6:20b:110::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.7 via Frontend Transport; Tue, 18 Jan 2022 11:20:44 +0000
X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com;
Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com;
Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.9 via Frontend Transport; Tue, 18 Jan 2022 11:20:43 +0000
Received: ("Tessian outbound de6049708a0a:v110"); Tue, 18 Jan 2022 11:20:43 +0000
X-CR-MTA-TID: 64aa7808
Received: from ba006d1b8d00.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0DFADC01-B9FC-4EED-B812-7D49B53D385F.1; Tue, 18 Jan 2022 11:20:37 +0000
Received: from EUR04-DB3-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id ba006d1b8d00.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 18 Jan 2022 11:20:37 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxCv3U88LYHXnPOIfLP8Guesnuw/sd9dvocHDbdhvZPlbwKEGCXt/RlfO+Q9PUJ+ivQJmpDD7jNcdgZKXwrDpA/7vJpxQiZC80yLCUi4h8mJR6iGsoF6kWIH74FRH2trjom4cH10h8L5ijw2Ud6FC7wWWiWl6UYCJZGMiMD426JHLvCEl2TZdUf895l5Ja4X0IPKwxkUOZK/FKhLHoQJhtWaCShwkNhD6yUwTWvtoFgx9ICGZpewWJyKGZDeWFrF3cj0yzaUgp8kegoKbeXANACn9da68c6zQAkczKbk3Va0nFrPy1LK++3C3gLYGYnFPRhwOF3MNWFTIo/pNFNWHg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5gZKvADjH9kNUEUudY0oF9qpegUIPzlIatdp6mcXfw0=; b=bYmN57azCa2PcksxrQzxAivIUu+VaHc0qbhPzHNccSZUb33+TzfplNpQwiF9+pja8SeDPfgI1fZLuGvHl0LeViBfMcPAdDPQbWnVr2KIQvj10AE+Z9IkZtluiN7EYYgHrvklG9XcVwdiwMkvrzUjcpT8PRavKyLaShAER293d450lG9tyXTj0a60Hb80lsoSrv/7JwKyjDU0VSpO0R19nDqwIoN/wW+4xKJnop59CJUphRli3zGbsjl62+8Sv7LkxGA+XgJyHDSLo2x+BCzoWSLly97A5gH6XjkVkeTAM4v3hA6beq65rQ3NECExcUrvqXp7mprQIjGudRBqS/QCYA==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5gZKvADjH9kNUEUudY0oF9qpegUIPzlIatdp6mcXfw0=; b=Ls7CNdJhY315oDKNZwW6vjtU004GuoPouRt05bC6dOZtWrXOAnmEg1g9OwIzPYiELOQ5cJ3NDE+rUPeuH0KkUxGAIg3VSLqMaIDHTjg4/cGOoKNB/+lxaAk48dOaWLqZanSq9smoeIoC3EBFwVHGkHBmS8C/FC1tIVOveK8tRIs=
Received: from DBBPR08MB5915.eurprd08.prod.outlook.com (2603:10a6:10:20d::17) by DB8PR08MB5099.eurprd08.prod.outlook.com (2603:10a6:10:ea::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.11; Tue, 18 Jan 2022 11:20:34 +0000
Received: from DBBPR08MB5915.eurprd08.prod.outlook.com ([fe80::ec71:ec1b:a356:3ccb]) by DBBPR08MB5915.eurprd08.prod.outlook.com ([fe80::ec71:ec1b:a356:3ccb%7]) with mapi id 15.20.4888.014; Tue, 18 Jan 2022 11:20:34 +0000
From: Hannes Tschofenig <Hannes.Tschofenig@arm.com>
To: "ilariliusvaara@welho.com" <ilariliusvaara@welho.com>
CC: "cose@ietf.org" <cose@ietf.org>
Thread-Topic: [COSE] draft-ietf-cose-hpke-00 and proposed changes for -01
Thread-Index: AdgLhM0SJ9GR/pH8Rn+twyj8D7yFcgADzhAAAAbPMOAABE/7gAAm0yMg
Date: Tue, 18 Jan 2022 11:20:34 +0000
Message-ID: <DBBPR08MB591586D6CB6BAF7B5354F517FA589@DBBPR08MB5915.eurprd08.prod.outlook.com>
References: <DBBPR08MB5915C899B9EF8122898057BDFA579@DBBPR08MB5915.eurprd08.prod.outlook.com> <YeVQooQEGzfjFeE9@LK-Perkele-VII2.locald> <DBBPR08MB5915C7AFF11B55A8AA8CBBEEFA579@DBBPR08MB5915.eurprd08.prod.outlook.com> <YeWbRYe13Mk+IV+2@LK-Perkele-VII2.locald>
In-Reply-To: <YeWbRYe13Mk+IV+2@LK-Perkele-VII2.locald>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ts-tracking-id: 0DE4C610B8C711419A500E09DEEBBD12.0
x-checkrecipientchecked: true
Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
X-MS-Office365-Filtering-Correlation-Id: 6e1a4291-0fb1-4ee9-891f-08d9da74914f
x-ms-traffictypediagnostic: DB8PR08MB5099:EE_|VE1EUR03FT055:EE_|DB7PR08MB4219:EE_
X-Microsoft-Antispam-PRVS: <DB7PR08MB421932EFB91111C7182C6FAAFA589@DB7PR08MB4219.eurprd08.prod.outlook.com>
x-checkrecipientrouted: true
nodisclaimer: true
x-ms-oob-tlc-oobclassifiers: OLM:5797;OLM:9508;
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam-Untrusted: BCL:0;
X-Microsoft-Antispam-Message-Info-Original: BIUrcisGSTl6fOv5o5FjC/KonCEM7IydqJ6Cdvr+Pm/gOGYyuFSahw2EHiOxzfny+BWIoeaYNkp06ZmWgwOQcr7SwyyJG5ZIfnhq7CnkmKCBkr4wFAIbg7zI1eLqAfCLBC9XRU6C7TofCOqn7dzr0gW20Ae6lJDExMcBqL22L7913+Os1eyx+ia9Hh9z/LYZH2It2ABnE/iBvOjwPZFWM85AssWS5Jmae2AY8Dw3uiX57qKl5IOirkLcgEmZqjSfSkSivDBsJHgTmbA049qNqfdZ2Wm3o5CQqails6J9UzyE7gVdcN96pHp1KSJA8TXMVpH1OiK6oCTSXxi2NVAtGuS3/wi31Xn/pL9C0aXWJgN8+9Rd6FFj1tYXqP2lnuDJX7r0YKOH+1zex0BgyZD6+qeBtXm+0SyxV2Dv5i+P57U3cf+uoE14w02wGotRSuF+LlHvY1XMyga/fmmRTVKHb2HOhEvrVADOmzYAHrUSDunHkdv2+3+Z7jWxs60fwc+KuqHLRKlPMEDFOTWFgdiN/fbUUrPTe6KHiO0dYI+nX9a0BeSg9mpTUS/4SqvqVdKuv5VEABYeltan1mOXSocbUuIHpkEJQAsT3NIdRftirlvRYR0sKFA+sW3GKrfVciuAftj6AmrjKDpxa2zgyiRZsqtSfL50CMT7nT/+ObZdgVNxopNBn/yWJds6xCKUbcS0oVBOstk0fNWzMhKUjtUQVw==
X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DBBPR08MB5915.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(38100700002)(64756008)(55016003)(122000001)(83380400001)(76116006)(66946007)(86362001)(66476007)(66556008)(66446008)(38070700005)(5660300002)(316002)(8676002)(33656002)(2906002)(9686003)(6506007)(26005)(52536014)(186003)(8936002)(4326008)(7696005)(71200400001)(6916009)(508600001); DIR:OUT; SFP:1101;
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
MIME-Version: 1.0
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR08MB5099
Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
X-EOPAttributedMessage: 0
X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com
X-MS-PublicTrafficType: Email
X-MS-Office365-Filtering-Correlation-Id-Prvs: eb2a5921-887b-4c89-b088-08d9da748bdc
X-Microsoft-Antispam: BCL:0;
X-Microsoft-Antispam-Message-Info: G3l3QNhjvZX7vCY8AowZdESlP8+RUdtmKAWYfwfEusUDEqFLIPmbi9F5DMfE7vc1QsqNSXUN1cwWJo+cW8Wbk+VVQXd7Dy8i4/j6q0B0afUcmaAp68jyCVWpm4PfV9Csz0NBs/vaPGMaCAnPRd9iqaWdZo/OdIo8jp2C/IiNO3iKrzcHBonUyofFqPCFNBdxcXxPhpj9mSPtYFuANOdb6lu7cnPsufj3T9JjBN+F9ulq/A7kevz9uXgfKmPwkNKZRPA3oNYDEm4fCOfjfUnxAKxQoTi6Qejnb7+lwg7qijpmsyTUnWS68lhfub9Dvyf+1Z6rsSHP+/bMBBQJTWFMSDfO6BpQS2v1NzFjyXfjdmtMEyF+7Pe8uyvVzdJd0kIkHtu6nWpBM4RWxYJJ+tjgBJn3mJSaV6Z9wouTWKWVLDKajw1pBfrj0DmiCRoejLZwtaQNwH4/wMBa/uREOhZHKSuv5ijzveH7PDORlMUgS0dht34hj9nRJMH66IJKJkRUtKTwO5yr9vqs7Mf8IR0Lc0u+OUVdqpIpiumLBnm8QOBbH1HsIaebyyzQioTe+Th0+r7yj9hWCkZUsSzAPVFJvGrfyKb69Z5Q5fGIuetU1UFZez0tsQegn9nqTs1p9TuH7zHKxNuvi9yuf3JEAB9tX/y70JDbpfSJ+vbD1HnJppkxkoa6s68bmFRbNU8iORoLRheCIIDLwE2GywwvWniOMQ==
X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(26005)(4326008)(186003)(7696005)(6862004)(316002)(36860700001)(508600001)(8676002)(9686003)(52536014)(82310400004)(55016003)(70586007)(5660300002)(2906002)(86362001)(70206006)(47076005)(336012)(6506007)(81166007)(33656002)(8936002)(356005)(83380400001); DIR:OUT; SFP:1101;
X-OriginatorOrg: arm.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2022 11:20:43.6887 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 6e1a4291-0fb1-4ee9-891f-08d9da74914f
X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d
X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com]
X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB4219
Archived-At: <https://mailarchive.ietf.org/arch/msg/cose/2HVuEFo_y0ANCOaSDZ7dkiG3p7A>
Subject: Re: [COSE] draft-ietf-cose-hpke-00 and proposed changes for -01
X-BeenThere: cose@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: CBOR Object Signing and Encryption <cose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cose>, <mailto:cose-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cose/>
List-Post: <mailto:cose@ietf.org>
List-Help: <mailto:cose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cose>, <mailto:cose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 18 Jan 2022 11:20:58 -0000

Hi Ilari,

Thanks for your review. I am focusing on the most important aspect here first.


> [Hannes] We are adding another layer to allow for additional use cases.
> The use case is to encrypt a payload once for different recipients.

With HPKE, one could do that with two-layer structure (and even mix it with other modes):

- Layer 0: Message
  - Layer 1: HPKE (CEK for recipient1)
  - Layer 1: HPKE (CEK for recipient2)
  - Layer 1: AES-KW (CEK)
    - Layer 2: ECDH-ES (KEK for recipient3)
  - Layer 1: AES-KW (CEK for recipient4)

That encrypts the message only once, for four recipients:

- recipient1 and recipient2 use HPKE (asymmetric).
- recipient3 uses ECDH-ES (asymmetric)
- recipient4 uses AES (symmetric).

[Hannes] I think you are suggesting to do this:

   96(
       [
           // protected field with alg=AES-GCM-128
           h'A10101',
           {    // unprotected field with iv
                5: h'26682306D4FB28CA01B43B80'
           },
           // null because of detached ciphertext
           null,
           [  // COSE_recipient_outer

             / protected / h'a1013818' / {
            \ hpke-alg \ 1:16 \ HPKE/P-256+HKDF-256 \
                    hpke-aead-id: 1     //     AES-128-GCM
             } / ,
            / unprotected / {
                // HPKE encapsulated key
                / ephemeral / -1:{
                       / kty / 1:2,
                 / crv / -1:1,
                 / x / -2:h'98f50a4ff6c05861c8...90bbf91d6280',
                  / y / -3:true
              },
            // kid for recipient static ECDH public key
            / kid / 4:'meriadoc.brandybuck@buckland.example'
               },
               // Encrypted CEK
               h'FA55A50CF110908DA6443149F2C2062011A7D8333A72721A',
               ]
           ]
        ]
   )

Instead of this:

   96(
       [
           // protected field with alg=AES-GCM-128
           h'A10101',
           {    // unprotected field with iv
                5: h'26682306D4FB28CA01B43B80'
           },
           // null because of detached ciphertext
           null,
           [  // COSE_recipient_outer
               h'',          // empty protected field
               {             // unprotected field with ...
                    1: 1     //     alg=A128GCM
               },
               // Encrypted CEK
               h'FA55A50CF110908DA6443149F2C2062011A7D8333A72721A',
               / recipients / [  // COSE_recipient_inner
                [
                  / protected / h'a1013818' / {
                      \ hpke-alg \ 1:16 \ HPKE/P-256+HKDF-256 \
                    } / ,
                  / unprotected / {
                    // HPKE encapsulated key
                    / ephemeral / -1:{
                      / kty / 1:2,
                      / crv / -1:1,
                      / x / -2:h'98f50a4ff6c05861c8...90bbf91d6280',
                      / y / -3:true
                    },
                    // kid for recipient static ECDH public key
                    / kid / 4:'meriadoc.brandybuck@buckland.example'
                  },
                  // empty ciphertext
                  / ciphertext / h''
                ]
               ]
           ]
        ]
   )

I constructed the variant in the draft based on my understanding of how the COSE author wants to use layering. If we can use a more optimized version, I am all for it.

Ciao
Hannes

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.