Request for Comments: 5990
Category: Standards Track
ISSN: 20701721
Randall Consulting
B. Kaliski
EMC
J. Brainard
RSA
S. Turner
IECA
September 2010
Use of the RSAKEM Key Transport Algorithm
in the Cryptographic Message Syntax (CMS)
Abstract

The RSAKEM Key Transport Algorithm is a onepass (storeandforward) mechanism for transporting keying data to a recipient using the recipient's RSA public key. ("KEM" stands for "key encapsulation mechanism".) This document specifies the conventions for using the RSAKEM Key Transport Algorithm with the Cryptographic Message Syntax (CMS). The ASN.1 syntax is aligned with an expected forthcoming change to American National Standard (ANS) X9.44.
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 5741.
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfceditor.org/info/rfc5990.
Copyright Notice

Copyright © 2010 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 (http://trustee.ietf.org/licenseinfo) 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 Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
Table of Contents

1. Introduction ....................................................3 1.1. Conventions Used in This Document ..........................4 2. Use in CMS ......................................................4 2.1. Underlying Components ......................................4 2.2. RecipientInfo Conventions ..................................5 2.3. Certificate Conventions ....................................5 2.4. SMIMECapabilities Attribute Conventions ....................6 3. Security Considerations .........................................7 4. IANA Considerations .............................................9 5. Acknowledgements ................................................9 6. References .....................................................10 6.1. Normative References ......................................10 6.2. Informative References ....................................11 Appendix A. RSAKEM Key Transport Algorithm ......................12 A.1. Underlying Components ....................................12 A.2. Sender's Operations ......................................12 A.3. Recipient's Operations ...................................13 Appendix B. ASN.1 Syntax .........................................15 B.1. RSAKEM Key Transport Algorithm ..........................16 B.2. Selected Underlying Components ...........................18 B.2.1. Key Derivation Functions ............................18 B.2.2. Symmetric KeyWrapping Schemes ......................19 B.3. ASN.1 Module .............................................20 B.4. Examples .................................................25
1. Introduction

The RSAKEM Key Transport Algorithm is a onepass (storeandforward) mechanism for transporting keying data to a recipient using the recipient's RSA public key.
Most previous key transport algorithms based on the RSA publickey cryptosystem (e.g., the popular PKCS #1 v1.5 algorithm [PKCS1]) have the following general form:
 Format or "pad" the keying data to obtain an integer m.
 Encrypt the integer m with the recipient's RSA public key:
c = m^e mod n
 Output c as the encrypted keying data.
The RSAKEM Key Transport Algorithm takes a different approach that provides higher security assurance, by encrypting a _random_ integer with the recipient's public key, and using a symmetric keywrapping scheme to encrypt the keying data. It has the following form:
 Generate a random integer z between 0 and n1.
 Encrypt the integer z with the recipient's RSA public key:
c = z^e mod n
 Derive a keyencrypting key KEK from the integer z.
 Wrap the keying data using KEK to obtain wrapped keying data WK.
 Output c and WK as the encrypted keying data.
This different approach provides higher security assurance because (a) the input to the underlying RSA operation is effectively a random integer between 0 and n1, where n is the RSA modulus, so it does not have any structure that could be exploited by an adversary, and (b) the input is independent of the keying data so the result of the RSA decryption operation is not directly available to an adversary. As a result, the algorithm enjoys a "tight" security proof in the random oracle model. (In other padding schemes, such as PKCS #1 v1.5, the input has structure and/or depends on the keying data, and the provable security assurances are not as strong.) The approach is also architecturally convenient because the publickey operations are separate from the symmetric operations on the keying data. Another benefit is that the length of the keying data is bounded only by the symmetric keywrapping scheme, not the size of the RSA modulus.
The RSAKEM Key Transport Algorithm in various forms is being adopted in several draft standards as well as in American National Standard (ANS) X9.44 [ANSX9.44]. It has also been recommended by the New European Schemes for Signatures, Integrity, and Encryption (NESSIE) project [NESSIE]. Originally, [ANSX9.44] specified a different object identifier to identify the RSAKEM Key Transport Algorithm. [ANSX9.44] used idacgenerichybrid, while this document uses idrsakem. These OIDs are used in the KeyTransportInfo field to indicate the key encryption algorithm, in certificates to allow recipients to restrict their public keys for use with RSAKEM only, and in SMIME Capability attributes to allow recipients to advertise their support for RSAKEM. Legacy implementations that wish to interoperate with [ANSX9.44] should consult that specification for more information on idacgenerichybrid.
For completeness, a specification of the algorithm is given in Appendix A of this document; ASN.1 syntax is given in Appendix B.

NOTE: The term "KEM" stands for "key encapsulation mechanism" and refers to the first three steps of the process above. The formalization of key transport algorithms (or more generally, asymmetric encryption schemes) in terms of key encapsulation mechanisms is described further in research by Victor Shoup leading to the development of the ISO/IEC 180332 standard [SHOUP].
1.1. Conventions Used in This Document

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [STDWORDS].
2. Use in CMS

The RSAKEM Key Transport Algorithm MAY be employed for one or more recipients in the CMS envelopeddata content type (Section 6 of [CMS]), where the keying data processed by the algorithm is the CMS contentencryption key.
2.1. Underlying Components

A CMS implementation that supports the RSAKEM Key Transport Algorithm MUST support at least the following underlying components:
o For the key derivation function, KDF3 (see [ANSX9.44]) based on SHA256 (see [FIPS1803]). KDF3 is an instantiation of the Concatenation Key Derivation Function defined in [NISTSP80056A]. o For the keywrapping scheme, AESWrap128, i.e., the AES Key Wrap with a 128bit keyencrypting key (see [AESWRAP]).
An implementation SHOULD also support KDF2 (see [ANSX9.44]) based on SHA1 (this function is also specified as the key derivation function in [ANSX9.63]). The Camellia key wrap algorithm (see [CAMELLIA]) SHOULD be supported if Camellia is supported as a contentencryption cipher. The TripleDES Key Wrap (see [3DESWRAP]) SHOULD also be supported if TripleDES is supported as a contentencryption cipher.
It MAY support other underlying components. When AES or Camellia is used, the data block size is 128 bits and the key size can be 128, 192, or 256 bits, while TripleDES requires a data block size of 64 bits and a key size of 112 or 168 bits.
2.2. RecipientInfo Conventions

When the RSAKEM Key Transport Algorithm is employed for a recipient, the RecipientInfo alternative for that recipient MUST be KeyTransRecipientInfo. The algorithmspecific fields of the KeyTransRecipientInfo value MUST have the following values:
o keyEncryptionAlgorithm.algorithm MUST be idrsakem (see Appendix B);
 keyEncryptionAlgorithm.parameters MUST be a value of type GenericHybridParameters, identifying the RSAKEM key encapsulation mechanism (see Appendix B);
 encryptedKey MUST be the encrypted keying data output by the algorithm, where the keying data is the contentencryption key (see Appendix A).
2.3. Certificate Conventions

The conventions specified in this section augment RFC 5280 [PROFILE].
A recipient who employs the RSAKEM Key Transport Algorithm MAY identify the public key in a certificate by the same AlgorithmIdentifier as for the PKCS #1 v1.5 algorithm, i.e., using the rsaEncryption object identifier [PKCS1]. The fact that the user will accept RSAKEM with this public key is not indicated by the use of this identifier. This 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 RSAKEM Key Transport Algorithm with a given public key, the recipient MUST identify the public key in the certificate using the idrsakem object identifier (see Appendix B). When the idrsakem algorithm identifier appears in the SubjectPublicKeyInfo algorithm field, the encoding SHALL omit the parameters field from AlgorithmIdentifier. That is, the AlgorithmIdentifier SHALL be a SEQUENCE of one component, the object identifier idrsakem.
Regardless of the AlgorithmIdentifier used, the RSA public key is encoded in the same manner in the subject public key information. The RSA public key MUST be encoded using the type RSAPublicKey type:
RSAPublicKey ::= SEQUENCE { modulus INTEGER,  n publicExponent INTEGER  e }
Here, the modulus is the modulus n, and publicExponent is the public exponent e. The Distinguished Encoding Rules (DER)encoded RSAPublicKey is carried in the subjectPublicKey BIT STRING within the subject public key information.
The intended application for the key MAY be indicated in the key usage certificate extension (see [PROFILE], Section 4.2.1.3). If the keyUsage extension is present in a certificate that conveys an RSA public key with the idrsakem object identifier as discussed above, then the key usage extension MUST contain the following value:
keyEncipherment
dataEncipherment SHOULD NOT be present. That is, a key intended to be employed only with the RSAKEM Key Transport Algorithm SHOULD NOT also be employed for data encryption or for authentication such as in 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

RFC 3851 [MSG], Section 2.5.2 defines the SMIMECapabilities signed attribute (defined as a SEQUENCE of SMIMECapability SEQUENCEs) to be used to specify a partial list of algorithms that the software announcing the SMIMECapabilities can support. When constructing a signedData object, compliant software MAY include the SMIMECapabilities signed attribute announcing that it supports the RSAKEM Key Transport Algorithm.
The SMIMECapability SEQUENCE representing the RSAKEM Key Transport Algorithm MUST include the idrsakem object identifier (see Appendix B) in the capabilityID field and MUST include a GenericHybridParameters value in the parameters field identifying the components with which the algorithm is to be employed.
The DER encoding of a SMIMECapability SEQUENCE is the same as the DER encoding of an AlgorithmIdentifier. Example DER encodings for typical sets of components are given in Appendix B.4.
3. Security Considerations

The RSAKEM Key Transport Algorithm should be considered for new CMS based applications as a replacement for the widely implemented RSA encryption algorithm specified originally in PKCS #1 v1.5 (see [PKCS1] and Section 4.2.1 of [CMSALGS]), which is vulnerable to chosenciphertext attacks. The RSA Encryption Scheme  Optimal Asymmetric Encryption Padding (RSAESOAEP) Key Transport Algorithm has also been proposed as a replacement (see [PKCS1] and [CMSOAEP]). RSAKEM has the advantage over RSAESOAEP of a tighter security proof, but the disadvantage of slightly longer encrypted keying data.
The security of the RSAKEM Key Transport Algorithm described in this document can be shown to be tightly related to the difficulty of either solving the RSA problem or breaking the underlying symmetric keywrapping scheme, if the underlying key derivation function is modeled as a random oracle, and assuming that the symmetric key wrapping scheme satisfies the properties of a data encapsulation mechanism [SHOUP]. While in practice a randomoracle 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 should be selected consistent with the desired symmetric security level for an application. Several security levels have been identified in the NIST FIPS PUB 80057 [NISTGUIDELINE]. For brevity, the first three levels are mentioned here:
 80bit security. The RSA key size SHOULD be at least 1024 bits, the hash function underlying the KDF SHOULD be SHA1 or above, and the symmetric keywrapping scheme SHOULD be AES Key Wrap, Triple DES Key Wrap, or Camellia Key Wrap.
 112bit security. The RSA key size SHOULD be at least 2048 bits, the hash function underlying the KDF SHOULD be SHA224 or above, and the symmetric keywrapping scheme SHOULD be AES Key Wrap, TripleDES Key Wrap, or Camellia Key Wrap.
 128bit security. The RSA key size SHOULD be at least 3072 bits, the hash function underlying the KDF SHOULD be SHA256 or above, and the symmetric keywrapping scheme SHOULD be AES Key Wrap or Camellia Key Wrap.
Note that the AES Key Wrap or Camellia Key Wrap MAY be used at all three of these levels; the use of AES or Camellia does not require a 128bit security level for other components.
Implementations MUST protect the RSA private key and the content encryption key. Compromise of the RSA private key may result in the disclosure of all messages protected with that key. Compromise of the contentencryption key may result in disclosure of the associated encrypted content.
Additional considerations related to key management may be found in [NISTGUIDELINE].
The security of the 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, please see [RANDOM].
Implementations SHOULD NOT reveal information about intermediate values or calculations, whether by timing or other "side channels", or 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.
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 RSAKEM Key Transport Algorithm SHOULD NOT also be used for digital signatures. (Indeed, the Accredited Standards Committee X9 (ASC X9) requires such a separation between key establishment key pairs and digital signature key pairs.) Continuing this principle of key separation, a key pair used for the RSAKEM Key Transport 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 formalize the assurance that one another's implementations are correct through implementation validation, e.g., NIST's Cryptographic Module Validation Program (CMVP).
4. IANA Considerations

Within the CMS, algorithms are identified by object identifiers (OIDs). With one exception, all of the OIDs used in this document were assigned in other IETF documents, in ISO/IEC standards documents, by the National Institute of Standards and Technology (NIST), and in PublicKey Cryptography Standards (PKCS) documents. The two exceptions are the ASN.1 module's identifier (see Appendix B.3) and idrsakem that are both assigned in this document. The module object identifiers are defined in an arc delegated by the former company RSA Data Security Inc. to the S/MIME Working Group. When the S/MIME Working Group closes, this arc and its registration procedures will be transferred to IANA.
5. Acknowledgements

This document is one part of a strategy to align algorithm standards produced by ASC X9, ISO/IEC JTC1 SC27, NIST, and the IETF. We would like to thank the members of the ASC X9F1 working group for their contributions to drafts of ANS X9.44, which led to this specification.
Our thanks to Russ Housley as well for his guidance and encouragement. We also appreciate the helpful direction we've received from Blake Ramsdell and Jim Schaad in bringing this document to fruition. A special thanks to Magnus Nystrom for his assistance on Appendix B. Thanks also to Bob Griffin and John Linn for both editorial direction and procedural guidance.
6. References
6.1. Normative References

[3DESWRAP] Housley, R., "TripleDES and RC2 Key Wrapping", RFC 3217, December 2001. [AESWRAP] Schaad, J. and R. Housley, "Advanced Encryption Standard (AES) Key Wrap Algorithm", RFC 3394, September 2002. [ANSX9.44] ASC X9F1 Working Group. American National Standard X9.44: Public Key Cryptography for the Financial Services Industry  Key Establishment Using Integer Factorization Cryptography. 2007. [ANSX9.63] American National Standard X9.632002: Public Key Cryptography for the Financial Services Industry: Key Agreement and Key Transport Using Elliptic Curve Cryptography. [CAMELLIA] Moriai, S. and A. Kato, "Use of the Camellia Encryption Algorithm in Cryptographic Message Syntax (CMS)", RFC 3657, January 2004. [CMS] Housley, R., "Cryptographic Message Syntax (CMS)", RFC 5652, September 2009. [CMSALGS] Housley, R., "Cryptographic Message Syntax (CMS) Algorithms", RFC 3370, August 2002. [FIPS1803] National Institute of Standards and Technology (NIST). FIPS 1803: Secure Hash Standard. October 2008. [MSG] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 3.2 Message Specification", RFC 5751, January 2010. [PROFILE] 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, May 2008. [STDWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
6.2. Informative References

[AESWRAPPAD] Housley, R. and M. Dworkin, "Advanced Encryption Standard (AES) Key Wrap with Padding Algorithm", RFC 5649, September 2009. [CMSOAEP] Housley, R., "Use of the RSAESOAEP Key Transport Algorithm in Cryptographic Message Syntax (CMS)", RFC 3560, July 2003. [NESSIE] NESSIE Consortium. Portfolio of Recommended Cryptographic Primitives. February 2003. http://www.cryptonessie.org/. [NISTGUIDELINE] National Institute of Standards and Technology. Special Publication 80057: Recommendation for Key Management  Part 1: General (Revised). March 2007. http://csrc.nist.gov/publications/index.html. [NISTSP80056A] National Institute of Standards and Technology. Special Publication 80056A: Recommendation for PairWise Key Establishment Schemes Using Discrete Logarithm Cryptography (Revised). March 2007. http://csrc.nist.gov/publications/index.html. [PKCS1] Jonsson, J. and B. Kaliski, "PublicKey Cryptography Standards (PKCS) #1: RSA Cryptography Specifications Version 2.1", RFC 3447, February 2003. [RANDOM] Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, June 2005. [SHOUP] Shoup, V. A Proposal for an ISO Standard for Public Key Encryption. Version 2.1, December 20, 2001. http://eprint.iacr.org/2001/112.
Appendix A. RSAKEM Key Transport Algorithm

The RSAKEM Key Transport Algorithm is a onepass (storeandforward) mechanism for transporting keying data to a recipient using the recipient's RSA public key.
With this type of algorithm, a sender encrypts the keying data using the recipient's public key to obtain encrypted keying data. The recipient decrypts the encrypted keying data using the recipient's private key to recover the keying data.
A.1. Underlying Components

The algorithm has the following underlying components:
 KDF, a key derivation function, which derives keying data of a specified length from a shared secret value;
 Wrap, a symmetric keywrapping scheme, which encrypts keying Data using a keyencrypting key.
In the following, kekLen denotes the length in bytes of the key encrypting key for the underlying symmetric keywrapping scheme.
In this scheme, the length of the keying data to be transported MUST be among the lengths supported by the underlying symmetric key wrapping scheme. (Both the AES and Camellia Key Wraps, for instance, require the length of the keying data to be a multiple of 8 bytes, and at least 16 bytes.) Usage and formatting of the keying data (e.g., parity adjustment for TripleDES keys) is outside the scope of this algorithm. With some key derivation functions, it is possible to include other information besides the shared secret value in the input to the function. Also, with some symmetric keywrapping schemes, it is possible to associate a label with the keying data. Such uses are outside the scope of this document, as they are not directly supported by CMS.
A.2. Sender's Operations

Let (n,e) be the recipient's RSA public key (see [PKCS1] for details), and let K be the keying data to be transported.
Let nLen denote the length in bytes of the modulus n, i.e., the least integer such that 2^{8*nLen} > n.
The sender performs the following operations:
 Generate a random integer z between 0 and n1 (see note), and convert z to a byte string Z of length nLen, most significant byte first:
z = RandomInteger (0, n1) Z = IntegerToString (z, nLen)
 Encrypt the random integer z using the recipient's 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)
 Derive a keyencrypting key KEK of length kekLen bytes from the byte string Z using the underlying key derivation function:
KEK = KDF (Z, kekLen)
 Wrap the keying data K with the keyencrypting key KEK using the underlying keywrapping scheme to obtain wrapped keying data WK:
WK = Wrap (KEK, K)
 Concatenate the ciphertext C and the wrapped keying data WK to obtain the encrypted keying data EK:
EK = C  WK
 Output the encrypted keying data EK.
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 [PKCS1]; other private key formats are allowed), and let EK be the encrypted keying data.
Let nLen denote the length in bytes of the modulus n.
The recipient performs the following operations:
 Separate the encrypted keying data EK into a ciphertext C of length nLen bytes and wrapped keying data WK:
C  WK = EK

If the length of the encrypted keying data is less than nLen bytes, output "decryption error", and stop.
 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):


c = StringToInteger (C)

z = c^d mod n

If the integer c is not between 0 and n1, output "decryption error", and stop.
 Convert the integer z to a byte string Z of length nLen, most significant byte first (see note):
Z = IntegerToString (z, nLen)
 Derive a keyencrypting key KEK of length kekLen bytes from the byte string Z using the underlying key derivation function (see note):
KEK = KDF (Z, kekLen)
 Unwrap the wrapped keying data WK with the keyencrypting key KEK using the underlying keywrapping scheme to recover the keying data K:
K = Unwrap (KEK, WK)

If the unwrapping operation outputs an error, output "decryption error", and stop.
 Output the keying data K.
NOTE: Implementations SHOULD NOT reveal information about the integer z and the string Z, nor 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 RSAKEM Key Transport Algorithm is an extension of the syntax for the "generic hybrid cipher" in ANS X9.44 [ANSX9.44]. The syntax for the scheme is given in Appendix B.1. The syntax for selected underlying components including those mentioned above is given in Appendix B.2.
The following object identifier prefixes are used in the definitions below:
is180332 OID ::= { iso(1) standard(0) is18033(18033) part2(2) } nistAlgorithm OID ::= { jointisoitut(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) } pkcs1 OID ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs1(1) } x944 OID ::= { iso(1) identifiedorganization(3) tc68(133) country(16) x9(840) x9Standards(9) x944(44) } x944components OID ::= { x944 components(1) }
NullParms is a more descriptive synonym for NULL when an algorithm identifier has null parameters:
NullParms ::= NULL
The material in this Appendix is based on ANS X9.44.
B.1. RSAKEM Key Transport Algorithm

