RFC 9709: Encryption Key Derivation in the Cryptographic Message Syntax (CMS) Using HKDF with SHA-256
- R. Housley
Abstract
This document specifies the derivation of the content
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 at
https://
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://
1. Introduction
This document specifies the derivation of the content
The use of this mechanism provides protection against an attacker that manipulates the
content
With highly structured messages, one block can reveal the only sensitive part of the original message.¶
This attack is thwarted if the encryption key depends upon the delivery of the unmodified algorithm identifier.¶
The mitigation for this attack has three parts:¶
1.1. ASN.1
CMS values are generated using ASN.1 [X680], using the Basic Encoding Rules (BER) and the Distinguished Encoding Rules (DER) [X690].¶
1.2. Terminology
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.3. Cryptographic Algorithm Agility Considerations
There is no provision for key derivation functions other than HKDF, and there is no provision for hash functions other than SHA-256. If there is ever a need to support another key derivation function or another hash function, it will be very straightforward to assign a new object identifier. At this point, keeping the design very simple seems most important.¶
2. Use of HKDF with SHA-256 to Derive Encryption Keys
The mitigation uses the HMAC-based Extract
The CMS
- Inputs:
- Output:
-
- OKM
- output keying material (same size as IKM)¶
The output OKM is calculated as follows:¶
3. The id-alg-cek-hkdf-sha256 Algorithm Identifier
The id
The following object identifier identifies the id
The id
Using the conventions from [RFC5911], the id
4. SMIMECapabilities Attribute Conventions
The SMIMECapabiliti
If an S/MIME client supports the mechanism in this document, the
id
The encoding for id
5. Use of HKDF with SHA-256 with CMS
This section describes the originator and recipient processing to implement this mitigation for each of the CMS encrypting content types.¶
5.1. Enveloped-Data Content Type
The fourth step of constructing an enveloped-data content type is repeated below from Section 6 of [RFC5652]:¶
To implement this mitigation, the originator expands this step as follows:¶
The presence of the id
5.2. Encrypted-Data Content Type
As specified in Section 8 of [RFC5652], the content
To implement this mitigation, the originator performs the following:¶
The presence of the id
5.3. Authenticated-Enveloped-Data Content Type
The fifth step of constructing an authenticated
To implement this mitigation, the originator expands this step as follows:¶
The presence of the id
6. Security Considerations
This mitigation always uses HKDF with SHA-256. One KDF algorithm was selected to avoid the need for negotiation. In the future, if a weakness is found in the KDF algorithm, a new attribute will need to be assigned for use with an alternative KDF algorithm.¶
If the attacker removes the id
If the attacker changes content
Implementations MUST protect the content
Implementations MUST randomly generate content
7. Privacy Considerations
If the message-digest attribute is included in the AuthAttributes, then the attribute value will contain the unencrypted one-way hash value of the plaintext of the content. Disclosure of this hash value enables content tracking, and it can be used to determine if the content matches one or more candidates. For these reasons, the AuthAttributes SHOULD NOT contain the message-digest attribute.¶
8. Operational Considerations
CMS is often used to provide encryption in messaging environments, where various forms of unsolicited messages (such as spam and phishing) represent a significant volume of unwanted traffic. Mitigation strategies for unwanted message traffic involve analysis of plaintext message content. When recipients accept unsolicited encrypted messages, they become even more vulnerable to unwanted traffic since many mitigation strategies will be unable to access the plaintext message content. Therefore, software that receives messages that have been encrypted using CMS ought to provide alternate mechanisms to handle the unwanted message traffic. One approach that does not require disclosure of keying material to a server is to reject or discard encrypted messages unless they purport to come from a member of a previously approved originator list.¶
9. IANA Considerations
For the ASN.1 module in Appendix A of this document, IANA has assigned the following object identifier (OID) in the "SMI Security for S/MIME Module Identifier
IANA has allocated the id
10. References
10.1. Normative References
- [FIPS180]
-
National Institute of Standards and Technology (NIST), "Secure Hash Standard (SHS)", FIPS PUB 180-4, DOI 10
.6028 , , <https:///NIST .FIPS .180 -4 nvlpubs >..nist .gov /nistpubs /FIPS /NIST .FIPS .180 -4 .pdf - [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC5083]
-
Housley, R., "Cryptographic Message Syntax (CMS) Authenticated
-Enveloped , RFC 5083, DOI 10-Data Content Type" .17487 , , <https:///RFC5083 www >..rfc -editor .org /info /rfc5083 - [RFC5652]
-
Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, RFC 5652, DOI 10
.17487 , , <https:///RFC5652 www >..rfc -editor .org /info /rfc5652 - [RFC5869]
-
Krawczyk, H. and P. Eronen, "HMAC-based Extract
-and , RFC 5869, DOI 10-Expand Key Derivation Function (HKDF)" .17487 , , <https:///RFC5869 www >..rfc -editor .org /info /rfc5869 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 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 , , <https:///RFC8551 www >..rfc -editor .org /info /rfc8551 - [X680]
-
ITU-T, "Information technology -- Abstract Syntax Notation One (ASN.1): Specification of basic notation", ITU-T Recommendation X.680, ISO/IEC 8824-1:2021, , <https://
www >..itu .int /rec /T -REC -X .680 - [X690]
-
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, , <https://
www >..itu .int /rec /T -REC -X .690
10.2. Informative References
- [RFC3852]
-
Housley, R., "Cryptographic Message Syntax (CMS)", RFC 3852, DOI 10
.17487 , , <https:///RFC3852 www >..rfc -editor .org /info /rfc3852 - [RFC4086]
-
Eastlake 3rd, D., Schiller, J., and S. Crocker, "Randomness Requirements for Security", BCP 106, RFC 4086, DOI 10
.17487 , , <https:///RFC4086 www >..rfc -editor .org /info /rfc4086 - [RFC5084]
-
Housley, R., "Using AES-CCM and AES-GCM Authenticated Encryption in the Cryptographic Message Syntax (CMS)", RFC 5084, DOI 10
.17487 , , <https:///RFC5084 www >..rfc -editor .org /info /rfc5084 - [RFC5911]
-
Hoffman, P. and J. Schaad, "New ASN.1 Modules for Cryptographic Message Syntax (CMS) and S/MIME", RFC 5911, DOI 10
.17487 , , <https:///RFC5911 www >..rfc -editor .org /info /rfc5911 - [RS2023]
-
Roth, J. and F. Strenzke, "AEAD-to-CBC Downgrade Attacks on CMS", IETF 118 Proceedings, , <https://
datatracker >..ietf .org /meeting /118 /materials /slides -118 -lamps -attack -against -aead -in -cms
Appendix A. ASN.1 Module
This ASN.1 module builds upon the conventions established in [RFC5911].¶
Appendix B. CMS_CEK_HKDF_SHA256 Function Examples
This appendix provides two test vectors for the CMS
B.1. CMS_CEK_HKDF_SHA256 with AES-128-GCM
This test vector includes an Algorithm
B.2. CMS_CEK_HKDF_SHA256 with AES-128-CBC
This test vector uses includes an Algorithm
Acknowledgements
Thanks to Mike Ounsworth, Carl Wallace, and Joe Mandel their careful review and constructive comments.¶