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

Russ Housley <housley@vigilsec.com> Thu, 29 September 2022 14:11 UTC

Return-Path: <housley@vigilsec.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 4073DC14CE3B for <spasm@ietfa.amsl.com>; Thu, 29 Sep 2022 07:11:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.906
X-Spam-Level:
X-Spam-Status: No, score=-6.906 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=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
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 38bwbZCKB72h for <spasm@ietfa.amsl.com>; Thu, 29 Sep 2022 07:11:47 -0700 (PDT)
Received: from mail3.g24.pair.com (mail3.g24.pair.com [66.39.134.11]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 5775FC14F720 for <spasm@ietf.org>; Thu, 29 Sep 2022 07:11:47 -0700 (PDT)
Received: from mail3.g24.pair.com (localhost [127.0.0.1]) by mail3.g24.pair.com (Postfix) with ESMTP id 77B9316AC90 for <spasm@ietf.org>; Thu, 29 Sep 2022 10:11:45 -0400 (EDT)
Received: from [10.0.1.2] (pfs.iad.rg.net [198.180.150.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail3.g24.pair.com (Postfix) with ESMTPSA id 3DB4D16AC11 for <spasm@ietf.org>; Thu, 29 Sep 2022 10:11:45 -0400 (EDT)
From: Russ Housley <housley@vigilsec.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_D5660673-4970-44E5-980F-3B8C77FEBD0A"
Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\))
Date: Thu, 29 Sep 2022 10:11:44 -0400
References: <DM6PR11MB25852643FB14014E92A5CFE1EA549@DM6PR11MB2585.namprd11.prod.outlook.com>
To: LAMPS <spasm@ietf.org>
In-Reply-To: <DM6PR11MB25852643FB14014E92A5CFE1EA549@DM6PR11MB2585.namprd11.prod.outlook.com>
Message-Id: <79AD46D5-A9C5-45F2-8E88-0359A3E2FCF3@vigilsec.com>
X-Mailer: Apple Mail (2.3445.104.21)
X-Scanned-By: mailmunge 3.09 on 66.39.134.11
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/wNuD8YfDxDlOzh0i7PcKoGps3zQ>
Subject: Re: [lamps] 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 14:11:49 -0000

Trimming the recipient list because the other messages needed moderation for "too many recipients"

draft-uni-qsckeys-01 makes the argument that for the private keys, one size does not fit every use case.  If there is consensus on this view, thenOPTIONAL fields or a CHOICE within the private key structure seems like a simple way forward.

I was really hoping that the public key would _always_ be an OCTET STRING.  No optional parts. 

Russ


> On Sep 28, 2022, at 2:33 PM, John Gray <John.Gray=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.   😊
>  
> 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://datatracker.ietf.org/doc/draft-massimo-lamps-pq-sig-certificates/>
>  
> 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://datatracker.ietf.org/doc/draft-uni-qsckeys/01/>
>  
> 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://datatracker.ietf.org/doc/draft-ietf-lamps-kyber-certificates/>  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://datatracker.ietf.org/doc/draft-uni-qsckeys/01/>
>  
>    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://datatracker.ietf.org/doc/draft-uni-qsckeys/01/> 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
> https://www.ietf.org/mailman/listinfo/spasm