The object identifier for the RSAKEM Key Transport Algorithm is idrsakem, which is defined in this document as:
idrsakem OID ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) alg(3) 14 }
When idrsakem is used in an AlgorithmIdentifier, the parameters MUST employ the GenericHybridParameters syntax. The parameters MUST be absent when used in the SubjectPublicKeyInfo field. The syntax for GenericHybridParameters is as follows:
GenericHybridParameters ::= { kem KeyEncapsulationMechanism, dem DataEncapsulationMechanism }
The fields of type GenericHybridParameters have the following meanings:

 kem identifies the underlying key encapsulation mechanism, which in this case is also denoted as RSAKEM.

The object identifier for RSAKEM (as a key encapsulation mechanism) is idkemrsa as:
idkemrsa OID ::= { is180332 keyencapsulationmechanism(2) rsa(4) }


The associated parameters for idkemrsa have type RsaKemParameters:

RsaKemParameters ::= { keyDerivationFunction KeyDerivationFunction, keyLength KeyLength }


The fields of type RsaKemParameters have the following meanings:
 keyDerivationFunction identifies the underlying key derivation function. For alignment with ANS X9.44, it MUST be KDF2 or KDF3. However, other key derivation functions MAY be used with CMS. Please see Appendix B.2.1 for the syntax for KDF2 and KDF3.


