[openpgp] ML-KEM and ML-DSA secret key format

Aron Wussler <aron@wussler.it> Wed, 26 February 2025 11:51 UTC

Return-Path: <aron@wussler.it>
X-Original-To: openpgp@mail2.ietf.org
Delivered-To: openpgp@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id 5D3AD1C8E83 for <openpgp@mail2.ietf.org>; Wed, 26 Feb 2025 03:51:47 -0800 (PST)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: mail2.ietfa.org (amavisd-new); dkim=pass (2048-bit key) header.d=wussler.it
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietfa.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 75RJ671YBea0 for <openpgp@mail2.ietf.org>; Wed, 26 Feb 2025 03:51:44 -0800 (PST)
Received: from mail-4317.protonmail.ch (mail-4317.protonmail.ch [185.70.43.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail2.ietf.org (Postfix) with ESMTPS id 12D741C8E4B for <openpgp@ietf.org>; Wed, 26 Feb 2025 03:51:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wussler.it; s=protonmail2; t=1740570702; x=1740829902; bh=kc1JvvvdNrjHjCVSZr9LeXLHWY33ZrhBrJRD5oBweGY=; h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector: List-Unsubscribe:List-Unsubscribe-Post; b=F95F5gcJ7cSOFiOh7nCivcPWx3BU2FzrzSBn+qiKMo12wDZ11iO3+4OcHz/HPrhrV r2U6lVC3joAO2J72Xat9zJcDw0Zo8dhIp+mbM/ASlXJ60Awv1ZmolKcifCjQZfvIqX CodHkQnArqpgWvBmf4Ac/L5qzbHPMk1n3CJNUVb3r0Ipg4I2FF4ihOk2FHBtgtFdx5 h/3+JqNF+l7oHu8wuGr3vJSnmLeWnAgE+1wYoxzXYDtYpDp36KheAShuU6SzozPQv4 5/eMcqVwAAEzLi1aeIEmK+fYrEh2bUyTyMWSekUH1bmU77SmW6CrFXQpmbbpM8Xosg NPStKdOWMPkaQ==
Date: Wed, 26 Feb 2025 11:51:36 +0000
To: "openpgp@ietf.org" <openpgp@ietf.org>
From: Aron Wussler <aron@wussler.it>
Message-ID: <vN75HSFXALBJQMd1A60IEhI_gqmw27cvjvVTK6APPoK-NjROf5a0KTPiRtUC3G04hrX_pb1Yzpu7n2R90yIVYbqJZpRPkkyxLbH6cy7tpjw=@wussler.it>
Feedback-ID: 10883271:user:proton
X-Pm-Message-ID: fbc4e7580fde85a0cb6e2facac0fe5e7e8051f0c
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg="pgp-sha512"; boundary="------a1fa89a1a21306c661c3897493fbf2d3d0aad87f6f22d8df12380e6c1382eb86"; charset="utf-8"
Message-ID-Hash: 6X2ARAMGXVR7JP4BG5Z2KMIXQU7Z7S6W
X-Message-ID-Hash: 6X2ARAMGXVR7JP4BG5Z2KMIXQU7Z7S6W
X-MailFrom: aron@wussler.it
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-openpgp.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [openpgp] ML-KEM and ML-DSA secret key format
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/_ZozCQFvcwEMbbcB2P6eOeKhP-Q>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Owner: <mailto:openpgp-owner@ietf.org>
List-Post: <mailto:openpgp@ietf.org>
List-Subscribe: <mailto:openpgp-join@ietf.org>
List-Unsubscribe: <mailto:openpgp-leave@ietf.org>

Hi everyone,

At the interim meeting on February 10 we discussed the ML-KEM and ML-DSA secret key format, stating we'd prefer to keep the seed format even though LAMPS is reconsidering this choice because of HSM manufacturers.
We gave it another thought, and we'd like to collect more explicit consensus on this point, also considered Simo's thread on the list [1] that opened right after the interim.

We would like to consider the following two options:

## Keeping the seed format only
This is the status quo in the specification.
- It makes it very hard to introduce a different SK format in the future, because we only use fixed length. It could be somehow inferred from the packet length, but it would be astonishingly hacky.
- Importing keys into HSMs will always be possible (no matter if expanded or seed, if tooling is available)
- Exporting keys from HSMs that support only expanded format will not produce a valid OpenPGP key (the key can't be rendered as the standard seed wire format, but they could be copied to a similar HSM)

## Allowing both seed and expanded format explicitly
Proposed text: https://github.com/openpgp-pqc/draft-openpgp-pqc/pull/171
- It makes both formats possible, preferring seed format
- Adds complexity and failure cases
- Importing keys into HSMs will sometimes fail (HSM supports only seed, but key is expanded)
- Exporting keys from HSMs will always result in a valid wire format
- Not all current crypto libraries accept the expanded format (one of the reasons why it's optional in the proposed spec)

We have considered the option of adding a "version" or "type" byte that leaves the door open for a future standardization of another secret key format without doing it directly now, but I see only disadvantages in this:
- If we never use it, it's a useless byte and additional failure case (unknown value)
- If anyone ends up using it, it will bring all the complexity as defining two formats now, plus the chance of having little to no specification or guidance

For reference, this is tracked in this issue: https://github.com/openpgp-pqc/draft-openpgp-pqc/issues/169

Please provide feedback in the next two weeks (until the start of IETF 122 on Sat 15.03).

Cheers,
Aron

[1] https://mailarchive.ietf.org/arch/msg/openpgp/wborm6DvCotyZPzs-kPdyXPtoS0/

--
Aron Wussler
Sent with ProtonMail, OpenPGP key 0x7E6761563EFE3930