Re: [lamps] [EXTERNAL] Re: Multiple drafts with PQ algorithm key encodings that are not compatible.

John Gray <John.Gray@entrust.com> Thu, 29 September 2022 18:31 UTC

Return-Path: <John.Gray@entrust.com>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E8866C1524A4; Thu, 29 Sep 2022 11:31:16 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.006
X-Spam-Level:
X-Spam-Status: No, score=-7.006 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, HTTPS_HTTP_MISMATCH=0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, 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=entrust.com
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 gR6FM2NP5E5Q; Thu, 29 Sep 2022 11:31:12 -0700 (PDT)
Received: from mx07-0015a003.pphosted.com (mx07-0015a003.pphosted.com [185.132.183.227]) (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 D8B2BC1522D9; Thu, 29 Sep 2022 11:31:11 -0700 (PDT)
Received: from pps.filterd (m0242864.ppops.net [127.0.0.1]) by mx08-0015a003.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28TIFL4h025391; Thu, 29 Sep 2022 13:31:02 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=entrust.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : mime-version; s=mail1; bh=jov6Y3Ntups9ymUVVxpaHSc2DNscf0CcSZJIaNPfJxk=; b=V9ncHfBMoYSuJoOku3GyefqtsuTC4lwMQtm+qi0K5TeFzd2B5vDiXEceQVLClLPTJU+7 oinzGhk4isxH1uG5WuiEU5K86EuctnpdWDec3eBd3LzMyI+XvgEb62DvlxTZQS3/ZyWl qUu6DkhN5XxDkctCuKL7QPJTAVqLvPt6R/xizIlUVVNRXDiXKl3qDanzgzdWBSQ91YyW 8Yqj1GnuNbtJ1usI5p4LDKTHIzUI1chKXDrXfDbyvzaX+i9TtOr1wOv33PJC6vWwAYW6 qG1z6gxC930DHSC4P13IquETao9587/jJlCbm3E/HTTxxGXqVjAbJgtOUq5ldq6SxWVJ lg==
Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by mx08-0015a003.pphosted.com (PPS) with ESMTPS id 3jsxk46ffc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 29 Sep 2022 13:31:01 -0500
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DSZqR0aFuUaiHVNQ6n9jbkig0Kp3n+I4x/4z0FtsDxin7By5ddaiuYUE5nSTwLrGziFMDsY7zQysPwzbGj2QDIKdMCvYQB+XfNG1i3HaJasLjhd2E5KxHOPnaBJIh7O4QCk/E8mGPDCdo8gzbnm2tujaHin02K699twpaQS1v9Yp8SsnLNVOLC7uXbg6zsCsmcRLp+J8TdzUUel0hfPGUWckG4+MbVt+0y3m0RkkT5+2QvsOTgGYtTiVxtLIPbJm2DEWvZycCaCNJMeecVRhXpwL7iS8wOZbIApCJVhP2mPJUW8f3pHnyJ787pU8yXPxWyh4c/rkZYXVp6pd7rxwBQ==
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=jov6Y3Ntups9ymUVVxpaHSc2DNscf0CcSZJIaNPfJxk=; b=UCdNVCIDPE5tYgyGg8+eF2/AiisiQ5Rupg8YO2SMyoDAQoX1NE5Q3KkEswcRnQeALHlkpCH5UoF3ptSOKTa+cD8TYz6M0DGKigrNQB4VlVZ3EQZEIkOLJapMcx2sqpKjDBUbQ2uCa3J/W8B6ul9AK9T76KM0dfylvv73rxOtsLXcunXgUUS9pKl0AD2/uJ1BOxqrWphXSKEtO7yzV2ys99/pDvAQRoU2+a2YTsInQ2m0r7U0xri8W9aomqehaNwa6He7BRQo2NSm5zXT6qDdkLN7RjyeTVNx6k3eXVuGj9mqv1mrK+wBzZFtn84t8O2fi4YRT9jjz+J9pkEg/ymUWQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=entrust.com; dmarc=pass action=none header.from=entrust.com; dkim=pass header.d=entrust.com; arc=none
Received: from DM6PR11MB2585.namprd11.prod.outlook.com (2603:10b6:5:ce::22) by DM4PR11MB6216.namprd11.prod.outlook.com (2603:10b6:8:a8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17; Thu, 29 Sep 2022 18:30:58 +0000
Received: from DM6PR11MB2585.namprd11.prod.outlook.com ([fe80::f014:fd43:52f0:b50f]) by DM6PR11MB2585.namprd11.prod.outlook.com ([fe80::f014:fd43:52f0:b50f%4]) with mapi id 15.20.5676.017; Thu, 29 Sep 2022 18:30:58 +0000
From: John Gray <John.Gray@entrust.com>
To: "Markku-Juhani O. Saarinen" <mjos@pqshield.com>
CC: "pqc@ietf.org" <pqc@ietf.org>, "spasm@ietf.org" <spasm@ietf.org>, "cfrg@ietf.org" <cfrg@ietf.org>, "Massimo, Jake" <jakemas@amazon.com>, "Panos Kampanakis (pkampana)" <pkampana@cisco.com>, Sean Turner <sean@sn3rd.com>, "bas@westerbaan.name" <bas@westerbaan.name>, "cvvrede@gmail.com" <cvvrede@gmail.com>, "sid@zurich.ibm.com" <sid@zurich.ibm.com>, "bhe@zurich.ibm.com" <bhe@zurich.ibm.com>, "tvi@zurich.ibm.com" <tvi@zurich.ibm.com>, "osb@zurich.ibm.com" <osb@zurich.ibm.com>, "dieter.bong@utimaco.com" <dieter.bong@utimaco.com>, "joppe.bos@nxp.com" <joppe.bos@nxp.com>
Thread-Topic: [EXTERNAL] Re: [lamps] Multiple drafts with PQ algorithm key encodings that are not compatible.
Thread-Index: AdjTZgX3XvEwjK4GRXikwyp96JR57gAwne4AAABQGMA=
Date: Thu, 29 Sep 2022 18:30:58 +0000
Message-ID: <DM6PR11MB25859271A2128A635E90A9C7EA579@DM6PR11MB2585.namprd11.prod.outlook.com>
References: <DM6PR11MB25852643FB14014E92A5CFE1EA549@DM6PR11MB2585.namprd11.prod.outlook.com> <CAPwdP4M74afMngjdus_y6SHkuK4cJ_i3GgsQwzF2+sC10kRKdg@mail.gmail.com>
In-Reply-To: <CAPwdP4M74afMngjdus_y6SHkuK4cJ_i3GgsQwzF2+sC10kRKdg@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-ms-publictraffictype: Email
x-ms-traffictypediagnostic: DM6PR11MB2585:EE_|DM4PR11MB6216:EE_
x-ms-office365-filtering-correlation-id: bb1c7677-7d14-4442-3368-08daa248c0ca
x-ms-exchange-senderadcheck: 1
x-ms-exchange-antispam-relay: 0
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: kTRp7rWaPh3U9cwSO8jvi6+BIVJRjeiK6DCLqwEkHtpChCtWU1ADW7m7dPbAEZ5WSyLvmTe25qI80I952GS0+ec/azx58eHecc1+fXbRqL1WfBSfW1U+74sAE08N2FOc0THjZIoNx7e1z950Ek84DDcVwDOiNPICYQGeNDliJbelNce1XjMyPIk15J0biFNWYmagwvTO72OlY6noyw4H5sHhi8N1H7/E5xjFzCdaypa9gjERPEIbpdTSLxvBCUB1d/H2tpsATt4tqCgaOpkSllfaUHSktF9Y8xX5Icy4ei9JS+2WrjOQceNcLAyUFT+W1pir7XUaQ92b85VjlW5G0H96tjx9Y2on3l+N9GOy8RfKkV4oF7YkWyIqJLMzEts2ta5hzjRTZzYNtZSzJgBQ6TxaUUgIjK0QIaWjiekX8kSbTTOVKC12OdiCOWxaN6itzFEl+WscUMT3TGKC54SIq132pddM8eN7E64wfaeLo89ZQYRGSeZqxlYQi5g6Zq1IBB/LgyJiDqcRALxlny8AOQY2tXjxEsOYd9t8k0fNgsfwQpS0Ldk7h1HuOtLfRtjHihO3CKW8pREXnbHYCU7aV00SU1q1NNQZoma7Uf8CQLSVIVI2WY/58jsK/8zJva1Of2RqR4O31LQ/TvcYzM/EcIl1/JJaC9/A6klcIGKvqNYWGSk8+jSGZ4akek2Mm0UWLT08wGKgf0zem5dCR/zccnJgCrsfGs2pxkjofndnw7KgMJt3NsIcynb1xPEca0VZtCGGiHGo+jiYWkAI/Tvz2MuJXTmq51uVVlaG12Emqm6w8kZX8EgRyMXYaH8TN4gJ64ELxhomrNJC4qeeqnQUJg==
x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB2585.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(376002)(366004)(39860400002)(136003)(396003)(346002)(451199015)(66476007)(26005)(9686003)(186003)(83380400001)(478600001)(54906003)(7696005)(6506007)(316002)(33656002)(38100700002)(38070700005)(966005)(53546011)(71200400001)(66446008)(2906002)(4326008)(52536014)(6916009)(7416002)(166002)(8936002)(122000001)(5660300002)(55016003)(66556008)(8676002)(66946007)(76116006)(64756008)(41300700001)(86362001); DIR:OUT; SFP:1102;
x-ms-exchange-antispam-messagedata-chunkcount: 1
x-ms-exchange-antispam-messagedata-0: bUnml676f02CplU6N7wDg/sdCASROTXsIQe6Vb+2qSAQSjRQ45G140exnyJaL67BJw+U1tFEJn8xegcIzmuGV9zbnkyVyZ6CWDceMd6NzNDN3tLcvS5tHRWijIGRvs3KefEJeEIYIwjSLL5RIopjPxd7mV4CQ1JMUG1OcHENNMOx0wA24dKo/pJla/Q8l305Ls6WerIToy5givPI2QhLjvV01MM5D7hXDV52T731uNnmMT7Xa7ZqCyJ1W7F8CzA8ty0bVXKLOiNcdUJeyjpAaICUsYZb6VyR7A3nEQ9esnPFD/rJsbNSUMCP0LZbQTGaXFwShuZxppvHtFtHIOH7aHUWJzaKGrh7slE7x3UxFC7YD6wpQ0dKcQwwzspqxB69xhzgFd6K1wExVFGbaNSSl4njGCfBBREv0t1ulPkgjeCcNWvUD9DQ4AAGxYi9J/m4qhMBG5/FtEBH/EfHeBoCyVB0auhCelAfrz7q7EFRxrZErfJNAdg1lsZvamB2K+ygdJehbzmytIySaFg8fHMdQmKc4M6ZbNPOUNCdXvUmpH6KyGvlwhhRRppV1fYC2WrbCWXTt84TLDM5pGxrJjObQoWrtJQhJgexOWJWRfaBPEInjrKTBM4zkyBGkEJXptmLZ7SjJLQN9e2U/ohQDUzutYdfBU8FhJ+Iri37GUdQ/d0DYmw4R+jZH54gLj0ljvcm9gPqrtHh9VwF2pUIiIFqWMXDTN+8E4WudIb2MtxjE7DV+UQvRZF/NoUGIB9oxSsfT+j2d32aVwfpmx0FfUaWukE8wp54Y+LKp+Setek6dw3/lnVq2ep9KgxFMLroLJObcqoOveSUFDYOBCUZ0UgFFD2gt0wwpksyidoLpFvB0cjfEv0xu/f7a9DXmsCQuw3rqde20XKONwCQEgO6YFl/f1Kkf1RujuToZtgF0aZ3s0/2GzqCov1Z2rzmTZMf8fd+NcWq2eNnmtEQGQOpiL/FZ7yByHFM9VT/jarisfoIgFY32WGReeSwE1Sa/tfN680nQZhbpyfDO67LCBRn8CsYqhykL6y/hZwN3ruXMKbyGeNbUQXm0hzpJ3MukIe/3E2U00F/LUUyk6T2sUBCneVhMJc3T+SNRhqyhRAxSVUxEpOlTO74ojLxf8eub+nPq/AZ9rU/cKi7yWZMDkFA0jD+6FT4OcDVZfEKoM2cCcpAyeJoLjPSMf/AEoFt0GT6xW6NbeSjQNVvxcI1xd0i8DOMW/CFNfGoIe8p3bi7TlboA5NC16qb7ZDGcnKqgRbLUfMwb8Cdkm5LYHWQK0b880QjhdoumhCIzUDrmGB0j9p32xD8GZ9RJWgKWhBOiInPA9ekd7h03bgpd6rWzKa+zw6hSF2Qr8NW0JcLUoYf3bG+ilKltW44PNUbEvQmvaedGCrFmRrrhjJAPloRPyD2dqvwsUrSimoBNXSco4lysAoABInYbkbqOeFM7hXH4W4gxhnuEniSICGORIurBW2NHkKH3JUzdk73+RNW8HYRRuM/5vgxTknXW48S6hDZ0Jj/LyHy7xHLti4Li/2zjScl/oJiDez0qOZgXa9MCRF4j8iQavoIl0SsdY29wegvGHyKbQBb
Content-Type: multipart/alternative; boundary="_000_DM6PR11MB25859271A2128A635E90A9C7EA579DM6PR11MB2585namp_"
MIME-Version: 1.0
X-OriginatorOrg: entrust.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB2585.namprd11.prod.outlook.com
X-MS-Exchange-CrossTenant-Network-Message-Id: bb1c7677-7d14-4442-3368-08daa248c0ca
X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Sep 2022 18:30:58.1699 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: f46cf439-27ef-4acf-a800-15072bb7ddc1
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: 1Dj7XEBxe9P96om/ZqbvW+r479MrYOeB7ZI9FysyibFueBgxWZtISRsj+RXlY6p6BG+rSBdL0G0D4TGdXAWNNg==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6216
X-Proofpoint-ORIG-GUID: b2zN8ZERHAAWYuEb9OUSO4EyvXhXAAvA
X-Proofpoint-GUID: b2zN8ZERHAAWYuEb9OUSO4EyvXhXAAvA
X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-29_10,2022-09-29_03,2022-06-22_01
X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=999 malwarescore=0 phishscore=0 adultscore=0 priorityscore=1501 bulkscore=0 spamscore=0 clxscore=1011 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209290116
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/aCXjmh1GmfK4UqcF1qZdr91qHHc>
X-Mailman-Approved-At: Thu, 29 Sep 2022 11:53:39 -0700
Subject: Re: [lamps] [EXTERNAL] Re: Multiple drafts with PQ algorithm key encodings that are not compatible.
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "This is a venue for discussion of doing Some Pkix And SMime \(spasm\) work." <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 29 Sep 2022 18:31:17 -0000

Thanks for this information Markku,

I agree with what you are saying.  Our first implementation of the public keys for Dilithium was simply an OCTET_STRING as that seems like the most straightforward approach.   However, when we tried to be compatible with other specifications (like openSSL, OQS), we found a BIT STRING encoding, (which did happen to save 4 bytes)...   So we made a change to accommodate that nuance.   However, since then and looking at other specs and trying to collaborate with others, we also found the exploded versions of the keys as you mention, so that is what mitigated my questions.    Thanks for referring us back to the actual Dilithium specification again!   I hope that is the starting point of all the encoding representations.

In regards to the private key encoding, I am in favor of keeping it as compact as possible.   Our implementations don’t rely on being able to obtain the public key from a private key, but I guess if there are implementations that depends on this for historical reasons, it will be more difficult for them to drop in the newer signature algorithms as it might upset their implementation architectures.  If that is a case that does need mitigation, then I am not opposed to inclusion of a small seed value that can be used to regenerate the public key (which looks possible in most PQ sig algorithms except Falcon).   Perhaps that is a good candidate for a tagged optional value for private key encodings?

In https://www.rfc-editor.org/rfc/rfc5208  PrivateKeyInfo doesn’t accommodate a public key, but the later spec https://www.rfc-editor.org/rfc/rfc5958 changed PrivateKeyInfo to be a OneAsymmetricKey which added and optional tagged publickey, so it is *mostly* backwards compatible if the public key is not there (and your 5208 ASN.1 parser isn’t rigid in allowing unknown implicit tags…).    However, since private asymmetric keys aren’t transmitted over the wire as much as public keys, maybe two options (full encoding or compressed/seed format) could be useful for different use-cases…   There are the obvious use-cases of server generated asymmetric keys in key management protocols (CMP, CMS, PKCS#12) which require asymmetric private key encryption and transmission.  However, I recall issues in the past with EC key formats, so hopefully some lessons have been learned since then.

Thanks for this great discussion,

John Gray
Entrust

From: Markku-Juhani O. Saarinen <mjos@pqshield.com>
Sent: Thursday, September 29, 2022 1:26 PM
To: John Gray <John.Gray@entrust.com>
Cc: pqc@ietf.org; spasm@ietf.org; cfrg@ietf.org; Massimo, Jake <jakemas@amazon.com>; Panos Kampanakis (pkampana) <pkampana@cisco.com>; Sean Turner <sean@sn3rd.com>; bas@westerbaan.name; cvvrede@gmail.com; sid@zurich.ibm.com; bhe@zurich.ibm.com; tvi@zurich.ibm.com; osb@zurich.ibm.com; dieter.bong@utimaco.com; joppe.bos@nxp.com
Subject: [EXTERNAL] Re: [lamps] Multiple drafts with PQ algorithm key encodings that are not compatible.

WARNING: This email originated outside of Entrust.
DO NOT CLICK links or attachments unless you trust the sender and know the content is safe.
________________________________
On Thu, Sep 29, 2022 at 2:51 PM John Gray <John.Gray=40entrust.com@dmarc.ietf.org<mailto:40entrust.com@dmarc.ietf.org>> wrote:
We are doing some interoperability testing with different vendors using the new Dilithium, Falcon and SPHINCS+ algorithms.   We have come across at least two drafts which are trying to specify the ASN.1 encoding formats for these algorithms.   However, the encoding formats are not compatible with each other.   I imagine the authors of these drafts should get together and come up with a common format (I have copied them on this email).   This means we must choose one or the other, or even worse, support multiple formats (which can lead to bugs).   Initially I started more than a year ago using my own encoding format for internal prototyping, but now need to interoperate with others outside of our organization, so a common format is definitely needed at this point.   😊

Indeed it is remarkable that various people have been trying to create "exploded" ASN.1 encodings for Dilithium keys, none of which are compatible with each other, or the actual Dilithium specification, reference implementation, and the test vectors.

Section 5.4 of the specification defines it as a concatenated byte sequence, or as a 32-byte seed value. For ASN.1 these can be naturally expressed as a simple OCTET STRING. https://pq-crystals.org/dilithium/data/dilithium-specification-round3-20210208.pdf<https://urldefense.com/v3/__https:/pq-crystals.org/dilithium/data/dilithium-specification-round3-20210208.pdf__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR69FoTb5I$>

"Secret key. The secret key contains ρ, K , tr, s1 , s2 and t0 and is also stored as the
concatenation of the bit-packed representation of these quantities in the given order.
Consequently, a secret key requires 32 + 32 + 32 + 32((k + `) · dlog(2η + 1)e + 13k) bytes.
As mentioned previously, the signer also has the option of simply storing the 32-byte value
ζ and then simply re-deriving all the other elements of the secret key."

The public key is similarly defined. There is no practical advantage of exploding it into individual components -- repacking would always be needed for both signing and signature verification.

Best Regards,
- markku


Dr. Markku-Juhani O. Saarinen
Staff Cryptography Architect
PQShield Ltd



M:             +44 0 7548 620723

E:              mjos@pqshield.com<mailto:mjos@pqshield.com>
W:             www.pqshield.com<https://urldefense.com/v3/__http:/www.pqshield.com/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6XzGKIH0$>



We fully realize the OID values will be changing once official OIDs are registered, (changing those are trivial), but the ASN.1 formats of the public and private keys is kind of important as well…  😊

For example:

The LAMPS group has a specification of Dilithium public keys in this draft:
https://datatracker.ietf.org/doc/draft-massimo-lamps-pq-sig-certificates/<https://urldefense.com/v3/__https:/datatracker.ietf.org/doc/draft-massimo-lamps-pq-sig-certificates/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6F7rP21s$>


the public key format is this:



The Dilithium public key MUST be encoded using the ASN.1 type

   DilithiumPublicKey:



     DilithiumPublicKey ::= OCTET STRING



The private key format is this:



     DilithiumPrivateKey ::= SEQUENCE {

         rho         BIT STRING,         - nonce/seed

         K           BIT STRING,         - key/seed

         tr          BIT STRING,         - PRF bytes (CRH in spec.)

         s1          BIT STRING,         - vector l

         s2          BIT STRING,         - vector k

         t0          BIT STRING,         - encoded vector

         PublicKey   IMPLICIT DilithiumPublicKey OPTIONAL

     }



In this draft:
https://datatracker.ietf.org/doc/draft-uni-qsckeys/01/<https://urldefense.com/v3/__https:/datatracker.ietf.org/doc/draft-uni-qsckeys/01/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6wY7A4oI$>

Dilithium keys have this encoding:




   DilithiumPublicKey ::= SEQUENCE {

       rho         OCTET STRING,

       t1          OCTET STRING

   }





  DilithiumPrivateKey ::= SEQUENCE {

       version     INTEGER {v0(0)}     -- version (round 3)

       nonce       BIT STRING,         -- rho

       key         BIT STRING,         -- key/seed/D

       tr          BIT STRING,         -- PRF bytes (CRH in spec)

       s1          BIT STRING,         -- vector(L)

       s2          BIT STRING,         -- vector(K)

       t0          BIT STRING,

       publicKey  [0] IMPLICIT DilithiumPublicKey OPTIONAL

                                       -- see next section

   }

The draft-uni-qsckeys does not cover SPHINCS+,  it does cover Falcon, but I don’t know of another draft that specifies Falcon.

There are also encodings for Kyber mentioned in two documents that I see.  There is an early   https://datatracker.ietf.org/doc/draft-ietf-lamps-kyber-certificates/<https://urldefense.com/v3/__https:/datatracker.ietf.org/doc/draft-ietf-lamps-kyber-certificates/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6H6KKj9U$>  draft which mentions it is up to the document defining Kyber to give more details.    In the draft-uni-qsckeys draft it is more specific.

https://datatracker.ietf.org/doc/draft-uni-qsckeys/01/<https://urldefense.com/v3/__https:/datatracker.ietf.org/doc/draft-uni-qsckeys/01/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6wY7A4oI$>

   KyberPrivateKey ::= SEQUENCE {
       version     INTEGER {v0(0)}   -- version (round 3)
       s           OCTET STRING,     -- sample s
       publicKey   [0] IMPLICIT KyberPublicKey OPTIONAL,
                                     -- see next section
       hpk         OCTET STRING      -- H(pk)
       nonce       OCTET STRING,     -- z
   }

Partial public key encoding:


KyberPrivateKey ::= SEQUENCE {

       version     INTEGER {v0(0)}   -- version (round 3)

       s           OCTET STRING,     -- EMPTY

       publicKey   [0] IMPLICIT KyberPublicKey OPTIONAL,

                                     -- see next section

       hpk         OCTET STRING      -- EMPTY

       nonce       OCTET STRING,     -- d

   }

Full public key encoding:


   KyberPublicKey ::= SEQUENCE {

       t           OCTET STRING,

       rho         OCTET STRING

   }

Is https://datatracker.ietf.org/doc/draft-uni-qsckeys/01/<https://urldefense.com/v3/__https:/datatracker.ietf.org/doc/draft-uni-qsckeys/01/__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR6wY7A4oI$> meant to become the document that defines the key formats for all the PQ keys that will be standardized?    If not, then it should probably just refer to whatever documents will define the formats so that we can at least agree on one common format for the PQ keys.


Cheers,

John Gray
Entrust
Any email and files/attachments transmitted with it are confidential and are intended solely for the use of the individual or entity to whom they are addressed. If this message has been sent to you in error, you must not copy, distribute or disclose of the information it contains. Please notify Entrust immediately and delete the message from your system.
_______________________________________________
Spasm mailing list
Spasm@ietf.org<mailto:Spasm@ietf.org>
https://www.ietf.org/mailman/listinfo/spasm<https://urldefense.com/v3/__https:/www.ietf.org/mailman/listinfo/spasm__;!!FJ-Y8qCqXTj2!fTiMY5BETVkwFJRmHwVhbOWjnlC8kRSBDfYIDsY0npeD5m5x8ND5iec1AXNsT1Xuh1EEprR62BBq4CA$>