KeyDerivationFunction ::=



AlgorithmIdentifier {{KDFAlgorithms}}

KDFAlgorithms ALGORITHM ::= { kdf2  kdf3, ...  implementations may define other methods }

 keyLength is the length in bytes of the keyencrypting key, which depends on the underlying symmetric keywrapping scheme.
KeyLength ::= INTEGER (1..MAX)

 dem identifies the underlying data encapsulation mechanism. For alignment with ANS X9.44, it MUST be an X9approved symmetric keywrapping scheme. However, other symmetric key wrapping schemes MAY be used with CMS. Please see Appendix B.2.2 for the syntax for the AES, TripleDES, and Camellia Key Wraps.

DataEncapsulationMechanism ::=

AlgorithmIdentifier {{DEMAlgorithms}}

DEMAlgorithms ALGORITHM ::= { X9SymmetricKeyWrappingSchemes, CamelliaKeyWrappingSchemes, ...  implementations may define other methods } X9SymmetricKeyWrappingSchemes ALGORITHM ::= { aes128Wrap  aes192Wrap  aes256Wrap  tdesWrap, ...  allows for future expansion } CamelliaKeyWrappingSchemes ALGORITHM ::= { Camellia128Wrap  Camellia192Wrap  Camellia256Wrap }
B.2. Selected Underlying Components
B.2.1. Key Derivation Functions

