S/MIME Working Group R. Housley Internet Draft SPYRUS expires in six months February 2000 CMS RSAES-OAEP Conventions Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF), its areas, and its working groups. Note that other groups may also distribute working documents as Internet-Drafts. 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." The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. To view the entire list of current Internet-Drafts, please check the "1id-abstracts.txt" listing contained in the Internet-Drafts Shadow Directories on ftp.is.co.za (Africa), ftp.nordu.net (Northern Europe), ftp.nis.garr.it (Southern Europe), munnari.oz.au (Pacific Rim), ftp.ietf.org (US East Coast), or ftp.isi.edu (US West Coast). Copyright Notice Copyright (C) The Internet Society (2000). All Rights Reserved. Abstract This document describes the use of the RSAES-OAEP key transport method of key management within the Cryptographic Message Syntax [CMS]. This draft is being discussed on the "ietf-smime" mailing list. To join the list, send a message to with the single word "subscribe" in the body of the message. Also, there is a Web site for the mailing list at . Housley [Page 1] INTERNET DRAFT February 2000 1 Introduction When the variant of the RSA algorithm specified in PKCS #1 Version 1.5 [PKCS#1v1.5] is used for key management, it is vulnerable to adaptive chosen ciphertext attacks. The use of PKCS #1 Version 1.5 key transport in interactive applications is especially vulnerable. Exploitation of this identified vulnerability, revealing the result of a particular RSA decryption, requires access to an oracle which will respond to hundreds of thousands of ciphertexts, which are constructed adaptively in response to previously-received replies providing information on the successes or failures of attempted decryption operations. As a result, the attack appears significantly less feasible in store-and-forward environments, such as S/MIME. When PKCS #1 Version 1.5 key transport is applied as an intermediate encryption layer within an interactive request-response communications environment, exploitation could be more feasible. An updated version of PKCS #1 has been published, PKCS #1 Version 2.0 [PKCS#1v2.0]. This new document supersedes RFC 2313. PKCS #1 Version 2.0 preserves support for the encryption padding format defined in PKCS #1 Version 1.5 [PKCS#1v1.5], and it also defines a new alternative. To resolve the adaptive chosen ciphertext vulnerability, the PKCS #1 Version 2.0 specifies and recommends use of Optimal Asymmetric Encryption Padding (OAEP) when RSA encryption is used to provide confidentiality. This document specifies the use of RSAES-OAEP key transport algorithm in the Cryptographic Message Syntax (CMS) [CMS]. CMS supports variety of architectures for certificate-based key management, particularly the one defined by the PKIX working group [PROFILE]. CMS values are generated using ASN.1 [X.208-88], using the Basic Encoding Rules (BER) [X.209-88] and the Distinguished Encoding Rules (DER) [X.509-88]. Throughout this document, when the terms MUST, MUST NOT, SHOULD and MAY are used in capital letters, their use conforms to the definitions in [MUSTSHOULD]. [MUSTSHOULD] defines these key words to help make the intent of standards track documents as clear as possible. The same key words are used in this document to help implementers achieve interoperability. Implementations that claims compliance with this document MUST provide the capabilities as indicated by the MUST, MUST NOT, SHOULD and MAY terms. Housley [Page 2] INTERNET DRAFT February 2000 2 Enveloped-data Conventions The CMS enveloped-data content type consists of encrypted content and wrapped content-encryption keys for one or more recipients. The RSAES- OAEP key transport algorithm is used to wrap the content-encryption key for one recipient. Compliant software MUST meet the requirements for constructing an enveloped-data content type stated in [CMS] Section 6, "Enveloped-data Content Type". [CMS] Section 6 should be studied before reading this section, because this section does not repeat the [CMS] text. A content-encryption key MUST be randomly generated for each instance of an enveloped-data content type. The content-encryption key is used to encipher the content. 2.1 EnvelopedData Fields The enveloped-data content type is ASN.1 encoded using the EnvelopedData syntax. The fields of the EnvelopedData syntax must be populated as follows: The EnvelopedData version MUST be either 0 or 2. The EnvelopedData originatorInfo field MUST be absent. The EnvelopedData recipientInfos CHOICE MUST be KeyTransRecipientInfo. See section 2.2 for further discussion of KeyTransRecipientInfo. The EnvelopedData encryptedContentInfo contentEncryptionAlgorithm field MUST be specify a symmetric encryption algorithm. Implementations MUST support the encryption of Triple-DES content- encryption keys, but implementations MAY support other algorithms as well. The EnvelopedData unprotectedAttrs MAY be present. 2.2 KeyTransRecipientInfo Fields The enveloped-data content type is ASN.1 encoded using the EnvelopedData syntax. The fields of the EnvelopedData syntax must be populated as follows: The KeyTransRecipientInfo version MUST be either 0 or 2. If the RecipientIdentifier is the CHOICE issuerAndSerialNumber, then the version MUST be 0. If the RecipientIdentifier is Housley [Page 3] INTERNET DRAFT February 2000 subjectKeyIdentifier, then the version MUST be 2. The KeyTransRecipientInfo RecipientIdentifier provides two alternatives for specifying the recipient's certificate, and thereby the recipient's public key. The recipient's certificate must contain a RSA public key. The content-encryption key is encrypted with the recipient's RSA public key. The issuerAndSerialNumber alternative identifies the recipient's certificate by the issuer's distinguished name and the certificate serial number; the subjectKeyIdentifier identifies the recipient's certificate by the X.509 subjectKeyIdentifier extension value. The KeyTransRecipientInfo keyEncryptionAlgorithm specifies that the RSAES-OAEP algorithm, and its associated parameters, was used to encrypt the content-encryption key for the recipient. The key- encryption process is described in [PKCS#1v2.0]. See section 3 of this document for the algorithm identifier and the parameter syntax. The KeyTransRecipientInfo encryptedKey is the result of encrypting the content-encryption key in the recipient's RSA public key using the RSAES-OAEP algorithm. When using a Triple-DES content-encryption key, implementations MUST adjust the parity bits for each DES key comprising the Triple-DES key prior to RSAES-OAEP encryption. 3 RSAES-OAEP Algorithm Identifiers and Parameters The RSAES-OAEP key transport algorithm is the RSA encryption scheme defined in RFC 2347 [PKCS#1v2.0], where the message to be encrypted is the content-encryption key. The algorithm identifier for RSAES- OAEP is: id-RSAES-OAEP OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 7 } The AlgorithmIdentifier parameters field must be present, and the parameters field must contain RSAES-OAEP-params. RSAES-OAEP-params have the following syntax: RSAES-OAEP-params ::= SEQUENCE { hashFunc [0] AlgorithmIdentifier DEFAULT sha1Identifier, maskGenFunc [1] AlgorithmIdentifier DEFAULT mgf1SHA1Identifier, pSourceFunc [2] AlgorithmIdentifier DEFAULT pSpecifiedEmptyIdentifier } sha1Identifier ::= AlgorithmIdentifier { id-sha1, NULL } mgf1SHA1Identifier ::= AlgorithmIdentifier { id-mgf1, sha1Identifier } Housley [Page 4] INTERNET DRAFT February 2000 pSpecifiedEmptyIdentifier ::= AlgorithmIdentifier { id-pSpecified, OCTET STRING SIZE (0) } id-sha1 OBJECT IDENTIFIER ::= { iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) 26 } id-mgf1 OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 8 } id-pSpecified OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) 9 } The fields of type RSAES-OAEP-params have the following meanings: hashFunc identifies the one-way hash function. Implementations MUST support SHA-1 [SHA1]. The SHA-1 algorithm identifier is comprised of the id-sha1 object identifier and a parameter of NULL. maskGenFunc identifies the mask generation function. Implementations MUST support MFG1 [PKCS#1v2.0]. MFG1 requires a one-way hash function, and it is identified in the parameter field of the algorithm identifier. Implementations MUST support SHA-1 [SHA1]. The MFG1 algorithm identifier is comprised of the id-mgf1 object identifier and a parameter of the SHA-1 algorithm identifier. Again, the SHA-1 algorithm identifier is comprised of the id-sha1 object identifier and a parameter of NULL. pSourceFunc identifies the source (and possibly the value) of the encoding parameters, commonly called P. Implementations MUST represent P by an algorithm identifier, id-pSpecified, indicating that P is explicitly provided as an OCTET STRING in the parameters. The default value for P is an empty string. In this case, pHash in EME-OAEP contains the hash of a zero length string. 4 SMIMECapabilities Attribute Conventions RFC 2633, Section 2.5.2 defines the SMIMECapabilities signed attribute (defined as a SEQUENCE of SMIMECapability SEQUNCEs) 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 RSAES-OAEP algorithm. The SMIMECapability SEQUENCE representing RSAES-OAEP MUST include the id-RSAES-OAEP object identifier in the capabilityID field and MUST include a RSAES-OAEP-Default-Identifier SEQUENCE in the parameters Housley [Page 5] INTERNET DRAFT February 2000 field. RSAES-OAEP-Default-Identifier ::= AlgorithmIdentifier { id-RSAES-OAEP, { sha1Identifier, mgf1SHA1Identifier, pSpecifiedEmptyIdentifier } } The SMIMECapability SEQUENCE representing RSAES-OAEP MUST be DER- encoded as follows: {{{TBD}}}. References CMS Housley, R. Cryptographic Message Syntax. RFC 2630. June 1999. MUSTSHOULD Bradner, S. Key Words for Use in RFCs to Indicate Requirement Levels. BCP 14, RFC 2119. March 1997. PKCS#1v1.5 Kaliski, B. PKCS #1: RSA Encryption, Version 1.5. RFC 2313. March 1998. PKCS#1v2.0 Kaliski, B. PKCS #1: RSA Encryption, Version 2.0. RFC 2347. October 1998. PROFILE Housley, R., W. Ford, W. Polk, and D. Solo. Internet X.509 Public Key Infrastructure: Certificate and CRL Profile. RFC 2459. January 1999. RANDOM Eastlake, D., S. Crocker, and J. Schiller. Randomness Recommendations for Security. RFC 1750. December 1994. SHA1 National Institute of Standards and Technology. FIPS Pub 180-1: Secure Hash Standard. 17 April 1995. X.208-88 CCITT. Recommendation X.208: Specification of Abstract Syntax Notation One (ASN.1). 1988. X.209-88 CCITT. Recommendation X.209: Specification of Basic Encoding Rules for Abstract Syntax Notation One (ASN.1). 1988. X.509-88 CCITT. Recommendation X.509: The Directory - Authentication Framework. 1988. Security Considerations 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 Housley [Page 6] INTERNET DRAFT February 2000 the content-encryption key may result in disclosure of the associated encrypted content. Implementations must protect the key management private key and the message-authentication key. Compromise of the key management private key permits masquerade of authenticated data. Compromise of the message-authentication key may result in undetectable modification of the authenticated content. The generation of RSA public/private key pairs relies on a random numbers. The use of inadequate pseudo-random number generators (PRNGs) to generate cryptographic keys can result in little or no security. An attacker may find it much easier to reproduce the PRNG environment that produced the keys, searching the resulting small set of possibilities, rather than brute force searching the whole key space. The generation of quality random numbers is difficult. RFC 1750 [RANDOM] offers important guidance in this area. Acknowledgments This document is the result of contributions from many professionals. I appreciate the hard work of all members of the IETF S/MIME Working Group. I wish to extend a special thanks to Burt Kaliski. Author Address Russell Housley SPYRUS 381 Elden Street Suite 1120 Herndon, VA 20170 USA housley@spyrus.com Full Copyright Statement Copyright (C) The Internet Society (2000). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. In addition, the ASN.1 module presented in Appendix A may be used in whole or in part Housley [Page 7] INTERNET DRAFT February 2000 without inclusion of the copyright notice. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process shall be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Housley [Page 8]