LAMPS S. Turner Internet-Draft sn3rd Intended status: Standards Track P. Kampanakis Expires: 24 April 2025 J. Massimo AWS B. Westerbaan Cloudflare 21 October 2024 Internet X.509 Public Key Infrastructure - Algorithm Identifiers for Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) draft-ietf-lamps-kyber-certificates-latest Abstract Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) is a quantum-resistant key-encapsulation mechanism (KEM). This document specifies algorithm identifiers and ASN.1 encoding format for ML-KEM in public key certificates. The encoding for public and private keys are also provided. About This Document This note is to be removed before publishing as an RFC. The latest revision of this draft can be found at https://lamps- wg.github.io/kyber-certificates/#go.draft-ietf-lamps-kyber- certificates.html. Status information for this document may be found at https://datatracker.ietf.org/doc/draft-ietf-lamps-kyber- certificates/. Discussion of this document takes place on the Limited Additional Mechanisms for PKIX and SMIME (lamps) Working Group mailing list (mailto:spasm@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/spasm/. Subscribe at https://www.ietf.org/mailman/listinfo/spasm/. Source for this draft and an issue tracker can be found at https://github.com/lamps-wg/kyber-certificates. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on 24 April 2025. Copyright Notice Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Table of Contents 1. Introduction 1.1. ASN.1 Module and ML-KEM Identifiers 1.2. Applicability Statement 2. Conventions and Definitions 3. Identifiers 4. Subject Public Key Fields 5. Private Key Format 6. ASN.1 Module 7. Security Considerations 8. IANA Considerations 9. References 9.1. Normative References 9.2. Informative References Appendix A. Examples A.1. Example Public Key A.2. Example Private Key A.3. Example Certificate Acknowledgments Authors' Addresses 1. Introduction The Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) standardized in [FIPS203] is a quantum-resistant key-encapsulation mechanism (KEM) standardized by the US National Institute of Standards and Technology (NIST) PQC Project [NIST-PQC]. Prior to standardization, the mechanism was known as Kyber. ML-KEM and Kyber are not compatible. This document specifies the use of ML-KEM in Public Key Infrastructure X.509 (PKIX) certificates [RFC5280] at three security levels: ML-KEM-512, ML-KEM-768, and ML-KEM-1024, using object identifiers assigned by NIST. This specification includes conventions for the subjectPublicKeyInfo field within Internet X.509 certificates [RFC5280], like [RFC3279] did for classic cryptography and [RFC5480] did for elliptic curve cryptography. The private key format is also specified. 1.1. ASN.1 Module and ML-KEM Identifiers An ASN.1 module [X680] is included for reference purposes. Note that as per [RFC5280], certificates use the Distinguished Encoding Rules; see [X690]. Also note that NIST defined the object identifiers for the ML-KEM algorithms in an ASN.1 module; see (TODO insert reference). 1.2. Applicability Statement ML-KEM certificates are used in protocols where the public key is used to generate and encapsulate a shared secret used to derive a symmetric key used to encrypt a payload; see [I-D.ietf-lamps-cms-kyber]. To be used in TLS, ML-KEM certificates could only be used as end-entity identity certificates and would require significant updates to the protocol; see [I-D.celi-wiggers-tls-authkem]. 2. Conventions and Definitions The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. 3. Identifiers Certificates conforming to [RFC5280] can convey a public key for any public key algorithm. The certificate indicates the algorithm through an algorithm identifier. An algorithm identifier consists of an object identifier and optional parameters. The AlgorithmIdentifier type, which is included herein for convenience, is defined as follows: AlgorithmIdentifier{ALGORITHM-TYPE, ALGORITHM-TYPE:AlgorithmSet} ::= SEQUENCE { algorithm ALGORITHM-TYPE.&id({AlgorithmSet}), parameters ALGORITHM-TYPE. &Params({AlgorithmSet}{@algorithm}) OPTIONAL } | NOTE: The above syntax is from [RFC5912] and is compatible with | the 2021 ASN.1 syntax [X680]. See [RFC5280] for the 1988 ASN.1 | syntax. The fields in AlgorithmIdentifier have the following meanings: * algorithm identifies the cryptographic algorithm with an object identifier. * parameters, which are optional, are the associated parameters for the algorithm identifier in the algorithm field. The AlgorithmIdentifier for a ML-KEM public key MUST use one of the id-alg-ml-kem object identifiers listed below, based on the security level. The parameters field of the AlgorithmIdentifier for the ML- KEM public key MUST be absent. When any of the ML-KEM AlgorithmIdentifier appears in the SubjectPublicKeyInfo field of an X.509 certificate, the key usage certificate extension MUST only contain keyEncipherment Section 4.2.1.3 of [RFC5280]. pk-ml-kem-512 PUBLIC-KEY ::= { IDENTIFIER id-alg-ml-kem-512 -- KEY no ASN.1 wrapping -- PARAMS ARE absent CERT-KEY-USAGE { keyEncipherment } --- PRIVATE-KEY no ASN.1 wrapping -- } pk-ml-kem-768 PUBLIC-KEY ::= { IDENTIFIER id-alg-ml-kem-768 -- KEY no ASN.1 wrapping -- PARAMS ARE absent CERT-KEY-USAGE { keyEncipherment } --- PRIVATE-KEY no ASN.1 wrapping -- } pk-ml-kem-1024 PUBLIC-KEY ::= { IDENTIFIER id-alg-ml-kem-1024 -- KEY no ASN.1 wrapping -- PARAMS ARE absent CERT-KEY-USAGE { keyEncipherment } --- PRIVATE-KEY no ASN.1 wrapping -- } ML-KEM-PublicKey ::= OCTET STRING ML-KEM-PrivateKey ::= OCTET STRING No additional encoding of the ML-KEM public key value is applied in the SubjectPublicKeyInfo field of an X.509 certificate [RFC5280]. However, whenever the ML-KEM public key value appears outside of a certificate, it MAY be encoded as an OCTET STRING. No additional encoding of the ML-KEM private key value is applied in the PrivateKeyInfo field of an Asymmetric Key Package [RFC5958]. However, whenever the ML-KEM private key value appears outside of a Asymmetric Key Package, it MAY be encoded as an OCTET STRING. | NOTE: As noted in Section 3, the values for these object | identifers will be assigned by NIST. Once assigned, they will | be added to a future revision of this document. 4. Subject Public Key Fields In the X.509 certificate, the subjectPublicKeyInfo field has the SubjectPublicKeyInfo type, which has the following ASN.1 syntax: SubjectPublicKeyInfo {PUBLIC-KEY: IOSet} ::= SEQUENCE { algorithm AlgorithmIdentifier {PUBLIC-KEY, {IOSet}}, subjectPublicKey BIT STRING } | NOTE: The above syntax is from [RFC5912] and is compatible with | the 2021 ASN.1 syntax [X680]. See [RFC5280] for the 1988 ASN.1 | syntax. The fields in SubjectPublicKeyInfo have the following meaning: * algorithm is the algorithm identifier and parameters for the public key (see above). * subjectPublicKey contains the byte stream of the public key. The algorithms defined in this document always encode the public key as TODO pick format e.g., exact multiple of 8 bits?. Appendix A.1 contains an example of an id-alg-ml-kem-768 public key encoded using the textual encoding defined in [RFC7468]. 5. Private Key Format An ML-KEM private key is encoded by storing its 64-octet seed in the privateKey field as follows. [FIPS203] specifies two formats for an ML-KEM private key: a 64-octet seed and an (expanded) private key, which is referred to as the decapsulation key. The expanded private key (and public key) is computed from the seed using ML-KEM.KeyGen_internal(d,z) (algorithm 16) using the first 32 octets as _d_ and the remaining 32 octets as _z_. "Asymmetric Key Packages" [RFC5958] describes how to encode a private key in a structure that both identifies what algorithm the private key is for and allows for the public key and additional attributes about the key to be included as well. For illustration, the ASN.1 structure OneAsymmetricKey is replicated below. The algorithm- specific details of how a private key is encoded are left for the document describing the algorithm itself. OneAsymmetricKey ::= SEQUENCE { version Version, privateKeyAlgorithm SEQUENCE { algorithm PUBLIC-KEY.&id({PublicKeySet}), parameters PUBLIC-KEY.&Params({PublicKeySet} {@privateKeyAlgorithm.algorithm}) OPTIONAL} privateKey OCTET STRING (CONTAINING PUBLIC-KEY.&PrivateKey({PublicKeySet} {@privateKeyAlgorithm.algorithm})), attributes [0] Attributes OPTIONAL, ..., [[2: publicKey [1] BIT STRING (CONTAINING PUBLIC-KEY.&Params({PublicKeySet} {@privateKeyAlgorithm.algorithm}) OPTIONAL, ... } | NOTE: The above syntax is from [RFC5958] and is compatible with | the 2021 ASN.1 syntax [X680]. When used in a OneAsymmetricKey type, the privateKey OCTET STRING contains the raw octet string encoding of the 64-octet seed. | NOTE: There exist some private key import functions that have | not implemented the new ASN.1 structure OneAsymmetricKey that | is defined in [RFC5958]. This means that they will not accept | a private key structure that contains the public key field. | This means a balancing act needs to be done between being able | to do a consistency check on the key pair and widest ability to | import the key. Appendix A.2 contains an example of an id-alg-ml-kem-768 private key encoded using the textual encoding defined in [RFC7468]. 6. ASN.1 Module TODO ASN.1 Module 7. Security Considerations The Security Considerations section of [RFC5280] applies to this specification as well. | To Do: Discuss side-channels for Kyber TBD1. 8. IANA Considerations This document will have some IANA actions. 9. References 9.1. Normative References [FIPS203] "Module-Lattice-Based Key-Encapsulation Mechanism Standard", National Institute of Standards and Technology, DOI 10.6028/nist.fips.203, August 2024, . [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, . [RFC5912] Hoffman, P. and J. Schaad, "New ASN.1 Modules for the Public Key Infrastructure Using X.509 (PKIX)", RFC 5912, DOI 10.17487/RFC5912, June 2010, . [RFC5958] Turner, S., "Asymmetric Key Packages", RFC 5958, DOI 10.17487/RFC5958, August 2010, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [X680] ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): Specification of basic notation", ITU-T Recommendation X.680, ISO/IEC 8824-1:2021, February 2021, . [X690] ITU-T, "Information technology - Abstract Syntax Notation One (ASN.1): ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)", ITU-T Recommendation X.690, ISO/IEC 8825-1:2021, February 2021, . 9.2. Informative References [I-D.celi-wiggers-tls-authkem] Wiggers, T., Celi, S., Schwabe, P., Stebila, D., and N. Sullivan, "KEM-based Authentication for TLS 1.3", Work in Progress, Internet-Draft, draft-celi-wiggers-tls-authkem- 04, 17 October 2024, . [I-D.ietf-lamps-cms-kyber] Prat, J., Ounsworth, M., and D. Van Geest, "Use of ML-KEM in the Cryptographic Message Syntax (CMS)", Work in Progress, Internet-Draft, draft-ietf-lamps-cms-kyber-05, 15 October 2024, . [NIST-PQC] National Institute of Standards and Technology (NIST), "Post-Quantum Cryptography Project", 20 December 2016, . [RFC3279] Bassham, L., Polk, W., and R. Housley, "Algorithms and Identifiers for the Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 3279, DOI 10.17487/RFC3279, April 2002, . [RFC5480] Turner, S., Brown, D., Yiu, K., Housley, R., and T. Polk, "Elliptic Curve Cryptography Subject Public Key Information", RFC 5480, DOI 10.17487/RFC5480, March 2009, . [RFC7468] Josefsson, S. and S. Leonard, "Textual Encodings of PKIX, PKCS, and CMS Structures", RFC 7468, DOI 10.17487/RFC7468, April 2015, . Appendix A. Examples This appendix contains examples of ML-KEM public keys, private keys and certificates. A.1. Example Public Key The following is an example of a ML-KEM-768 public key: -----BEGIN PUBLIC KEY----- TODO insert example public key -----END PUBLIC KEY------- A.2. Example Private Key The following is an example of a ML-KEM-768 private key: -----BEGIN PRIVATE KEY----- TODO insert example private key -----END PRIVATE KEY------- The following example, in addition to encoding the ML-KEM-768 private key, has an attribute included as well as the public key: -----BEGIN PRIVATE KEY----- TODO insert example private key with attribute -----END PRIVATE KEY------- A.3. Example Certificate TODO insert ASN.1 Pretty Print -----BEGIN CERTIFICATE----- TODO Certificate -----END CERTIFICATE------- Acknowledgments TODO acknowledge. Authors' Addresses Sean Turner sn3rd Email: sean@sn3rd.com Panos Kampanakis AWS Email: kpanos@amazon.com Jake Massimo AWS Email: jakemas@amazon.com Bas Westerbaan Cloudflare Email: bas@westerbaan.name