The object identifier for KDF2 (see [ANSX9.44]) is:
idkdfkdf2 OID ::= { x944components kdf2(1) }
The associated parameters identify the underlying hash function. For alignment with ANS X9.44, the hash function MUST be an ASC X9approved hash function. However, other hash functions MAY be used with CMS.
kdf2 ALGORITHM ::= { OID idkdfkdf2 PARMS KDF2HashFunction } KDF2HashFunction ::= AlgorithmIdentifier {{KDF2HashFunctions}} KDF2HashFunctions ALGORITHM ::= { X9HashFunctions, ...  implementations may define other methods } X9HashFunctions ALGORITHM ::= { sha1  sha224  sha256  sha384  sha512, ...  allows for future expansion }
The object identifier for SHA1 is:
idsha1 OID ::= { iso(1) identifiedorganization(3) oiw(14) secsig(3) algorithms(2) sha1(26) } The object identifiers for SHA224, SHA256, SHA384, and SHA512 are idsha224 OID ::= { nistAlgorithm hashAlgs(2) sha224(4) } idsha256 OID ::= { nistAlgorithm hashAlgs(2) sha256(1) } idsha384 OID ::= { nistAlgorithm hashAlgs(2) sha384(2) } idsha512 OID ::= { nistAlgorithm hashAlgs(2) sha512(3) }
There has been some confusion over whether the various SHA object identifiers have a NULL parameter, or no associated parameters. As also discussed in [PKCS1], implementations SHOULD generate algorithm identifiers without parameters and MUST accept algorithm identifiers either without parameters, or with NULL parameters.
sha1 ALGORITHM ::= { OID idsha1 }  NULLParms MUST be sha224 ALGORITHM ::= { OID idsha224 }  accepted for these sha256 ALGORITHM ::= { OID idsha256 }  OIDs sha384 ALGORITHM ::= { OID idsha384 }  "" sha512 ALGORITHM ::= { OID idsha512 }  ""
The object identifier for KDF3 (see [ANSX9.44]) is:
idkdfkdf3 OID ::= { x944components kdf3(2) }
The associated parameters identify the underlying hash function. For alignment with the draft ANS X9.44, the hash function MUST be an ASC X9approved hash function. However, other hash functions MAY be used with CMS.
kdf3 ALGORITHM ::= { OID idkdfkdf3 PARMS KDF3HashFunction } KDF3HashFunction ::= AlgorithmIdentifier { KDF3HashFunctions } KDF3HashFunctions ALGORITHM ::= { X9HashFunctions, ...  implementations may define other methods }
B.2.2. Symmetric KeyWrapping Schemes

