RFC 9690: Use of the RSA-KEM Algorithm in the Cryptographic Message Syntax (CMS) | RFC Editor (original) (raw)
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 as a standalone KEM algorithm and the conventions for using the RSA-KEM algorithm with the Cryptographic Message Syntax (CMS) using KEMRecipientInfo as specified in RFC 9629. This document obsoletes RFC 5990.¶
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc9690.¶
Copyright Notice
Copyright (c) 2025 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.¶
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].¶
The RSA-KEM algorithm takes a different approach than other RSA key transport mechanisms [RFC8017] with the goal of providing higher security assurance while also satisfying the KEM interface. The RSA-KEM algorithm encrypts a random integer with the recipient's RSA public key and derives a shared secret from the random integer. The originator and recipient can derive a symmetric key from the shared secret. For example, a key-encryption key (KEK) can be derived from the shared secret to wrap a content-encryption key (CEK).¶
In the Cryptographic Message Syntax (CMS) [RFC5652] using KEMRecipientInfo [RFC9629], the shared-secret value is input to a key derivation function (KDF) to compute a key-encryption key and wrap 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.¶
For completeness, a specification of the RSA-KEM algorithm is given inAppendix A of this document. ASN.1 syntax is given in Appendix B.¶
1.1. RSA-KEM Algorithm Rationale
The RSA-KEM algorithm provides higher security assurance than other variants of the RSA cryptosystem for two reasons. First, the input to the underlying RSA operation is a string-encoded 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 depends on the keying material. Additionally, 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 determined by the symmetric algorithms, not the size of the RSA modulus.¶
1.2. RSA-KEM Algorithm Summary
All KEM algorithms provide three functions: KeyGen(), Encapsulate(), and Decapsulate().¶
The following summarizes these three functions for the RSA-KEM algorithm:¶
KeyGen() -> (pk, sk):
Generate the public key (pk) and a private key (sk) as described in Section 3 of [RFC8017].¶
Encapsulate(pk) -> (ct, SS):
Given the recipient's public key (pk), produce a ciphertext (ct) to be passed to the recipient and a shared secret (SS) for use by the originator as follows:¶
Decapsulate(sk, ct) -> SS:
Given the private key (sk) and the ciphertext (ct), produce the shared secret (SS) for the recipient as follows:¶
1.3. CMS KEMRecipientInfo Processing Summary
To support the RSA-KEM algorithm, the CMS originatorMUST implement Encapsulate().¶
Given a content-encryption key CEK, the RSA-KEM algorithm processing by the originator to produce the values that are carried in the CMS KEMRecipientInfo can be summarized as follows:¶
To support the RSA-KEM algorithm, the CMS recipientMUST implement Decapsulate().¶
The RSA-KEM algorithm recipient processing of the values obtained from the KEMRecipientInfo structure is summarized as follows:¶
Note that the KDF used to process the KEMRecipientInfo structure MAY be different from the KDF used to derive the shared secret in the RSA-KEM algorithm.¶
1.4. 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.5. 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.6. 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. Since the publication of RFC 5990, a new KEMRecipientInfo structure [RFC9629] has been defined to support KEM algorithms. When the id-rsa-kem algorithm identifier appears in the SubjectPublicKeyInfo field of a certificate, the complex parameter structure defined in RFC 5990 can be omitted; however, the parameters are allowed for backward compatibility. Also, to avoid visual confusion with id‑kem‑rsa, id‑rsa‑kem‑spki is introduced as an alias for id-rsa-kem.¶
RFC 5990 used EK as the EncryptedKey, which is the concatenation of the ciphertext C and the wrapped key WK, EK = (C || WK). The use of EK was necessary to align with the KeyTransRecipientInfo structure. In this document, the ciphertext and the wrapped key are sent in separate fields of the KEMRecipientInfo structure. In particular, the ciphertext is carried in the kemct field, and the wrapped key is carried in the encryptedKey field. See Appendix A for details about the computation of the ciphertext.¶
RFC 5990 included support for Camellia and Triple-DES block ciphers; discussion of these block ciphers does not appear in this document, but the algorithm identifiers remain in the ASN.1 module (see Appendix B.2).¶
RFC 5990 included support for SHA-1 hash function; discussion of this hash function does not appear this document, but the algorithm identifier remains in the ASN.1 module (see Appendix B.2).¶
RFC 5990 required support for the KDF3 key derivation function[ANS-X9.44]; 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 recommended support for alternatives to KDF3 and AES-Wrap-128; this document simply states that other key derivation functions and other key-encryption algorithms MAY be supported.¶
RFC 5990 supported 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 included 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[RFC9629] is used with the RSA-KEM algorithm to securely transfer the content-encryption key from the originator to the recipient.¶
2.1. Mandatory To Implement
A CMS implementation that supports the RSA-KEM algorithm MUST support at least the following underlying components:¶
An implementation MAY also support other key derivation functions and other key-encryption algorithms.¶
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[RFC9629]. The fields of the KEMRecipientInfo MUST have the following values:¶
NOTE: For backward compatibility, implementations MAY also support the RSA-KEM Key Transport algorithm, identified by id-rsa-kem-spki, which uses KeyTransRecipientInfo as specified in [RFC5990].¶
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 PKCS #1 v1.5, that is, using the rsaEncryption object identifier [RFC8017]. The fact that the recipient will accept the RSA-KEM algorithm 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 SMIMECapabilities Attribute as specified in Section 2.5.2 of [RFC8551] or the SMIMECapabilities certificate extension as specified in [RFC4262].¶
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-spki object identifier; see Appendix B. The use of the id-rsa-kem-spki object identifier allows certificates that were issued to be compatible with the RSA-KEM Key Transport algorithm to also be used with this specification. When the id-rsa-kem-spki object identifier appears in the SubjectPublicKeyInfo algorithm field of the certificate, the parameters field from AlgorithmIdentifierSHOULD be absent. That is, the AlgorithmIdentifierSHOULD be a SEQUENCE of one component, the id-rsa-kem-spki object identifier. With absent parameters, the KDF3 key derivation function [ANS-X9.44] with SHA-256 [SHS] are used to derive the shared secret.¶
When the AlgorithmIdentifier parameters are present, the GenericHybridParameters MUST be used. Within the kem element, the algorithm identifier MUST be set to id-kem-rsa, and RsaKemParameters MUST be included. As described in Section 2.4, 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 field 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-spki object identifier as discussed above, then the key usage extension MUST contain only the following value:¶
keyEncipherment¶
Other keyUsage extension values MUST NOT be present. That is, a public key intended to be employed only with the RSA-KEM algorithm MUST 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 attribute 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 attribute that announces support for the RSA-KEM algorithm.¶
The SMIMECapability SEQUENCE representing the RSA-KEM algorithm MUSTinclude the id-rsa-kem-spki object identifier in the capabilityID field; see Appendix B for the object identifier value and Appendix Cfor examples. When the id-rsa-kem-spki object identifier appears in the capabilityID field and the parameters are present, then the parameters field MUST use the GenericHybridParameters type.¶
The fields of the GenericHybridParameters type have the following meanings:¶
If the GenericHybridParameters are present, then the provided kem value MUSTbe 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.¶
3. Security Considerations
The RSA-KEM algorithm should be considered as a replacement for the key transport portion of 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. With PKCS #1 v1.5, the originator encrypts the key-encryption key directly with the recipient's RSA public key. With the RSA-KEM algorithm, the key-encryption key is encrypted separately.¶
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, 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]. For example, one way to achieve 128-bit security, the RSA key size would be at least 3072 bits, the key derivation function would be SHA-256, and the symmetric key-encryption algorithm would be AES Key Wrap with a 128-bit key.¶
Implementations MUST protect the RSA private key, the key-encryption key, the content-encryption key, message-authentication key, and the content-authenticated-encryption key. Disclosure of the RSA private key could result in the compromise of all messages protected with that key. Disclosure of the key-encryption key, the content-encryption key, or the content-authenticated-encryption key could result in compromise of the associated encrypted content. Disclosure of the key-encryption key, the message-authentication key, or the content-authenticated-encryption key could allow modification of the associated authenticated content.¶
Additional considerations related to key management may be found in[NISTSP800-57pt1r5].¶
The security of the RSA-KEM algorithm depends on a quality random number generator. For further discussion on random number generation, see [RFC4086].¶
The RSA-KEM algorithm does not use an explicit padding scheme. Instead, an encoded random value (z) between zero and the RSA modulus minus one (n-1) is directly encrypted with the recipient's RSA public key. The IntegerToString(z, nLen) encoding produces a string that is the full length of the RSA modulus. In addition, the random value is passed through a KDF to reduce possible harm from a poorly implemented random number source or a maliciously chosen random value (z). Implementations MUST NOTuse z directly for any purpose.¶
As long as a fresh random integer z is chosen as part of each invocation of the Encapsulate() function, the RSA-KEM algorithm does not degrade as the number of ciphertexts increases. Since RSA encryption provides a bijective map, a collision in the KDF is the only way that the RSA-KEM algorithm can produce more than one ciphertext that encapsulates the same shared secret.¶
The RSA-KEM algorithm provides a fixed-length ciphertext. The recipient MUSTcheck that the received byte string is the expected length and the length corresponds to an integer in the expected range prior to attempting decryption with their RSA private key as described in Steps 1 and 2 of Appendix A.2.¶
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. RSA public keys have often been employed for multiple purposes such as key transport and digital signature without any known bad interactions; however, 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 NOTalso 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.¶
It is acceptable to use the same RSA key pair for the RSA-KEM Key Transport algorithm as specified in [RFC5990] and this specification. This is acceptable because the operations involving the RSA public key and the RSA private key are identical in the two specifications.¶
Parties can gain assurance that implementations are correct through formal implementation validation, such as the NIST Cryptographic Module Validation Program (CMVP) [CMVP].¶
4. IANA Considerations
For the ASN.1 Module in Appendix B.2, IANA has assigned an object identifier (OID) for the module identifier. The OID for the module has been allocated in the "SMI Security for S/MIME Module Identifier" registry (1.2.840.113549.1.9.16.0), and the Description for the new OID has been set to "id-mod-cms-rsa-kem-2023".¶
IANA has updated the id-alg-rsa-kem entry in the "SMI Security for S/MIME Algorithms (1.2.840.113549.1.9.16.3)" repository to refer to this document. In addition, IANA has added the following note to the registry:¶
Value 14, "id-alg-rsa-kem," is also referred to as "id-rsa-kem-spki."¶
5. References
5.1. Normative References
[ANS-X9.44]
American National Standards Institute, "Public Key Cryptography for the Financial Services Industry -- Key Establishment Using Integer Factorization Cryptography", ANSI X9.44-2007 (R2017), 2007, <https://webstore.ansi.org/standards/ascx9/ansix9442007r2017>.
[ISO18033-2]
ISO/IEC, "Information technology -- Security techniques -- Encryption algorithms -- Part 2: Asymmetric ciphers", ISO/IEC 18033-2:2006, 2006, <https://www.iso.org/standard/37971.html>.
[RFC2119]
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
[RFC3394]
Schaad, J. and R. Housley, "Advanced Encryption Standard (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394, September 2002, <https://www.rfc-editor.org/info/rfc3394>.
[RFC5083]
Housley, R., "Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type", RFC 5083, DOI 10.17487/RFC5083, November 2007, <https://www.rfc-editor.org/info/rfc5083>.
[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, <https://www.rfc-editor.org/info/rfc5280>.
[RFC5652]
Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, RFC 5652, DOI 10.17487/RFC5652, September 2009, <https://www.rfc-editor.org/info/rfc5652>.
[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, <https://www.rfc-editor.org/info/rfc5911>.
[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, <https://www.rfc-editor.org/info/rfc5912>.
[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, <https://www.rfc-editor.org/info/rfc6268>.
[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, <https://www.rfc-editor.org/info/rfc8017>.
[RFC8174]
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
[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, <https://www.rfc-editor.org/info/rfc8551>.
[RFC9629]
Housley, R., Gray, J., and T. Okubo, "Using Key Encapsulation Mechanism (KEM) Algorithms in the Cryptographic Message Syntax (CMS)", RFC 9629, DOI 10.17487/RFC9629, August 2024, <https://www.rfc-editor.org/info/rfc9629>.
[SHS]
National Institute of Standards and Technology, "Secure Hash Standard", NIST FIPS PUB 180-4, DOI 10.6028/NIST.FIPS.180-4, July 2015, <https://doi.org/10.6028/NIST.FIPS.180-4>.
[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, <https://www.itu.int/rec/T-REC-X.680>.
[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, <https://www.itu.int/rec/T-REC-X.690>.
5.2. Informative References
[CMVP]
National Institute of Standards and Technology, "Cryptographic Module Validation Program", 2016, <https://csrc.nist.gov/projects/cryptographic-module-validation-program>.
[NISTSP800-57pt1r5]
Barker, E., "Recommendation for Key Management: Part 1 - General", NIST SP 800-57, Part 1, Revision 5, DOI 10.6028/nist.sp.800-57pt1r5, May 2020, <https://doi.org/10.6028/nist.sp.800-57pt1r5>.
[RFC4086]
Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 10.17487/RFC4086, June 2005, <https://www.rfc-editor.org/info/rfc4086>.
[RFC4262]
Santesson, S., "X.509 Certificate Extension for Secure/Multipurpose Internet Mail Extensions (S/MIME) Capabilities", RFC 4262, DOI 10.17487/RFC4262, December 2005, <https://www.rfc-editor.org/info/rfc4262>.
[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, <https://www.rfc-editor.org/info/rfc5990>.
[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, <https://www.rfc-editor.org/info/rfc6194>.
[SHOUP]
Shoup, V., "A Proposal for an ISO Standard for Public Key Encryption", Cryptology ePrint Archive Paper 2001/112, 2001, <https://eprint.iacr.org/2001/112>.
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.¶
With the RSA-KEM algorithm, an originator encrypts a random integer (z) with the recipient's RSA public key to produce a ciphertext (ct), and the originator derives a shared secret (SS) from the random integer (z). The originator then sends the ciphertext (ct) to the recipient. The recipient decrypts the ciphertext (ct) using their private key to recover the random integer (z), and the recipient derives a shared secret (SS) from the random integer (z). In this way, the originator and recipient obtain the same shared secret (SS).¶
The RSA-KEM algorithm depends on a key derivation function (KDF), which is used to derive the shared secret (SS). Many key derivation functions support the inclusion of other information in addition to the shared secret (SS) in the input to the function; however, no other information is included as an input to the KDF by the RSA-KEM algorithm.¶
A.1. Originator's Operations: RSA-KEM Encapsulate()
Let (n,e) be the recipient's RSA public key; see [RFC8017] for details.¶
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:¶
NOTE: The random integer z MUST be generated independently at random for different encryption operations, whether for the same or different recipients.¶
A.2. Recipient's Operations: RSA-KEM Decapsulate()
Let (n,d) be the recipient's RSA private key; see [RFC8017] for details, but other private key formats are allowed.¶
Let ct be the ciphertext received from the originator.¶
Let nLen denote the length in bytes of the modulus n.¶
The recipient performs the following operations:¶
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.¶
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-spki 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 [RFC9629]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].¶
KDF2 [ANS-X9.44] and KDF3 are both key derivation functions based on a hash function. The only difference between KDF2 and KDF3 is the order of the components to be hashed.¶
The object identifier for KDF3 is:¶
The KDF3 parameters identify the underlying hash function. For alignment with 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.¶
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:¶
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:¶
This SMIMECapability value has the following DER encoding (in hexadecimal):¶
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):¶
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):¶
Appendix D. RSA-KEM CMS Enveloped-Data Example
This example shows the establishment of an AES-128 content-encryption key using:¶
In real-world use, the originator would encrypt the content-encryption key in a manner that would allow decryption with their own private key as well as the recipient's private key. This is omitted in an attempt to simplify the example.¶
D.1. Originator RSA-KEM Encapsulate() Processing
Alice obtains Bob's public key:¶
Bob's RSA public key has the following key identifier:¶
Alice randomly generates integer z between 0 and n-1:¶
Alice encrypts integer z using the Bob's RSA public key. The result is called ct:¶
Alice derives the shared secret (SS) using KDF3 with SHA-256:¶
D.2. Originator CMS Processing
Alice encodes the CMSORIforKEMOtherInfo structure with the algorithm identifier for AES-128-KEYWRAP and a key length of 16 octets. The DER encoding of CMSORIforKEMOtherInfo produces 18 octets:¶
The CMSORIforKEMOtherInfo structure contains:¶
Alice derives the key-encryption key from shared secret produced by RSA-KEM Encapsulate() and the CMSORIforKEMOtherInfo structure with KDF3 and SHA-256. The KEK is:¶
Alice randomly generates a 128-bit content-encryption key:¶
Alice uses AES-128-KEYWRAP to encrypt the 128-bit content-encryption key with the derived key-encryption key:¶
Alice encrypts the padded content using AES-128-CBC with the content-encryption key. The 16-octet IV used is:¶
The padded content plaintext is:¶
The resulting ciphertext is:¶
Alice encodes the EnvelopedData (using KEMRecipientInfo) and ContentInfo, and then sends the result to Bob. The Base64-encoded result is:¶
This result decodes to:¶
D.3. Recipient RSA-KEM Decapsulate() Processing
Bob's private key:¶
Bob checks that the length of the ciphertext is less than nLen bytes.¶
Bob checks that the ciphertext is greater than zero and is less than his RSA modulus.¶
Bob decrypts the ciphertext with his RSA private key to obtain the integer z:¶
Bob checks that the integer z is greater than zero and is less than his RSA modulus.¶
Bob derives the shared secret (SS) using KDF3 with SHA-256:¶
D.4. Recipient CMS Processing
Bob encodes the CMSORIforKEMOtherInfo structure with the algorithm identifier for AES-128-KEYWRAP and a key length of 16 octets. The DER encoding of CMSORIforKEMOtherInfo is not repeated here.¶
Bob derives the key-encryption key from shared secret and the CMSORIforKEMOtherInfo structure with KDF3 and SHA-256, the KEK is:¶
Bob uses AES-KEY-WRAP to decrypt the content-encryption key with the key-encryption key. The content-encryption key is:¶
Bob decrypts the content using AES-128-CBC with the content- encryption key. The 16-octet IV used is:¶
The received ciphertext content is:¶
The resulting padded plaintext content is:¶
After stripping the AES-CBC padding, the plaintext content is:¶
Acknowledgements
We thank James Randall, Burt Kaliski, and John Brainard as the original authors of [RFC5990]; 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 [RFC5990].¶
We thank Blake Ramsdell, Jim Schaad, Magnus Nystrom, Bob Griffin, and John Linn for helping bring [RFC5990] to fruition.¶
We thank Burt Kaliski, Alex Railean, Joe Mandel, Mike Ounsworth, Peter Campbell, Daniel Van Geest, and David Ireland for careful review and thoughtful comments that greatly improved this document.¶
Authors' Addresses
Russ Housley
Vigil Security, LLC
516 Dranesville Road
Herndon, VA 20170
United States of America
Sean Turner
sn3rd