[lamps] Re: Request to Extend IETF WGLC for ML-KEM and ML-DSA private key format Specifications

Sean Turner <sean@sn3rd.com> Wed, 29 January 2025 16:12 UTC

Return-Path: <sean@sn3rd.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 57855C169432 for <spasm@ietfa.amsl.com>; Wed, 29 Jan 2025 08:12:48 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.106
X-Spam-Level:
X-Spam-Status: No, score=-2.106 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_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, 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 (1024-bit key) header.d=sn3rd.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 q8LsQGi_5Jtv for <spasm@ietfa.amsl.com>; Wed, 29 Jan 2025 08:12:44 -0800 (PST)
Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 3F87CC14F5F1 for <spasm@ietf.org>; Wed, 29 Jan 2025 08:12:44 -0800 (PST)
Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-7b6ed0de64aso81719185a.0 for <spasm@ietf.org>; Wed, 29 Jan 2025 08:12:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sn3rd.com; s=google; t=1738167163; x=1738771963; darn=ietf.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mHFd0y/pS2Wh6e0v0gX1lGr7tQQX7FtBImMelSgQdJc=; b=bzN0tfhArjO2mnvsX5CPJXptCnM3gJFGdRWwzC0RrNFTSxEd6xrFX1kFeVY4xK1rUO p+EwFEqK6Dvm35m3U0G8qNkdPyEtoa7rcVT1uqAd8RsM7OAQs9fAZU38IcMTdbA1j5YY +Pb91sSRv7RDKZo2NT6p0Qe7A1ItkkHzLAc9k=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738167163; x=1738771963; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mHFd0y/pS2Wh6e0v0gX1lGr7tQQX7FtBImMelSgQdJc=; b=rWI9HJIy3VrxBTfD2rpaDDjDpYDmsVLTwNJ0Nn5IBafJ7MJEMfkujO2XLZTHhpO1k9 KmdSGYqcbHUqMEtCX8dEpd5rjCiZAuWYgmmPZLf5UWlvu+46LAy4K2+NHXxcEU7x9NDN 6SJticJo6QsoxcV3giULJ3D3ZxLDYrMeicqKd+Ukw6xZRpyd9o6T/QsMV+g+u68q1dhO q4p6QxHbLi6ovODQzMhK31KwZAB4+Ew8z+JYaUyz0D9GPzwi/RzcfDCpKA6FWq0fxx81 T50AFoPr1H4bLKhgt6vC0DLkLcUskrGBs7SBySM+8XriJROcqmBSLaHbJqwjrN0VRLFu jshw==
X-Forwarded-Encrypted: i=1; AJvYcCW/OZSzrxpr3VJ9PUni/7iyEvHZCs5VFRYi+IvAbPZMM3Pe3re35gpgWGlLmUFfldCfeftGBg==@ietf.org
X-Gm-Message-State: AOJu0Yx5GMYc0cR3NxXleTqHN8rms982+pVWVwYQVZUhyLbcjFLUAapy yxwGhK+IApr/5WiZIm8iJQy+ds1VEKKzhbepeEwq4m1b/nNcdLApIbxbIborsfk=
X-Gm-Gg: ASbGncuhMJ2qImR89Btk0rtg+62w6Qzuk6WX3eJi91LYBseTzuCgNr2fOJR66QEmWf/ QJliCoimZM5i5XH5DPIEifehn51fR2WtTUTVcOWwBn+dEh1mikuOGq+yZvrm5RE7T8nw+Tdsic1 a3K79svxVCcJEHWqJQABGRORtVC9uk3eGoV+gNcs8zLJne1IgPgZ1uHXVdjcvjI6nohztYsVoLm 3gInEtIir+2Y7aO1LIKh8Kaaes99CnWjLL7l1KBQSzzDCKuL0hOgtzsH3eKPrcbYJ694/vu5xc+ 3xGBQshauIjDNLpb+3cwx7DAlQClkrGM0k+nloDW6y/M8w==
X-Google-Smtp-Source: AGHT+IGtutZnJg7xD8wjpOUOepSvOEhWt7H16bqhKLpy8jFZRcuuBCq4B2onwoTVc58IfpynniX/mg==
X-Received: by 2002:a05:620a:424b:b0:7b1:44ee:644d with SMTP id af79cd13be357-7bff3f73345mr1332587685a.10.1738167163117; Wed, 29 Jan 2025 08:12:43 -0800 (PST)
Received: from smtpclient.apple ([2600:4040:252a:8d00:4514:f7b:72cb:3f93]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be9ae8a67csm640432985a.29.2025.01.29.08.12.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jan 2025 08:12:42 -0800 (PST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.300.87.4.3\))
From: Sean Turner <sean@sn3rd.com>
In-Reply-To: <7354E634-B403-40EA-9B2C-BEA5C0161EC0@redhoundsoftware.com>
Date: Wed, 29 Jan 2025 11:12:21 -0500
Content-Transfer-Encoding: quoted-printable
Message-Id: <300D175A-73FC-47DD-8802-2FA49D04C113@sn3rd.com>
References: <E48F2AC4-C1EC-47C0-B09B-F496F4F6C358@sn3rd.com> <7354E634-B403-40EA-9B2C-BEA5C0161EC0@redhoundsoftware.com>
To: Carl Wallace <carl@redhoundsoftware.com>
X-Mailer: Apple Mail (2.3826.300.87.4.3)
Message-ID-Hash: 7ERSI7CPQJGOPBZC2AT55YEAHTYXM35M
X-Message-ID-Hash: 7ERSI7CPQJGOPBZC2AT55YEAHTYXM35M
X-MailFrom: sean@sn3rd.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-spasm.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Russ Housley <housley@vigilsec.com>, spasm@ietf.org, lamps-chairs@ietf.org, lamps-ads@ietf.org, Dmitry Belyavskiy <dbelyavs@redhat.com>, Matt Caswell <matt@openssl.org>, David Hook <dgh@bouncycastle.org>, Tim Hudson <tjh@openssl.org>, Robert Relyea <rrelyea@redhat.com>, Simo Sorce <ssorce@redhat.com>, Viktor Dukhovni <ietf-dane@dukhovni.org>
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [lamps] Re: Request to Extend IETF WGLC for ML-KEM and ML-DSA private key format Specifications
List-Id: This is the mail list for the LAMPS Working Group <spasm.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/_6tIKt09yh3cW1q8eY2u09k1hMQ>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Owner: <mailto:spasm-owner@ietf.org>
List-Post: <mailto:spasm@ietf.org>
List-Subscribe: <mailto:spasm-join@ietf.org>
List-Unsubscribe: <mailto:spasm-leave@ietf.org>