The object identifiers for the AES Key Wrap depend on the size of the keyencrypting key. There are three object identifiers (see [AESWRAP]):
idaes128Wrap OID ::= { nistAlgorithm aes(1) aes128Wrap(5) } idaes192Wrap OID ::= { nistAlgorithm aes(1) aes192Wrap(25) } idaes256Wrap OID ::= { nistAlgorithm aes(1) aes256Wrap(45) }
These object identifiers have no associated parameters.
aes128Wrap ALGORITHM ::= { OID idaes128Wrap } aes192Wrap ALGORITHM ::= { OID idaes192Wrap } aes256Wrap ALGORITHM ::= { OID idaes256Wrap }
The object identifier for the TripleDES Key Wrap (see [3DESWRAP]) is:
idalgCMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) alg(3) 6 }
This object identifier has a NULL parameter.

tdesWrap ALGORITHM ::=
{ OID idalgCMS3DESwrap PARMS NullParms }
NOTE: ASC X9 has not yet incorporated AES Key Wrap with Padding [AESWRAPPAD] into ANS X9.44. When ASC X9.44 adds AES Key Wrap with Padding, this document will also be updated.
The object identifiers for the Camellia Key Wrap depend on the size of the keyencrypting key. There are three object identifiers:
idcamellia128Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia128wrap(2) } idcamellia192Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia192wrap(3) } idcamellia256Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia256wrap(4) }
These object identifiers have no associated parameters.
camellia128Wrap ALGORITHM ::= { OID idcamellia128Wrap } camellia192Wrap ALGORITHM ::= { OID idcamellia192Wrap } camellia256Wrap ALGORITHM ::= { OID idcamellia256Wrap }

