LAMPS Working Group R. Housley Internet-Draft Vigil Security Obsoletes: 5990 (if approved) S. Turner Intended status: Standards Track sn3rd Expires: 18 August 2023 14 February 2023 Use of the RSA-KEM Algorithm in the Cryptographic Message Syntax (CMS) draft-housley-lamps-rfc5990bis-00 Abstract The RSA Key Encapsulation Mechanism (RSA-KEM) Algorithm is a one-pass (store-and-forward) cryptographic mechanism for an originator to securely send keying material to a recipient using the recipient's RSA public key. The RSA-KEM Algorithm is specified in Clause 11.5 of ISO/IEC: 18033-2:2006. This document specifies the conventions for using the RSA-KEM Algorithm with the Cryptographic Message Syntax (CMS) using KEMRecipientInfo as specified in draft-housley-lamps-cms- kemri. About This Document This note is to be removed before publishing as an RFC. Status information for this document may be found at https://datatracker.ietf.org/doc/draft-housley-lamps-rfc5990bis/. Discussion of this document takes place on the WG LAMPS mailing list (mailto:spasm@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/spasm/. 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 18 August 2023. Housley & Turner Expires 18 August 2023 [Page 1] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 Copyright Notice Copyright (c) 2023 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Conventions and Definitions . . . . . . . . . . . . . . . 4 1.2. ASN.1 . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3. Changes Since RFC 5990 . . . . . . . . . . . . . . . . . 4 2. Use of the RSA-KEM Algorithm in CMS . . . . . . . . . . . . . 5 2.1. Underlying Components . . . . . . . . . . . . . . . . . . 5 2.2. RecipientInfo Conventions . . . . . . . . . . . . . . . . 5 2.3. Certificate Conventions . . . . . . . . . . . . . . . . . 6 2.4. SMIMECapabilities Attribute Conventions . . . . . . . . . 7 3. Security Considerations . . . . . . . . . . . . . . . . . . . 8 4. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 5. References . . . . . . . . . . . . . . . . . . . . . . . . . 10 5.1. Normative References . . . . . . . . . . . . . . . . . . 10 5.2. Informative References . . . . . . . . . . . . . . . . . 11 Appendix A. RSA-KEM Algorithm . . . . . . . . . . . . . . . . . 12 A.1. Underlying Components . . . . . . . . . . . . . . . . . . 13 A.2. Originator's Operations . . . . . . . . . . . . . . . . . 13 A.3. Recipient's Operations . . . . . . . . . . . . . . . . . 14 Appendix B. ASN.1 Syntax . . . . . . . . . . . . . . . . . . . . 16 B.1. Underlying Components . . . . . . . . . . . . . . . . . . 16 B.2. ASN.1 Module . . . . . . . . . . . . . . . . . . . . . . 17 Appendix C. SMIMECapabilities Examples . . . . . . . . . . . . . 21 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 23 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 23 1. Introduction The RSA Key Encapsulation Mechanism (RSA-KEM) Algorithm is a one-pass (store-and-forward) cryptographic mechanism for an originator to securely send keying material to a recipient using the recipient's RSA public key. The RSA-KEM Algorithm is specified in Clause 11.5 of [ISO18033-2]. Housley & Turner Expires 18 August 2023 [Page 2] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 The RSA-KEM Algorithm takes a different approach than other RSA key transport mechanisms [RFC8017], with the goal of providing higher security assurance. The RSA-KEM Algorithm encrypts a random integer with the recipient's RSA public key, derives a key-encryption key from the random integer, and wraps a symmetric content-encryption key with the key-encryption key. In this way, the originator and the recipient end up with the same content-encryption key. Given a content-encryption key CEK, RSA-KEM can be summarized as: 1. Generate a random integer z between 0 and n-1. 2. Encrypt the integer z with the recipient's RSA public key: c = z^e mod n 3. Derive a key-encryption key KEK from the integer z: KEK = KDF(z) 4. Wrap the CEK with the KEK to obtain wrapped keying material WK: WK = WRAP(KEK, CEK) 5. The originator sends c and WK to the recipient. This different approach provides higher security assurance for two reasons. First, the input to the underlying RSA operation is effectively a random integer between 0 and n-1, where n is the RSA modulus, so it does not have any structure that could be exploited by an adversary. Second, the input is independent of the keying material so the result of the RSA decryption operation is not directly available to an adversary. As a result, the RSA-KEM Algorithm enjoys a "tight" security proof in the random oracle model. (In other padding schemes, such as PKCS #1 v1.5 [RFC8017], the input has structure and/or depends on the keying material, and the provable security assurances are not as strong.) The approach is also architecturally convenient because the public-key operations are separate from the symmetric operations on the keying material. Another benefit is that the length of the keying material is bounded only by the symmetric key-wrapping algorithm, not the size of the RSA modulus. For completeness, a specification of the RSA-KEM Algorithm is given in Appendix A of this document; ASN.1 syntax is given in Appendix B. Housley & Turner Expires 18 August 2023 [Page 3] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 1.1. 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. 1.2. ASN.1 CMS values are generated using ASN.1 [X.680], which uses the Basic Encoding Rules (BER) and the Distinguished Encoding Rules (DER) [X.690]. 1.3. Changes Since RFC 5990 RFC 5990 [RFC5990] specified the conventions for using the RSA-KEM Algorithm in CMS as a key transport algorithm. That is, it used KeyTransRecipientInfo [RFC5652] for each recipient. This approach resulted in a very complex parameter definition with the id-rsa-kem algorithm identifier. Implementation experience with many different algorithms has shown that complex parameter structures cause interoperability issues. Since the publication of RFC 5990, a new KEMRecipientInfo structure [I-D.housley-lamps-cms-kemri] has been defined to support KEM algorithms, and this new structure avoids the complex parameters structure that was used in RFC 5990. Likewise, when the id-rsa-kem algorithm identifier appears in the SubjectPublicKeyInfo field of a certificate, this document encourages the omission of any parameters. RFC 5990 uses EK and the EncryptedKey, which the concatenation of C and WK (C || WK). The use of EK is necessary to align with the KeyTransRecipientInfo structure. In this document, C and WK are sent in separate fields of new KEMRecipientInfo structure. In particular, C is carried in the kemct field, and WK is carried in the encryptedKey field. RFC 5990 supports the future definition of additional KEM algorithms that use RSA; this document supports only one, and it is identified by the id-kem-rsa object identifier. RFC 5990 includes support for Camellia and Triple-DES block ciphers; discussion of these block ciphers is removed from this document, but the algorithm identifiers remain in the ASN.1 Module Appendix B.2. RFC 5990 includes support for SHA-1 hash function; discussion of this hash function is removed from this document, but the algorithm identifier remains in the ASN.1 module Appendix B.2. Housley & Turner Expires 18 August 2023 [Page 4] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 RFC 5990 required support for the KDF3 [ANS-X9.44] key-derivation function; this document continues to require support for the KDF3 key-derivation function, but it requires support for SHA-256 [SHS] as the hash function. RFC 5990 recommends support for alternatives to KDF3 and AES-Wrap- 128; this document simply states that other key-derivation functions and key-encryption algorithms MAY be supported. RFC 5990 includes an ASN.1 module; this document provides an alternative ASN.1 module that follows the conventions established in [RFC5911], [RFC5912], and [RFC6268]. The new ASN.1 module Appendix B.2 produces the same bits-on-the-wire as the one in RFC 5990. 2. Use of the RSA-KEM Algorithm in CMS The RSA-KEM Algorithm MAY be employed for one or more recipients in the CMS enveloped-data content type [RFC5652], the CMS authenticated- data content type [RFC5652], or the CMS authenticated-enveloped-data content type [RFC5083]. In each case, the KEMRecipientInfo [I-D.housley-lamps-cms-kemri] is used with with the RSA-KEM Algorithm to securely transfer the content-encryption key from the originator to the recipient. 2.1. Underlying Components A CMS implementation that supports the RSA-KEM Algorithm MUST support at least the following underlying components: * For the key-derivation function, an implementation MUST support KDF3 [ANS-X9.44] with SHA-256 [SHS]. * For key-wrapping, an implementation MUST support the AES-Wrap-128 [RFC3394] key-encryption algorithm. An implementation MAY also support other key-derivation functions and key-encryption algorithms as well. 2.2. RecipientInfo Conventions When the RSA-KEM Algorithm is employed for a recipient, the RecipientInfo alternative for that recipient MUST be OtherRecipientInfo using the KEMRecipientInfo structure [I-D.housley-lamps-cms-kemri]. The fields of the KEMRecipientInfo MUST have the following values: version is the syntax version number; it MUST be 0. Housley & Turner Expires 18 August 2023 [Page 5] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 rid identifies the recipient's certificate or public key. kem identifies the KEM algorithm; it MUST contain id-kem-rsa. kemct is the ciphertext produced for this recipient; it contains C from steps 1 and 2 of Originator's Operations in Appendix A. kdf identifies the key-derivation algorithm. kekLength is the size of the key-encryption key in octets. ukm is an optional random input to the key-derivation function. wrap identifies a key-encryption algorithm used to encrypt the content-encryption key. encryptedKey is the result of encrypting the keying material with the key-encryption key. When used with the CMS enveloped-data content type [RFC5652], the keying material is a content- encryption key. When used with the CMS authenticated-data content type [RFC5652], the keying material is a message-authentication key. When used with the CMS authenticated-enveloped-data content type [RFC5083], the keying material is a content-authenticated- encryption key. 2.3. Certificate Conventions The conventions specified in this section augment RFC 5280 [RFC5280]. A recipient who employs the RSA-KEM Algorithm MAY identify the public key in a certificate by the same AlgorithmIdentifier as for the PKCS #1 v1.5 algorithm, that is, using the rsaEncryption object identifier [RFC8017]. The fact that the recipient will accept RSA-KEM with this public key is not indicated by the use of this object identifier. The willingness to accept the RSA-KEM Algorithm MAY be signaled by the use of the appropriate SMIME Capabilities either in a message or in the certificate. If the recipient wishes only to employ the RSA-KEM Algorithm with a given public key, the recipient MUST identify the public key in the certificate using the id-rsa-kem object identifier; see Appendix B. When the id-rsa-kem object identifier appears in the SubjectPublicKeyInfo algorithm field of the certificate, the parameters field from AlgorithmIdentifier SHOULD be absent. That is, the AlgorithmIdentifier SHOULD be a SEQUENCE of one component, the id-rsa-kem object identifier. Housley & Turner Expires 18 August 2023 [Page 6] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 When the AlgorithmIdentifier parameters are present, the GenericHybridParameters MUST be used. As described in the next section, the GenericHybridParameters constrain the values that can be used with the RSA public key for the kdf, kekLength, and wrap fields of the KEMRecipientInfo structure. Regardless of the AlgorithmIdentifier used, the RSA public key MUST be carried in the subjectPublicKey BIT STRING within the SubjectPublicKeyInfo filed of the certificate using the RSAPublicKey type defined in [RFC8017]. The intended application for the public key MAY be indicated in the key usage certificate extension as specified in Section 4.2.1.3 of [RFC5280]. If the keyUsage extension is present in a certificate that conveys an RSA public key with the id-rsa-kem object identifier as discussed above, then the key usage extension MUST contain the following value: keyEncipherment The digitalSignatrure and dataEncipherment values SHOULD NOT be present. That is, a public key intended to be employed only with the RSA-KEM Algorithm SHOULD NOT also be employed for data encryption or for digital signatures. Good cryptographic practice employs a given RSA key pair in only one scheme. This practice avoids the risk that vulnerability in one scheme may compromise the security of the other, and may be essential to maintain provable security. 2.4. SMIMECapabilities Attribute Conventions Section 2.5.2 of [RFC8551] defines the SMIMECapabilities signed attribute (defined as a SEQUENCE of SMIMECapability SEQUENCEs) to announce a partial list of algorithms that an S/MIME implementation can support. When constructing a CMS signed-data content type [RFC5652], a compliant implementation MAY include the SMIMECapabilities signed attribute announcing that it supports the RSA-KEM Algorithm. The SMIMECapability SEQUENCE representing the RSA-KEM Algorithm MUST include the id-rsa-kem object identifier in the capabilityID field; see Appendix B for the object identifier value, and see Appendix C for examples. When the id-rsa-kem object identifier appears in the capabilityID field and the parameters are present, then the parameters field MUST use the GenericHybridParameters type. GenericHybridParameters ::= SEQUENCE { kem KeyEncapsulationMechanism, dem DataEncapsulationMechanism } Housley & Turner Expires 18 August 2023 [Page 7] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 The fields of the GenericHybridParameters type have the following meanings: kem is an AlgorithmIdentifer; the algorithm field MUST be set to id-kem-rsa; the parameters field MUST be RsaKemParameters, which is a SEQUENCE of an AlgorithmIdentifier that identifies the supported key-derivation function and a positive INTEGER that identifies the length of the key-encryption key in octets. If the GenericHybridParameters are present, then the provided kem value MUST be used as the key-derivation function in the kdf field of KEMRecipientInfo, and the provided key length MUST be used in the kekLength of KEMRecipientInfo. dem is an AlgorithmIdentifier; the algorithm field MUST be present, and it identifies the key-encryption algorithm; parameters are optional. If the GenericHybridParameters are present, then the provided dem value MUST be used in the wrap field of KEMRecipientInfo. 3. Security Considerations The RSA-KEM Algorithm should be considered as a replacement for the widely implemented PKCS #1 v1.5 [RFC8017] for new applications that use CMS to avoid potential vulnerabilities to chosen-ciphertext attacks and gain a tighter security proof; however, the RSA-KEM Algorithm has the disadvantage of slightly longer encrypted keying material. The security of the RSA-KEM Algorithm can be shown to be tightly related to the difficulty of either solving the RSA problem or breaking the underlying symmetric key-encryption algorithm, if the underlying key-derivation function is modeled as a random oracle, and assuming that the symmetric key-encryption algorithm satisfies the properties of a data encapsulation mechanism [SHOUP]. While in practice a random-oracle result does not provide an actual security proof for any particular key-derivation function, the result does provide assurance that the general construction is reasonable; a key- derivation function would need to be particularly weak to lead to an attack that is not possible in the random-oracle model. The RSA key size and the underlying components need to be selected consistent with the desired security level. Several security levels have been identified in the NIST SP 800-57 Part 1 [NISTSP800-57pt1r5]. To achieve 128-bit security, the RSA key size SHOULD be at least 3072 bits, the key-derivation function SHOULD make use of SHA-256, and the symmetric key-encryption algorithm SHOULD be AES Key Wrap with a 128-bit key. Housley & Turner Expires 18 August 2023 [Page 8] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 Implementations MUST protect the RSA private key, the key-encryption key, the content-encryption key, the content-authenticated-encryption key. Compromise of the RSA private key could result in the disclosure of all messages protected with that key. Compromise of the key-encryption key, the content-encryption key, or content- authenticated-encryption key could result in disclosure of the associated encrypted content. Additional considerations related to key management may be found in [NISTSP800-57pt1r5]. The security of the RSA-KEM Algorithm also depends on the strength of the random number generator, which SHOULD have a comparable security level. For further discussion on random number generation, see [RFC4086]. Implementations SHOULD NOT reveal information about intermediate values or calculations, whether by timing or other "side channels", otherwise an opponent may be able to determine information about the keying data and/or the recipient's private key. Although not all intermediate information may be useful to an opponent, it is preferable to conceal as much information as is practical, unless analysis specifically indicates that the information would not be useful to an opponent. Generally, good cryptographic practice employs a given RSA key pair in only one scheme. This practice avoids the risk that vulnerability in one scheme may compromise the security of the other, and may be essential to maintain provable security. While RSA public keys have often been employed for multiple purposes such as key transport and digital signature without any known bad interactions, for increased security assurance, such combined use of an RSA key pair is NOT RECOMMENDED in the future (unless the different schemes are specifically designed to be used together). Accordingly, an RSA key pair used for the RSA-KEM Algorithm SHOULD NOT also be used for digital signatures. Indeed, the Accredited Standards Committee X9 (ASC X9) requires such a separation between key pairs used for key establishment and key pairs used for digital signature [ANS-X9.44]. Continuing this principle of key separation, a key pair used for the RSA-KEM Algorithm SHOULD NOT be used with other key establishment schemes, or for data encryption, or with more than one set of underlying algorithm components. Parties MAY gain assurance that implementations are correct through formal implementation validation, such as the NIST Cryptographic Module Validation Program (CMVP) [CMVP]. Housley & Turner Expires 18 August 2023 [Page 9] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 4. IANA Considerations For the ASN.1 Module in Appendix B.2, IANA is requested to assign an object identifier (OID) for the module identifier. The OID for the module should be allocated in the "SMI Security for S/MIME Module Identifier" registry (1.2.840.113549.1.9.16.0). 5. References 5.1. Normative References [I-D.housley-lamps-cms-kemri] Housley, R., Gray, J., and T. Okubo, "Using Key Encapsulation Mechanism (KEM) Algorithms in the Cryptographic Message Syntax (CMS)", Work in Progress, Internet-Draft, draft-housley-lamps-cms-kemri-00, 1 February 2023, . [ISO18033-2] ISO/IEC JTC 1/SC 27, "Information technology -- Security techniques -- Encryption algorithms -- Part 2: Asymmetric ciphers", ISO/IEC 18033-2:2006, 2006, . [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC5083] Housley, R., "Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type", RFC 5083, DOI 10.17487/RFC5083, November 2007, . [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, . [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, RFC 5652, DOI 10.17487/RFC5652, September 2009, . Housley & Turner Expires 18 August 2023 [Page 10] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 [RFC5911] Hoffman, P. and J. Schaad, "New ASN.1 Modules for Cryptographic Message Syntax (CMS) and S/MIME", RFC 5911, DOI 10.17487/RFC5911, June 2010, . [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, . [RFC6268] Schaad, J. and S. Turner, "Additional New ASN.1 Modules for the Cryptographic Message Syntax (CMS) and the Public Key Infrastructure Using X.509 (PKIX)", RFC 6268, DOI 10.17487/RFC6268, July 2011, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [RFC8551] Schaad, J., Ramsdell, B., and S. Turner, "Secure/ Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification", RFC 8551, DOI 10.17487/RFC8551, April 2019, . [SHS] National Institute of Standards and Technology, "Secure Hash Standard", DOI 10.6028/nist.fips.180-4, July 2015, . [X.680] 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, . [X.690] ITU-T, "Information technology -- 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, . 5.2. Informative References [ANS-X9.44] American National Standards Institute, "Public Key Cryptography for the Financial Services Industry -- Key Establishment Using Integer Factorization Cryptography", American National Standard X9.44, 2007. Housley & Turner Expires 18 August 2023 [Page 11] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 [CMVP] National Institute of Standards and Technology, "Cryptographic Module Validation Program", 2016, . [NISTSP800-57pt1r5] Barker, E. and National Institute of Standards and Technology, "Recommendation for key management:", DOI 10.6028/nist.sp.800-57pt1r5, May 2020, . [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394, September 2002, . [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 10.17487/RFC4086, June 2005, . [RFC5990] Randall, J., Kaliski, B., Brainard, J., and S. Turner, "Use of the RSA-KEM Key Transport Algorithm in the Cryptographic Message Syntax (CMS)", RFC 5990, DOI 10.17487/RFC5990, September 2010, . [RFC6194] Polk, T., Chen, L., Turner, S., and P. Hoffman, "Security Considerations for the SHA-0 and SHA-1 Message-Digest Algorithms", RFC 6194, DOI 10.17487/RFC6194, March 2011, . [RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, "PKCS #1: RSA Cryptography Specifications Version 2.2", RFC 8017, DOI 10.17487/RFC8017, November 2016, . [SHOUP] Shoup, V., "A Proposal for an ISO Standard for Public Key Encryption", Cryptology ePrint Archive Paper 2001/112, 2001, . Appendix A. RSA-KEM Algorithm The RSA-KEM Algorithm is a one-pass (store-and-forward) cryptographic mechanism for an originator to securely send keying material to a recipient using the recipient's RSA public key. Housley & Turner Expires 18 August 2023 [Page 12] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 With this type of algorithm, an originator encrypts the keying material using the recipient's public key, and then sends the resulting encrypted keying material to the recipient. The recipient decrypts the encrypted keying material using the recipient's private key to recover the keying material. A.1. Underlying Components The RSA-KEM Algorithm has the following underlying components: * KDF, a key-derivation function, which derives key-encryption key of a specified length from a shared secret value; * Wrap, a symmetric key-encryption algorithm, which encrypts keying material using key-encryption key that was produced by the KDF. The kekLen value denotes the length in bytes of the key-encryption key for the underlying symmetric key-encryption algorithm. The length of the keying material MUST be among the lengths supported by the underlying symmetric key-encryption algorithm. For example, the AES-Wrap key-encryption algorithm requires the kekLen to be 16, 24, or 32 octets. Usage and formatting of the keying material is outside the scope of the RSA-KEM Algorithm. Many key-derivation functions support the inclusion of other information in addition to the shared secret value in the input to the function. Also, with some symmetric key-encryption algorithms, it is possible to associate a label with the keying material. Such uses are outside the scope of this document, as they are not directly supported by CMS. A.2. Originator's Operations Let (n,e) be the recipient's RSA public key; see [RFC8017] for details. Let K be the keying material to be securely transferred from the originator to the recipient. Let nLen denote the length in bytes of the modulus n, i.e., the least integer such that 2^(8*nLen) > n. The originator performs the following operations: 1. Generate a random integer z between 0 and n-1 (see note), and convert z to a byte string Z of length nLen, most significant byte first: Housley & Turner Expires 18 August 2023 [Page 13] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 z = RandomInteger (0, n-1) Z = IntegerToString (z, nLen) 2. Encrypt the random integer z using the recipient's RSA public key (n,e), and convert the resulting integer c to a ciphertext C, a byte string of length nLen: c = z^e mod n C = IntegerToString (c, nLen) 3. Derive a symmetric key-encryption key KEK of length kekLen bytes from the byte string Z using the underlying key-derivation function: KEK = KDF (Z, kekLen) 4. Wrap the keying material K with the symmetric key-encryption key KEK using the key-encryption algorithm to obtain wrapped keying material WK: WK = Wrap (KEK, K) 5. Send the ciphertext C and the wrapped keying material WK to the recipient. NOTE: The random integer z MUST be generated independently at random for different encryption operations, whether for the same or different recipients. A.3. Recipient's Operations Let (n,d) be the recipient's RSA private key; see [RFC8017] for details, but other private key formats are allowed. Let WK be the encrypted keying material. Let C be the ciphertext. Let nLen denote the length in bytes of the modulus n. The recipient performs the following operations: 1. If the length of the encrypted keying material is less than nLen bytes, output "decryption error", and stop. Housley & Turner Expires 18 August 2023 [Page 14] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 2. Convert the ciphertext C to an integer c, most significant byte first. Decrypt the integer c using the recipient's private key (n,d) to recover an integer z (see NOTE below): c = StringToInteger (C) z = c^d mod n If the integer c is not between 0 and n-1, output "decryption error", and stop. 3. Convert the integer z to a byte string Z of length nLen, most significant byte first (see NOTE below): Z = IntegerToString (z, nLen) 4. Derive a symmetric key-encryption key KEK of length kekLen bytes from the byte string Z using the key-derivation function (see NOTE below): KEK = KDF (Z, kekLen) 5. Unwrap the wrapped keying material WK with the symmetric key- encryption key KEK using the underlying key-encryption algorithm to recover the keying material K: K = Unwrap (KEK, WK) If the unwrapping operation outputs an error, output "decryption error", and stop. 6. Output the keying material K. NOTE: Implementations SHOULD NOT reveal information about the integer z, the string Z, or about the calculation of the exponentiation in Step 2, the conversion in Step 3, or the key derivation in Step 4, whether by timing or other "side channels". The observable behavior of the implementation SHOULD be the same at these steps for all ciphertexts C that are in range. For example, IntegerToString conversion should take the same amount of time regardless of the actual value of the integer z. The integer z, the string Z, and other intermediate results MUST be securely deleted when they are no longer needed. Housley & Turner Expires 18 August 2023 [Page 15] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 Appendix B. ASN.1 Syntax The ASN.1 syntax for identifying the RSA-KEM Algorithm is an extension of the syntax for the "generic hybrid cipher" in ANS X9.44 [ANS-X9.44]. The ASN.1 Module is unchanged from RFC 5990. The id-rsa-kem object identifier is used in a backward compatible manner in certificates [RFC5280] and SMIMECapabilities [RFC8551]. Of course, the use of the id-kem-rsa object identifier in the new KEMRecipientInfo structure [I-D.housley-lamps-cms-kemri] was not yet defined at the time that RFC 5990 was written. B.1. Underlying Components Implementations that conform to this specification MUST support the KDF3 [ANS-X9.44] key-derivation function using SHA-256 [SHS]. The object identifier for KDF3 is: id-kdf-kdf3 OBJECT IDENTIFIER ::= { x9-44-components kdf3(2) } The KDF3 parameters identify the underlying hash function. For alignment with the ANS X9.44, the hash function MUST be an ASC X9-approved hash function. While the SHA-1 hash algorithm is included in the ASN.1 definitions, SHA-1 MUST NOT be used. SHA-1 is considered to be obsolete; see [RFC6194]. SHA-1 remains in the ASN.1 module for compatibility with RFC 5990. In addition, other hash functions MAY be used with CMS. kda-kdf3 KEY-DERIVATION ::= { IDENTIFIER id-kdf-kdf3 PARAMS TYPE KDF3-HashFunction ARE required -- No S/MIME caps defined -- } KDF3-HashFunction ::= AlgorithmIdentifier { DIGEST-ALGORITHM, {KDF3-HashFunctions} } KDF3-HashFunctions DIGEST-ALGORITHM ::= { X9-HashFunctions, ... } X9-HashFunctions DIGEST-ALGORITHM ::= { mda-sha1 | mda-sha224 ! mda-sha256 ! mda-sha384 | mda-sha512, ... } Housley & Turner Expires 18 August 2023 [Page 16] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 Implementations that conform to this specification MUST support the AES Key Wrap [RFC3394] key-encryption algorithm with a 128-bit key. There are three object identifiers for the AES Key Wrap, one for each permitted size of the key-encryption key. There are three object identifiers imported from [RFC5912], and none of these algorithm identifiers have associated parameters: kwa-aes128-wrap KEY-WRAP ::= { IDENTIFIER id-aes128-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-aes128-wrap } } kwa-aes192-wrap KEY-WRAP ::= { IDENTIFIER id-aes192-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-aes192-wrap } } kwa-aes256-wrap KEY-WRAP ::= { IDENTIFIER id-aes256-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-aes256-wrap } } B.2. ASN.1 Module RFC EDITOR: Please replace TBD2 with the value assigned by IANA during the publication of [I-D.housley-lamps-cms-kemri]. CMS-RSA-KEM-2023 { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) cms-rsa-kem-2023(TBD1) } DEFINITIONS ::= BEGIN -- EXPORTS ALL IMPORTS KEM-ALGORITHM FROM KEMAlgorithmInformation-2023 -- [I-D.housley-lamps-cms-kemri] { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-kemAlgorithmInformation-2023(TBD3) } AlgorithmIdentifier{}, PUBLIC-KEY, DIGEST-ALGORITHM, KEY-DERIVATION, KEY-WRAP FROM AlgorithmInformation-2009 -- [RFC5912] { iso(1) identified-organization(3) dod(6) internet(1) Housley & Turner Expires 18 August 2023 [Page 17] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-algorithmInformation-02(58) } kwa-aes128-wrap, kwa-aes192-wrap, kwa-aes256-wrap FROM CMSAesRsaesOaep-2009 -- [RFC5911] { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) id-mod-cms-aes-02(38) } kwa-3DESWrap FROM CryptographicMessageSyntaxAlgorithms-2009 -- [RFC5911] { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) modules(0) id-mod-cmsalg-2001-02(37) } id-camellia128-wrap, id-camellia192-wrap, id-camellia256-wrap FROM CamelliaEncryptionAlgorithmInCMS -- [RFC3657] { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) modules(0) id-mod-cms-camellia(23) } mda-sha1, pk-rsa, RSAPublicKey FROM PKIXAlgs-2009 -- [RFC5912] { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-algorithms2008-02(56) } mda-sha224, mda-sha256, mda-sha384, mda-sha512 FROM PKIX1-PSS-OAEP-Algorithms-2009 -- [RFC5912] { iso(1) identified-organization(3) dod(6) internet(1) security(5) mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-rsa-pkalgs-02(54) } ; -- Useful types and definitions OID ::= OBJECT IDENTIFIER -- alias NullParms ::= NULL -- ISO/IEC 18033-2 arc is18033-2 OID ::= { iso(1) standard(0) is18033(18033) part2(2) } -- NIST algorithm arc nistAlgorithm OID ::= { joint-iso-itu-t(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) } Housley & Turner Expires 18 August 2023 [Page 18] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 -- PKCS #1 arc pkcs-1 OID ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) } -- X9.44 arc x9-44 OID ::= { iso(1) identified-organization(3) tc68(133) country(16) x9(840) x9Standards(9) x9-44(44) } x9-44-components OID ::= { x9-44 components(1) } -- RSA-KEM Algorithm id-rsa-kem OID ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) alg(3) 14 } GenericHybridParameters ::= SEQUENCE { kem KeyEncapsulationMechanism, dem DataEncapsulationMechanism } KeyEncapsulationMechanism ::= AlgorithmIdentifier { KEM-ALGORITHM, {KEMAlgorithms} } KEMAlgorithms KEM-ALGORITHM ::= { kema-kem-rsa, ... } kema-kem-rsa KEM-ALGORITHM ::= { IDENTIFIER id-kem-rsa PARAMS TYPE RsaKemParameters ARE optional PUBLIC-KEYS { pk-rsa | pk-rsa-kem } UKM ARE optional SMIME-CAPS { TYPE GenericHybridParameters IDENTIFIED BY id-rsa-kem } } id-kem-rsa OID ::= { is18033-2 key-encapsulation-mechanism(2) rsa(4) } RsaKemParameters ::= SEQUENCE { keyDerivationFunction KeyDerivationFunction, keyLength KeyLength } pk-rsa-kem PUBLIC-KEY ::= { IDENTIFIER id-rsa-kem KEY RSAPublicKey PARAMS TYPE GenericHybridParameters ARE preferredAbsent -- Private key format is not specified here -- CERT-KEY-USAGE {keyEncipherment} } Housley & Turner Expires 18 August 2023 [Page 19] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 KeyDerivationFunction ::= AlgorithmIdentifier { KEY-DERIVATION, {KDFAlgorithms} } KDFAlgorithms KEY-DERIVATION ::= { kda-kdf2 | kda-kdf3, ... } KeyLength ::= INTEGER (1..MAX) DataEncapsulationMechanism ::= AlgorithmIdentifier { KEY-WRAP, {DEMAlgorithms} } DEMAlgorithms KEY-WRAP ::= { X9-SymmetricKeyWrappingSchemes | Camellia-KeyWrappingSchemes, ... } X9-SymmetricKeyWrappingSchemes KEY-WRAP ::= { kwa-aes128-wrap | kwa-aes192-wrap | kwa-aes256-wrap | kwa-3DESWrap, ... } X9-SymmetricKeyWrappingScheme ::= AlgorithmIdentifier { KEY-WRAP, {X9-SymmetricKeyWrappingSchemes} } Camellia-KeyWrappingSchemes KEY-WRAP ::= { kwa-camellia128-wrap | kwa-camellia192-wrap | kwa-camellia256-wrap, ... } Camellia-KeyWrappingScheme ::= AlgorithmIdentifier { KEY-WRAP, {Camellia-KeyWrappingSchemes} } kwa-camellia128-wrap KEY-WRAP ::= { IDENTIFIER id-camellia128-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-camellia128-wrap } } kwa-camellia192-wrap KEY-WRAP ::= { IDENTIFIER id-camellia192-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-camellia192-wrap } } kwa-camellia256-wrap KEY-WRAP ::= { IDENTIFIER id-camellia256-wrap PARAMS ARE absent SMIME-CAPS { IDENTIFIED BY id-camellia256-wrap } } -- Key Derivation Functions id-kdf-kdf2 OID ::= { x9-44-components kdf2(1) } kda-kdf2 KEY-DERIVATION ::= { Housley & Turner Expires 18 August 2023 [Page 20] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 IDENTIFIER id-kdf-kdf2 PARAMS TYPE KDF2-HashFunction ARE required -- No S/MIME caps defined -- } KDF2-HashFunction ::= AlgorithmIdentifier { DIGEST-ALGORITHM, {KDF2-HashFunctions} } KDF2-HashFunctions DIGEST-ALGORITHM ::= { X9-HashFunctions, ... } id-kdf-kdf3 OID ::= { x9-44-components kdf3(2) } kda-kdf3 KEY-DERIVATION ::= { IDENTIFIER id-kdf-kdf3 PARAMS TYPE KDF3-HashFunction ARE required -- No S/MIME caps defined -- } KDF3-HashFunction ::= AlgorithmIdentifier { DIGEST-ALGORITHM, {KDF3-HashFunctions} } KDF3-HashFunctions DIGEST-ALGORITHM ::= { X9-HashFunctions, ... } -- Hash Functions X9-HashFunctions DIGEST-ALGORITHM ::= { mda-sha1 | mda-sha224 | mda-sha256 | mda-sha384 | mda-sha512, ... } END Appendix C. SMIMECapabilities Examples To indicate support for the RSA-KEM algorithm coupled with the KDF3 key-derivation function with SHA-256 and the AES Key Wrap symmetric key-encryption algorithm 128-bit key-encryption key, the SMIMECapabilities will include the following entry: Housley & Turner Expires 18 August 2023 [Page 21] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 SEQUENCE { id-rsa-kem, -- RSA-KEM Algorithm SEQUENCE { -- GenericHybridParameters SEQUENCE { -- key encapsulation mechanism id-kem-rsa, -- RSA-KEM SEQUENCE { -- RsaKemParameters SEQUENCE { -- key derivation function id-kdf-kdf3, -- KDF3 SEQUENCE { -- KDF3-HashFunction id-sha256 -- SHA-256; no parameters (preferred) }, 16 -- KEK length in bytes }, SEQUENCE { -- data encapsulation mechanism id-aes128-Wrap -- AES-128 Wrap; no parameters } } } This SMIMECapability value has the following DER encoding (in hexadecimal): 30 47 06 0b 2a 86 48 86 f7 0d 01 09 10 03 0e -- id-rsa-kem 30 38 30 29 06 07 28 81 8c 71 02 02 04 -- id-kem-rsa 30 1e 30 19 06 0a 2b 81 05 10 86 48 09 2c 01 02 -- id-kdf-kdf3 30 0b 06 09 60 86 48 01 65 03 04 02 01 -- id-sha256 02 01 10 -- 16 bytes 30 0b 06 09 60 86 48 01 65 03 04 01 05 -- id-aes128-Wrap To indicate support for the RSA-KEM algorithm coupled with the KDF3 key-derivation function with SHA-384 and the AES Key Wrap symmetric key-encryption algorithm 192-bit key-encryption key, the SMIMECapabilities will include the following SMIMECapability value (in hexadecimal): 30 47 06 0b 2a 86 48 86 f7 0d 01 09 10 03 0e 30 38 30 29 06 07 28 81 8c 71 02 02 04 30 1e 30 19 06 0a 2b 81 05 10 86 48 09 2c 01 02 30 0b 06 09 60 86 48 01 65 03 04 02 02 02 01 18 30 0b 06 09 60 86 48 01 65 03 04 01 19 Housley & Turner Expires 18 August 2023 [Page 22] Internet-Draft RSA-KEM with CMS KEMRecipientInfo February 2023 To indicate support for the RSA-KEM algorithm coupled with the KDF3 key-derivation function with SHA-512 and the AES Key Wrap symmetric key-encryption algorithm 256-bit key-encryption key, the SMIMECapabilities will include the following SMIMECapability value (in hexadecimal): 30 47 06 0b 2a 86 48 86 f7 0d 01 09 10 03 0e 30 38 30 29 06 07 28 81 8c 71 02 02 04 30 1e 30 19 06 0a 2b 81 05 10 86 48 09 2c 01 02 30 0b 06 09 60 86 48 01 65 03 04 02 03 02 01 20 30 0b 06 09 60 86 48 01 65 03 04 01 2d Acknowledgements We thank James Randall, Burt Kaliski, and John Brainard as the original authors of RFC 5990; this document is based on their work. We thank the members of the ASC X9F1 working group for their contributions to drafts of ANS X9.44, which led to RFC 5990. We thank Blake Ramsdell, Jim Schaad, Magnus Nystrom, Bob Griffin, and John Linn for helping bring RFC 5990 to fruition. Authors' Addresses Russ Housley Vigil Security, LLC 516 Dranesville Road Herndon, VA, 20170 United States of America Email: housley@vigilsec.com Sean Turner sn3rd Washington, DC, 20002 United States of America Email: sean@sn3rd.com Housley & Turner Expires 18 August 2023 [Page 23]