Carl,

I too jumped right past Dustin note: “[w]e plan to post this text on our FIPS 203 and 204 websites in some fashion shortly.”

spt

> On Jan 28, 2025, at 12:34 PM, Carl Wallace <carl@redhoundsoftware.com> wrote:
> 
> Do they plan to update the FIPS documents to make this clear in the algorithm definitions vs forwarded email?
> 
>> On Jan 28, 2025, at 12:22 PM, Sean Turner <sean@sn3rd.com> wrote:
>> 
>> With SEED being okay, my preferences in order are:
>> 
>> - seed only
>> then
>> - seed + expanded key using SIZE constraints
>> then
>> - seed + expanded key using a tag (SEQ or CHOICE)
>> then
>> - new OIDs
>> 
>> spt
>> 
>>> On Jan 28, 2025, at 12:12 PM, Russ Housley <housley@vigilsec.com> wrote:
>>> 
>>> For the whole mail list, the following mail was just received from Dustin Moody at NIST...
>>> 
>>> 
>>> From: "Moody, Dustin (Fed)" <dustin.moody@nist.gov>
>>> Subject: Re: The ML-KEM SEEDs thing
>>> Date: January 28, 2025 at 12:07:49 PM EST
>>> To: David Hook <David.Hook@keyfactor.com>, Mike Ounsworth <Mike.Ounsworth@entrust.com>, "Souppaya, Murugiah P. (Fed)" <murugiah.souppaya@nist.gov>
>>> Cc: Russ Housley <housley@vigilsec.com>, Tim Hudson <tjh@openssl.org>, Tim Hollebeek <tim.hollebeek@digicert.com>, John Gray <John.Gray@entrust.com>, Viktor Dukhovni <viktor@dukhovni.org>
>>> 
>>> Mike, David, and anybody else,
>>> 
>>> We plan to post this text on our FIPS 203 and 204 websites in some fashion shortly.  We've discussed it with the CMVP, and we are all in agreement.
>>> 
>>> Q: Are cryptographic modules implementing FIPS 203 or FIPS 204 allowed to use seeds as the default key format instead of expanded keys? For example, in FIPS 203, can a cryptographic module store a 64-byte seed (d, z) instead of the output (dk, ek) of Algorithm 19 (ML-KEM.KeyGen), and compute (dk, ek) as needed via (dk, ek) <-- ML-KEM.KeyGen_internal(d, z)?
>>> 
>>> A: For both FIPS 203 and FIPS 204, a KeyGen seed is considered an acceptable alternative format for a key-pair, or for the private (i.e., decapsulation or signing) key. In particular, generating the seed in one cryptographic module and then importing it into another cryptographic module is allowed.
>>> 
>>> Hopefully this is clear, and answers the question.
>>> 
>>> Dustin
>>> 
>>> 
>>> 
>>>>> On Jan 21, 2025, at 9:04 AM, Viktor Dukhovni <ietf-dane@dukhovni.org> wrote:
>>>> 
>>>> Dear LAMPS WG particants, chairs and ADs,
>>>> 
>>>> We, the undersigned, would respectfully appreciate the IETF WGLC
>>>> on private format key specifications for PQ algorithms, namely
>>>> draft-ietf-lamps-kyber-certificates-07 and
>>>> draft-ietf-lamps-dilithium-certificates-06, being extended until
>>>> the end of January for WG members and other interested parties to
>>>> be able to fully consider the information outlined in this
>>>> document. Presently we feel we are unable to both serve our user
>>>> bases and conform to the proposed specification, and have little
>>>> choice but to offer our users alternative private key formats.
>>>> 
>>>> We will represent keys in a manner that maximises their usability
>>>> for our users. Specifically, the simplest ASN.1 encoding (see
>>>> below) that can represent the {SEED}, the private/secret {KEY}, or
>>>> both. We do acknowledge that our case is from the perspective of
>>>> hindsight and that it is very unlikely that previous comments on
>>>> the IETF WGLC drafts would have been in a position to take these
>>>> things into account.
>>>> 
>>>> For those who do not closely follow the PKCS#11 and KMIP technical
>>>> committees in OASIS Open, both of those standards have been
>>>> tracking the various NIST specification updates and final
>>>> publication and have early adopters working across ML-KEM, ML-DSA
>>>> and SLH-DSA.
>>>> 
>>>> The consolidated viewpoint within the PKCS#11 and KMIP TCs is that
>>>> we cannot mandate that all implementations (especially HW-based)
>>>> must be able to support import and export of the SEED.
>>>> 
>>>> For those not familiar with PKCS#11 version 3.2, which adds
>>>> support for ML-KEM and ML-DSA the definitions for the private key
>>>> for each algorithm are formed using three attributes -
>>>> CKA_PARAMETER_SET, CKA_SEED and CKA_VALUE. The latest draft of
>>>> PKCS#11 v3.2 is available at
>>>> https://groups.oasis-open.org/higherlogic/ws/public/download/72453/pkcs11-spec-v3.2-wd08.docx
>>>> 
>>>> The PKCS#11 specification explicitly states the following:
>>>> 
>>>> At least one of CKA_SEED and CKA_VALUE must be specified on
>>>> C_CreateObject. Tokens may reject creation requests that only
>>>> specify one of these values. For highest compatibility
>>>> applications should set both.
>>>> 
>>>> Similarly, for KMIP version 3.0 which adds support for ML-KEM and
>>>> ML-DSA, the technical committee is closely aligned with the
>>>> PKCS#11 technical committee and mirrors the recommendation to
>>>> return both for maximum interoperability. The update delta to the
>>>> latest draft of KMIP v3.0 is available at
>>>> https://groups.oasis-open.org/higherlogic/ws/public/download/72473/kmip-spec-v3.0-wd18-markup.pdf/latest
>>>> 
>>>> The KMIP specification explicitly states the following:
>>>> 
>>>> At least one of Seed and Key SHALL be specified.
>>>> Implementations MAY reject operations involving managed
>>>> objects using this Key Format if only one of these values is
>>>> specified and that value is not supported by the underlying
>>>> implementation. For maximum interoperability applications
>>>> SHOULD set both Seed and Key.
>>>> 
>>>> The various IETF drafts have operated on the assumption that it is
>>>> possible to mandate {SEED} and that all other standards will
>>>> correspondingly mandate it and that all the various
>>>> implementations in cryptographic toolkits will also provide
>>>> interfaces that always support the retention, import and export of
>>>> the {SEED}.
>>>> 
>>>> The PKCS#11 and KMIP standards do not share this IETF assumption.
>>>> Once you accept that multiple formats for import and export need
>>>> to be supported then an encoding format to support multiple
>>>> formats must be defined.
>>>> 
>>>> For a variety of reasons other standards groups and users have
>>>> reached a different view to that of the IETF. We feel it would be
>>>> a distraction at this time to debate the legitimacy of those
>>>> reasons, our view is that we simply need to be able to support
>>>> those users by implementing a more flexible private key format.
>>>> 
>>>> Maximum interoperability necessitates that implementations should
>>>> export the {SEED} and the private {KEY} if possible, or just the
>>>> private {KEY} (if the {SEED} is unavailable). For imports,
>>>> whichever of these are supported by the ultimate implementation
>>>> should be used (i.e. if the underlying cryptographic module or
>>>> hardware solution supports {SEED} as an input, it should be used;
>>>> if it does not then the private {KEY} should be used). In short,
>>>> {SEED + KEY} is recommended, {KEY} is mandatory to support, and
>>>> {SEED} is optional to support.
>>>> 
>>>> Separately, the decision to remove the ASN.1 encoding from the
>>>> PrivateKey in PKCS#8 format is not only against standing and
>>>> expected practice, but doesn't leave a sustainable solution to
>>>> support both formats. PKCS#8 is ASN.1 at its core, and the use of
>>>> PKCS#8 should reflect that (and does with every other algorithm).
>>>> When combined with the requirement to support multiple formats,
>>>> using ASN.1 to represent the alternatives is the natural outcome.
>>>> 
>>>> Like the IETF (“"rough consensus and running code"), actual
>>>> implementation experience is critically important to PKCS#11,
>>>> KMIP, OpenSSL, Bouncy Castle, and other major standards and
>>>> implementations. Within OpenSSL, our collective experience is that
>>>> length-based discrimination to distinguish input formats is
>>>> fragile and should be avoided. Unambiguous ASN.1 tagging avoids
>>>> such heuristics and better aligns with how the keys of all other
>>>> algorithms are handled.
>>>> 
>>>> Both OpenSSL and Bouncy Castle have implemented support for the
>>>> various changing formats over time - and attempted to maximise
>>>> interoperability. The resulting code necessitated determination of
>>>> the format by performing length check and other heuristics and as
>>>> such is considered an undesirable approach. The history of such
>>>> heuristics based code suggests that it is likely to result in CVEs
>>>> as it results in additional complications.
>>>> 
>>>> Flexibility on input allows us to interoperate with other
>>>> implementations, however, absent a format that can represent both
>>>> the {SEED} and {KEY}, when we come to selecting an output format
>>>> we'd have to place the burden on the user to determine which to
>>>> choose. If {SEED}-only is selected there are interoperability
>>>> issues, if {KEY}-only is selected there are interoperability
>>>> issues. This leads to a conclusion that the maximally
>>>> interoperable format is {SEED + KEY}.
>>>> 
>>>> As interoperability is an industry-wide guiding principle, we have
>>>> selected to output {SEED + KEY}, when possible, and {KEY} or
>>>> {SEED} (whichever is available) otherwise. This will be in our
>>>> next release (for OpenSSL this is version 3.5 which will be
>>>> released in April 2025; for Bouncy Castle, this is version BC Java
>>>> 1.81 which will be released April 2025).
>>>> 
>>>> Therefore, the private key format that best serves our users and
>>>> we are advocating the IETF adopt is:
>>>> 
>>>> PrivateKey ::= SEQUENCE {
>>>>     seed OCTET STRING OPTIONAL,
>>>>     expandedKey [1] IMPLICIT OCTET STRING OPTIONAL
>>>> }
>>>> 
>>>> As opposed to the current definition at the end of section 5 of
>>>> the draft:
>>>> 
>>>> When used in a OneAsymmetricKey type, the privateKey OCTET
>>>> STRING contains the raw octet string encoding of the 64-octet
>>>> seed.
>>>> 
>>>> If the IETF Working Group decides to output {SEED}-only and not
>>>> support {SEED + KEY} or {KEY}-only, it would interoperate on input
>>>> with OpenSSL and Bouncy Castle, provided the seed is preceded by
>>>> exactly four bytes of ASN.1 encapsulation. In hexadecimal, these
>>>> are: 30420440, indicating a sequence of length 66 enclosing an
>>>> OCTET STRING of length 64. The additional four bytes cannot
>>>> reasonably be argued to be overly burdensome to produce on output,
>>>> or to match and discard on input. Of course if that is the only
>>>> selected option, interoperability will suffer as the specification
>>>> would be unable to represent {SEED + KEY} or {KEY} alone.
>>>> 
>>>> OpenSSL Statement:
>>>> 
>>>> We have working code that can accept all three input variants
>>>> and generate all three output variants proposed. We also
>>>> accept the existing oqs_provider ASN.1 encoded variants but we
>>>> don’t expect that others will do the same. The reworked code
>>>> is cleaner and clearer than our code based on length
>>>> heuristics and processes the ASN.1 encapsulation using a very
>>>> simple table-driven parser, without resort to our
>>>> general-purpose ASN.1 parser (this demonstrates how simple the
>>>> proposed format is to encode and decode).
>>>> 
>>>> Bouncy Castle Statement:
>>>> 
>>>> We have working code that can accept both the proposal
>>>> detailed here and the {SEED}-only proposal. For output we will
>>>> attempt to echo the original encoding, although, particularly
>>>> for the case of ML-KEM, it has become obvious that we need to
>>>> follow  the proposal here (for the sake of our user
>>>> community), as import of keys for the {SEED}-only case may be
>>>> impossible for other FIPS providers where the direct
>>>> processing of encodings is outside of the FIPS boundary. We
>>>> will attempt to migrate {KEY}-only users to the proposal here,
>>>> which will (hopefully) limit us to just {SEED}, or the {SEED +
>>>> KEY} SEQUENCE.
>>>> 
>>>> Authors and Contributors:
>>>> 
>>>> Viktor Dukhovni (OpenSSL)
>>>> Dmitry Belyavskiy (RedHat, OpenSSL maintainer)
>>>> Matt Caswell (OpenSSL Foundation President)
>>>> David Hook (Legion of the Bouncy Castle Inc,
>>>>             co-founder and maintainer)
>>>> Tim Hudson (OpenSSL Corporation President, Cryptsoft CTO,
>>>>             OASIS Open PKCS#11 Profiles Co-Editor,
>>>>             OASIS Open KMIP Profiles Co-Editor,
>>>>             Formal liaison between the OASIS Open PKCS#11 and KMIP
>>>>             Technical Committees)
>>>> Bob Relyea (RedHat, NSS developer,
>>>>             OASIS Open PKCS #11 Co-chair)
>>>> Simo Sorce (RedHat, OASIS Open PKCS #11 member)
>>>> 
>>>> --
>>>> Viktor.
>>>> 
>>>> A formatted copy of this note can be found at:
>>>> 
>>>> https://openssl-corporation.org/files/blog/Request_to_Extend_IETF_WGLC_for_PQ_Key_Specifications.pdf
>>>> 
>>>> A work-in-progress snapshot of of a proposed revision of the draft
>>>> specification ML-KEM can be temporarily found at:
>>>> 
>>>> https://vdukhovni.github.io/ml-kem-certificates/
>>>> 
>>>> similar changes would be needed ml-dsa.
>>> 
>>> _______________________________________________
>>> Spasm mailing list -- spasm@ietf.org
>>> To unsubscribe send an email to spasm-leave@ietf.org
>> 
>> _______________________________________________
>> Spasm mailing list -- spasm@ietf.org
>> To unsubscribe send an email to spasm-leave@ietf.org