B.3. ASN.1 Module

CMSRSAKEM
{ iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) modules(0) cmsrsakem(21) } DEFINITIONS ::= BEGIN  EXPORTS ALL  IMPORTS None  Useful types and definitions OID ::= OBJECT IDENTIFIER  alias
 Unless otherwise stated, if an object identifier has associated  parameters (i.e., the PARMS element is specified), the  parameters field shall be included in algorithm identifier  values. The parameters field shall be omitted if and only if  the object identifier does not have associated parameters  (i.e., the PARMS element is omitted), unless otherwise stated.
ALGORITHM ::= CLASS { &id OBJECT IDENTIFIER UNIQUE, &Type OPTIONAL } WITH SYNTAX { OID &id [PARMS &Type] } AlgorithmIdentifier { ALGORITHM:IOSet } ::= SEQUENCE { algorithm ALGORITHM.&id( {IOSet} ), parameters ALGORITHM.&Type( {IOSet}{@algorithm} ) OPTIONAL } NullParms ::= NULL  ISO/IEC 180332 arc is180332 OID ::= { iso(1) standard(0) is18033(18033) part2(2) }
 NIST algorithm arc
nistAlgorithm OID ::= { jointisoitut(2) country(16) us(840) organization(1) gov(101) csor(3) nistAlgorithm(4) }
 PKCS #1 arc
pkcs1 OID ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs1(1) }  RSAKEM Key Transport Algorithm idrsakem OID ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) alg(3) 14 } GenericHybridParameters ::= SEQUENCE { kem KeyEncapsulationMechanism, dem DataEncapsulationMechanism } KeyEncapsulationMechanism ::= AlgorithmIdentifier {{KEMAlgorithms}} KEMAlgorithms ALGORITHM ::= { kemrsa, ... } kemrsa ALGORITHM ::= { OID idkemrsa PARMS RsaKemParameters } idkemrsa OID ::= { is180332 keyencapsulationmechanism(2) rsa(4) } RsaKemParameters ::= SEQUENCE { keyDerivationFunction KeyDerivationFunction, keyLength KeyLength } KeyDerivationFunction ::= AlgorithmIdentifier {{KDFAlgorithms}} KDFAlgorithms ALGORITHM ::= { kdf2  kdf3, ...  implementations may define other methods } KeyLength ::= INTEGER (1..MAX) DataEncapsulationMechanism ::= AlgorithmIdentifier {{DEMAlgorithms}} DEMAlgorithms ALGORITHM ::= { X9SymmetricKeyWrappingSchemes  CamelliaKeyWrappingSchemes, ...  implementations may define other methods } X9SymmetricKeyWrappingSchemes ALGORITHM ::= { aes128Wrap  aes192Wrap  aes256Wrap  tdesWrap, ...  allows for future expansion }
X9SymmetricKeyWrappingScheme ::=
AlgorithmIdentifier {{ X9SymmetricKeyWrappingSchemes }} CamelliaKeyWrappingSchemes ALGORITHM ::= { camellia128Wrap  camellia192Wrap  camellia256Wrap, ...  allows for future expansion }
CamelliaKeyWrappingScheme ::=
AlgorithmIdentifier {{ CamelliaKeyWrappingSchemes }}
 Key Derivation Functions
idkdfkdf2 OID ::= { x944components kdf2(1) }  Base arc x944 OID ::= { iso(1) identifiedorganization(3) tc68(133) country(16) x9(840) x9Standards(9) x944(44) } x944components OID ::= { x944 components(1) } kdf2 ALGORITHM ::= { OID idkdfkdf2 PARMS KDF2HashFunction } KDF2HashFunction ::= AlgorithmIdentifier {{ KDF2HashFunctions }} KDF2HashFunctions ALGORITHM ::= { X9HashFunctions, ...  implementations may define other methods } idkdfkdf3 OID ::= { x944components kdf3(2) } kdf3 ALGORITHM ::= { OID idkdfkdf3 PARMS KDF3HashFunction } KDF3HashFunction ::= AlgorithmIdentifier {{ KDF3HashFunctions }} KDF3HashFunctions ALGORITHM ::= { X9HashFunctions, ...  implementations may define other methods }  Hash Functions X9HashFunctions ALGORITHM ::= { sha1  sha224  sha256  sha384  sha512, ...  allows for future expansion } idsha1 OID ::= { iso(1) identifiedorganization(3) oiw(14) secsig(3) algorithms(2) sha1(26) } idsha224 OID ::= { nistAlgorithm hashAlgs(2) sha224(4) } idsha256 OID ::= { nistAlgorithm hashAlgs(2) sha256(1) } idsha384 OID ::= { nistAlgorithm hashAlgs(2) sha384(2) } idsha512 OID ::= { nistAlgorithm hashAlgs(2) sha512(3) } sha1 ALGORITHM ::= { OID idsha1 }  NullParms MUST be sha224 ALGORITHM ::= { OID idsha224 }  accepted for these sha256 ALGORITHM ::= { OID idsha256 }  OIDs sha384 ALGORITHM ::= { OID idsha384 }  "" sha512 ALGORITHM ::= { OID idsha512 }  ""
 Symmetric KeyWrapping Schemes
idaes128Wrap OID ::= { nistAlgorithm aes(1) aes128Wrap(5) } idaes192Wrap OID ::= { nistAlgorithm aes(1) aes192Wrap(25) } idaes256Wrap OID ::= { nistAlgorithm aes(1) aes256Wrap(45) } aes128Wrap ALGORITHM ::= { OID idaes128Wrap } aes192Wrap ALGORITHM ::= { OID idaes192Wrap } aes256Wrap ALGORITHM ::= { OID idaes256Wrap } idalgCMS3DESwrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) smime(16) alg(3) 6 } tdesWrap ALGORITHM ::= { OID idalgCMS3DESwrap PARMS NullParms } idcamellia128Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia128wrap(2) } idcamellia192Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia192wrap(3) } idcamellia256Wrap OBJECT IDENTIFIER ::= { iso(1) memberbody(2) 392 200011 61 security(1) algorithm(1) keywrapalgorithm(3) camellia256wrap(4) } camellia128Wrap ALGORITHM ::= { OID idcamellia128Wrap } camellia192Wrap ALGORITHM ::= { OID idcamellia192Wrap } camellia256Wrap ALGORITHM ::= { OID idcamellia256Wrap } END
B.4. Examples

As an example, if the key derivation function is KDF3 based on SHA256 and the symmetric keywrapping scheme is the AES Key Wrap with a 128bit KEK, the AlgorithmIdentifier for the RSAKEM Key Transport Algorithm will have the following value:
SEQUENCE { idrsakem,  RSAKEM cipher SEQUENCE {  GenericHybridParameters SEQUENCE {  key encapsulation mechanism idkemrsa,  RSAKEM SEQUENCE {  RsaKemParameters SEQUENCE {  key derivation function idkdfkdf3,  KDF3 SEQUENCE {  KDF3HashFunction idsha256  SHA256; no parameters (preferred) }, 16  KEK length in bytes }, SEQUENCE {  data encapsulation mechanism idaes128Wrap  AES128 Wrap; no parameters } } }
This AlgorithmIdentifier value has the following DER encoding:
30 47
06 0b 2a 86 48 86 f7 0d 01 09 10 03 0e  idrsakem 30 38 30 29 06 07 28 81 8c 71 02 02 04  idkemrsa 30 1e 30 19 06 0a 2b 81 05 10 86 48 09 2c 01 02  idkdfkdf3 30 0b 06 09 60 86 48 01 65 03 04 02 01  idsha256 02 01 10  16 bytes 30 0b 06 09 60 86 48 01 65 03 04 01 05  idaes128Wrap
The DER encodings for other typical sets of underlying components are as follows:
 KDF3 based on SHA384, AES Key Wrap with a 192bit KEK
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
 KDF3 based on SHA512, AES Key Wrap with a 256bit KEK
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 o KDF2 based on SHA1, TripleDES Key Wrap with a 128bit KEK (two key TripleDES) 30 45 06 0b 2a 86 48 86 f7 0d 01 09 10 03 0e 30 36 30 25 06 07 28 81 8c 71 02 02 04 30 1a 30 15 06 0a 2b 81 05 10 86 48 09 2c 01 01 30 07 06 05 2b 0e 03 02 1a 02 01 10 30 0d 06 0b 2a 86 48 86 f7 0d 01 09 10 03 06
Authors' Addresses

James Randall Randall Consulting 55 Sandpiper Drive Dover, NH 03820 USA
EMail:
jdrandall@comcast.net Burt Kaliski EMC 176 South Street Hopkinton, MA 01748 USA EMail: burt.kaliski@emc.com John Brainard RSA, The Security Division of EMC 174 Middlesex Turnpike Bedford, MA 01730 USA
EMail:
jbrainard@rsa.com Sean Turner IECA, Inc. 3057 Nutley Street, Suite 106 Fairfax, VA 22031 USA
EMail:
turners@ieca.com