<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" ipr="trust200902" docName="draft-ietf-lamps-cms-cek-hkdf-sha256-05" number="9709" updates="" obsoletes="" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" xml:lang="en" prepTime="2025-01-10T13:33:55" indexInclude="true" scripts="Common,Latin" tocDepth="3">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-lamps-cms-cek-hkdf-sha256-05" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc9709" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="Encryption Key Derivation in CMS">Encryption Key Derivation in the Cryptographic Message Syntax (CMS) Using HKDF with SHA-256</title>
    <seriesInfo name="RFC" value="9709" stream="IETF"/>
    <author initials="R." surname="Housley" fullname="Russ Housley">
      <organization abbrev="Vigil Security" showOnFrontPage="true">Vigil Security, LLC</organization>
      <address>
        <postal>
          <city>Herndon</city>
          <region>VA</region>
          <country>United States of America</country>
        </postal>
        <email>housley@vigilsec.com</email>
      </address>
    </author>
    <date month="01" year="2025"/>
    <area>SEC</area>
    <workgroup>lamps</workgroup>
    <keyword>content-encryption key</keyword>
    <keyword>content-authenticated-encryption key</keyword>
    <abstract pn="section-abstract">
      <t indent="0" pn="section-abstract-1">This document specifies the derivation of the content-encryption key or the
content-authenticated-encryption key in the Cryptographic Message Syntax (CMS)
using the HMAC-based Extract-and-Expand Key Derivation Function (HKDF) with SHA-256.
The use of this mechanism provides protection against an attacker that manipulates the
content-encryption algorithm identifier or the content-authenticated-encryption
algorithm identifier.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t indent="0" pn="section-boilerplate.1-1">
            This is an Internet Standards Track document.
        </t>
        <t indent="0" pn="section-boilerplate.1-2">
            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.
        </t>
        <t indent="0" pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc9709" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t indent="0" pn="section-boilerplate.2-1">
            Copyright (c) 2025 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t indent="0" pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) 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.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t indent="0" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.1.2">
              <li pn="section-toc.1-1.1.2.1">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.1.1"><xref derivedContent="1.1" format="counter" sectionFormat="of" target="section-1.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-asn1">ASN.1</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.2">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.2.1"><xref derivedContent="1.2" format="counter" sectionFormat="of" target="section-1.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-terminology">Terminology</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.3">
                <t indent="0" keepWithNext="true" pn="section-toc.1-1.1.2.3.1"><xref derivedContent="1.3" format="counter" sectionFormat="of" target="section-1.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cryptographic-algorithm-agi">Cryptographic Algorithm Agility Considerations</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.2">
            <t indent="0" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-of-hkdf-with-sha-256-to">Use of HKDF with SHA-256 to Derive Encryption Keys</xref></t>
          </li>
          <li pn="section-toc.1-1.3">
            <t indent="0" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-the-id-alg-cek-hkdf-sha256-">The id-alg-cek-hkdf-sha256 Algorithm Identifier</xref></t>
          </li>
          <li pn="section-toc.1-1.4">
            <t indent="0" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-smimecapabilities-attribute">SMIMECapabilities Attribute Conventions</xref></t>
          </li>
          <li pn="section-toc.1-1.5">
            <t indent="0" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-of-hkdf-with-sha-256-wi">Use of HKDF with SHA-256 with CMS</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.5.2">
              <li pn="section-toc.1-1.5.2.1">
                <t indent="0" pn="section-toc.1-1.5.2.1.1"><xref derivedContent="5.1" format="counter" sectionFormat="of" target="section-5.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-enveloped-data-content-type">Enveloped-Data Content Type</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.2">
                <t indent="0" pn="section-toc.1-1.5.2.2.1"><xref derivedContent="5.2" format="counter" sectionFormat="of" target="section-5.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-encrypted-data-content-type">Encrypted-Data Content Type</xref></t>
              </li>
              <li pn="section-toc.1-1.5.2.3">
                <t indent="0" pn="section-toc.1-1.5.2.3.1"><xref derivedContent="5.3" format="counter" sectionFormat="of" target="section-5.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-authenticated-enveloped-dat">Authenticated-Enveloped-Data Content Type</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.6">
            <t indent="0" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.7">
            <t indent="0" pn="section-toc.1-1.7.1"><xref derivedContent="7" format="counter" sectionFormat="of" target="section-7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-privacy-considerations">Privacy Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.8">
            <t indent="0" pn="section-toc.1-1.8.1"><xref derivedContent="8" format="counter" sectionFormat="of" target="section-8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-operational-considerations">Operational Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.9">
            <t indent="0" pn="section-toc.1-1.9.1"><xref derivedContent="9" format="counter" sectionFormat="of" target="section-9"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.10">
            <t indent="0" pn="section-toc.1-1.10.1"><xref derivedContent="10" format="counter" sectionFormat="of" target="section-10"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.10.2">
              <li pn="section-toc.1-1.10.2.1">
                <t indent="0" pn="section-toc.1-1.10.2.1.1"><xref derivedContent="10.1" format="counter" sectionFormat="of" target="section-10.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.10.2.2">
                <t indent="0" pn="section-toc.1-1.10.2.2.1"><xref derivedContent="10.2" format="counter" sectionFormat="of" target="section-10.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.11">
            <t indent="0" pn="section-toc.1-1.11.1"><xref derivedContent="Appendix A" format="default" sectionFormat="of" target="section-appendix.a"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-asn1-module">ASN.1 Module</xref></t>
          </li>
          <li pn="section-toc.1-1.12">
            <t indent="0" pn="section-toc.1-1.12.1"><xref derivedContent="Appendix B" format="default" sectionFormat="of" target="section-appendix.b"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cms_cek_hkdf_sha256-functio">CMS_CEK_HKDF_SHA256 Function Examples</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.12.2">
              <li pn="section-toc.1-1.12.2.1">
                <t indent="0" pn="section-toc.1-1.12.2.1.1"><xref derivedContent="B.1" format="counter" sectionFormat="of" target="section-appendix.b.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cms_cek_hkdf_sha256-with-ae">CMS_CEK_HKDF_SHA256 with AES-128-GCM</xref></t>
              </li>
              <li pn="section-toc.1-1.12.2.2">
                <t indent="0" pn="section-toc.1-1.12.2.2.1"><xref derivedContent="B.2" format="counter" sectionFormat="of" target="section-appendix.b.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cms_cek_hkdf_sha256-with-aes">CMS_CEK_HKDF_SHA256 with AES-128-CBC</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.13">
            <t indent="0" pn="section-toc.1-1.13.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.c"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgements</xref></t>
          </li>
          <li pn="section-toc.1-1.14">
            <t indent="0" pn="section-toc.1-1.14.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.d"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-address">Author's Address</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" removeInRFC="false" toc="include" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t indent="0" pn="section-1-1">This document specifies the derivation of the content-encryption key for the
Cryptographic Message Syntax (CMS) enveloped-data content type <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/>, the
content-encryption key for the CMS encrypted-data content type <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/>, or the
content-authenticated-encryption key for the authenticated-enveloped-data
content type <xref target="RFC5083" format="default" sectionFormat="of" derivedContent="RFC5083"/>.</t>
      <t indent="0" pn="section-1-2">The use of this mechanism provides protection against an attacker that manipulates the
content-encryption algorithm identifier or the content-authenticated-encryption
algorithm identifier.  Johannes Roth and Falko Strenzke presented such an attack
at IETF 118 <xref target="RS2023" format="default" sectionFormat="of" derivedContent="RS2023"/>, where:</t>
      <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-1-3"><li pn="section-1-3.1" derivedCounter="1.">
          <t indent="0" pn="section-1-3.1.1">The attacker intercepts a CMS authenticated-enveloped-data content <xref target="RFC5083" format="default" sectionFormat="of" derivedContent="RFC5083"/>
that uses either AES-CCM or AES-GCM <xref target="RFC5084" format="default" sectionFormat="of" derivedContent="RFC5084"/>.</t>
        </li>
        <li pn="section-1-3.2" derivedCounter="2.">
          <t indent="0" pn="section-1-3.2.1">The attacker turns the intercepted content into a "garbage" CMS enveloped-data
content (<xref section="6" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6" derivedContent="RFC5652"/>) that is composed of AES-CBC guess blocks.</t>
        </li>
        <li pn="section-1-3.3" derivedCounter="3.">
          <t indent="0" pn="section-1-3.3.1">The attacker sends the "garbage" message to the victim, and the victim reveals
the result of the decryption to the attacker.</t>
        </li>
        <li pn="section-1-3.4" derivedCounter="4.">
          <t indent="0" pn="section-1-3.4.1">If any of the transformed plaintext blocks match the guess for that block, then
the attacker learns the plaintext for that block.</t>
        </li>
      </ol>
      <t indent="0" pn="section-1-4">With highly structured messages, one block can reveal the only sensitive part of
the original message.</t>
      <t indent="0" pn="section-1-5">This attack is thwarted if the encryption key depends upon the delivery of
the unmodified algorithm identifier.</t>
      <t indent="0" pn="section-1-6">The mitigation for this attack has three parts:</t>
      <ol spacing="normal" type="1" indent="adaptive" start="1" pn="section-1-7">
        <li pn="section-1-7.1" derivedCounter="1.">Potential recipients include the id-alg-cek-hkdf-sha256 algorithm
        identifier (with no parameters) in S/MIME Capabilities to indicate
        support for this mitigation.</li>
        <li pn="section-1-7.2" derivedCounter="2.">As a flag to the recipient that this mitigation is being used,
        carry the id-alg-cek-hkdf-sha256 algorithm identifier as the
        contentEncryptionAlgorithm in the EncryptedContentInfo structure.
        This structure is used in the enveloped-data content type, the
        encrypted-data content type, and the authenticated-enveloped-data
        content type.  The parameters field of the id-alg-cek-hkdf-sha256
        algorithm identifier identifies the content-encryption algorithm or
        the content-authenticated-encryption algorithm and any associated
        parameters.
        </li>
        <li pn="section-1-7.3" derivedCounter="3.">
          <t indent="0" pn="section-1-7.3.1">Perform encryption with a derived content-encryption key or
        content-authenticated-encryption key:</t>
          <artwork align="left" pn="section-1-7.3.2">
      CEK' = HKDF(CEK, AlgorithmIdentifier)
</artwork>
        </li>
      </ol>
      <section anchor="asn1" numbered="true" removeInRFC="false" toc="include" pn="section-1.1">
        <name slugifiedName="name-asn1">ASN.1</name>
        <t indent="0" pn="section-1.1-1">CMS values are generated using ASN.1 <xref target="X680" format="default" sectionFormat="of" derivedContent="X680"/>, using the Basic
Encoding Rules (BER) and the Distinguished Encoding Rules
(DER) <xref target="X690" format="default" sectionFormat="of" derivedContent="X690"/>.</t>
      </section>
      <section anchor="terminology" numbered="true" removeInRFC="false" toc="include" pn="section-1.2">
        <name slugifiedName="name-terminology">Terminology</name>
        <t indent="0" pn="section-1.2-1">
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>",
    "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL NOT</bcp14>",
    "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>",
    "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be
    interpreted as described in BCP 14 <xref target="RFC2119" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> when, and only when, they appear in all capitals, as
    shown here.
        </t>
      </section>
      <section anchor="cryptographic-algorithm-agility-considerations" numbered="true" removeInRFC="false" toc="include" pn="section-1.3">
        <name slugifiedName="name-cryptographic-algorithm-agi">Cryptographic Algorithm Agility Considerations</name>
        <t indent="0" pn="section-1.3-1">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.</t>
      </section>
    </section>
    <section anchor="cmskdf" numbered="true" removeInRFC="false" toc="include" pn="section-2">
      <name slugifiedName="name-use-of-hkdf-with-sha-256-to">Use of HKDF with SHA-256 to Derive Encryption Keys</name>
      <t indent="0" pn="section-2-1">The mitigation uses the HMAC-based Extract-and-Expand Key Derivation
Function (HKDF) <xref target="RFC5869" format="default" sectionFormat="of" derivedContent="RFC5869"/> to derive output keying material (OKM) from
input keying material (IKM).  HKDF is used with the SHA-256 hash function
<xref target="FIPS180" format="default" sectionFormat="of" derivedContent="FIPS180"/>.  The derivation includes the DER-encoded AlgorithmIdentifier as
the optional info input value.  The encoded value includes the ASN.1 tag
for SEQUENCE (0x30), the length, and the value.  This AlgorithmIdentifier is
carried as the parameter to the id-alg-cek-hkdf-sha256 algorithm identifier.  If
an attacker were to change the originator-provided AlgorithmIdentifier, then the
recipient will derive a different content-encryption key or
content-authenticated-encryption key.</t>
      <t indent="0" pn="section-2-2">The CMS_CEK_HKDF_SHA256 function uses the HKDF-Extract and HKDF-Expand functions
to derive the OKM from the IKM:</t>
      <dl spacing="normal" newline="true" indent="3" pn="section-2-3">
        <dt pn="section-2-3.1">Inputs:</dt>
        <dd pn="section-2-3.2">
          <dl newline="false" spacing="compact" indent="6" pn="section-2-3.2.1">
            <dt pn="section-2-3.2.1.1">IKM</dt>
            <dd pn="section-2-3.2.1.2">input keying material</dd>
            <dt pn="section-2-3.2.1.3">info</dt>
            <dd pn="section-2-3.2.1.4">DER-encoded AlgorithmIdentifier</dd>
          </dl>
        </dd>
        <dt pn="section-2-3.3">Output:</dt>
        <dd pn="section-2-3.4">
          <dl newline="false" spacing="compact" indent="6" pn="section-2-3.4.1">
            <dt pn="section-2-3.4.1.1">OKM</dt>
            <dd pn="section-2-3.4.1.2">output keying material (same size as IKM)</dd>
          </dl>
        </dd>
      </dl>
      <t indent="0" pn="section-2-4">The output OKM is calculated as follows:</t>
      <artwork align="left" pn="section-2-5">
   OKM_SIZE = len(IKM)  /* length in octets */
   IF OKM_SIZE &gt; 8160 THEN raise error

   salt = "The Cryptographic Message Syntax"
   PRK = HKDF-Extract(salt, IKM)

   OKM = HKDF-Expand(PRK, info, OKM_SIZE)
</artwork>
    </section>
    <section anchor="alg-def" numbered="true" removeInRFC="false" toc="include" pn="section-3">
      <name slugifiedName="name-the-id-alg-cek-hkdf-sha256-">The id-alg-cek-hkdf-sha256 Algorithm Identifier</name>
      <t indent="0" pn="section-3-1">The id-alg-cek-hkdf-sha256 algorithm identifier indicates that the CMS_CEK_HKDF_SHA256
function defined in <xref target="cmskdf" format="default" sectionFormat="of" derivedContent="Section 2"/> is used to derive the content-encryption key or the
content-authenticated-encryption key.</t>
      <t indent="0" pn="section-3-2">The following object identifier identifies the id-alg-cek-hkdf-sha256
algorithm:</t>
      <sourcecode type="asn.1" markers="false" pn="section-3-3">
   id-alg-cek-hkdf-sha256 OBJECT IDENTIFIER ::= { iso(1)
      member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)
      id-smime(16) alg(3) 31 }
</sourcecode>
      <t indent="0" pn="section-3-4">The id-alg-cek-hkdf-sha256 parameters field has an ASN.1 type of AlgorithmIdentifier.</t>
      <t indent="0" pn="section-3-5">Using the conventions from <xref target="RFC5911" format="default" sectionFormat="of" derivedContent="RFC5911"/>, the id-alg-cek-hkdf-sha256 algorithm identifier
is defined as:</t>
      <sourcecode type="asn.1" markers="false" pn="section-3-6">
  ContentEncryptionAlgorithmIdentifier ::=
    AlgorithmIdentifier{CONTENT-ENCRYPTION, { ... } }

  cea-CEKHKDFSHA256 CONTENT-ENCRYPTION ::= {
    IDENTIFIER id-alg-cek-hkdf-sha256
    PARAMS TYPE ContentEncryptionAlgorithmIdentifier ARE required
    SMIME-CAPS { IDENTIFIED BY id-alg-cek-hkdf-sha256 } }
</sourcecode>
    </section>
    <section anchor="smimecapabilities-attribute-conventions" numbered="true" removeInRFC="false" toc="include" pn="section-4">
      <name slugifiedName="name-smimecapabilities-attribute">SMIMECapabilities Attribute Conventions</name>
      <t indent="0" pn="section-4-1">The SMIMECapabilities attribute is defined in <xref section="2.5.2" sectionFormat="of" target="RFC8551" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8551#section-2.5.2" derivedContent="RFC8551"/>.  An
S/MIME client announces the set of cryptographic functions it supports using the
SMIMECapabilities attribute.</t>
      <t indent="0" pn="section-4-2">If an S/MIME client supports the mechanism in this document, the
id-alg-cek-hkdf-sha256 object identifier <bcp14>SHOULD</bcp14> be included in the set of
cryptographic functions.  The parameter with this encoding <bcp14>MUST</bcp14> be absent.</t>
      <t indent="0" pn="section-4-3">The encoding for id-alg-cek-hkdf-sha256, in hexadecimal, is:</t>
      <artwork align="left" pn="section-4-4">
   30 0d 06 0b 2a 86 48 86 f7 0d 01 09 10 03 1f
</artwork>
    </section>
    <section anchor="use-of-hkdf-with-sha-256-with-cms" numbered="true" removeInRFC="false" toc="include" pn="section-5">
      <name slugifiedName="name-use-of-hkdf-with-sha-256-wi">Use of HKDF with SHA-256 with CMS</name>
      <t indent="0" pn="section-5-1">This section describes the originator and recipient processing to implement
this mitigation for each of the CMS encrypting content types.</t>
      <section anchor="enveloped-data-content-type" numbered="true" removeInRFC="false" toc="include" pn="section-5.1">
        <name slugifiedName="name-enveloped-data-content-type">Enveloped-Data Content Type</name>
        <t indent="0" pn="section-5.1-1">The fourth step of constructing an enveloped-data content type is repeated below
from <xref section="6" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6" derivedContent="RFC5652"/>:</t>
        <blockquote pn="section-5.1-2">
          <ol start="4" indent="adaptive" spacing="normal" type="1" pn="section-5.1-2.1"><li pn="section-5.1-2.1.1" derivedCounter="4.">The content is encrypted with the content-encryption key.
    Content encryption may require that the content be padded to a
    multiple of some block size; see Section <xref target="RFC5652" sectionFormat="bare" section="6.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6.3" derivedContent="RFC5652"/>.</li>
          </ol>
        </blockquote>
        <t indent="0" pn="section-5.1-3">To implement this mitigation, the originator expands this step as follows:</t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-5.1-4">
          <li pn="section-5.1-4.1">Include the id-alg-cek-hkdf-sha256 algorithm identifier in the
          contentEncryptionAlgorithm.algorithm field of the
          EncryptedContentInfo structure, and set the
          contentEncryptionAlgorithm.parameters field to the
          AlgorithmIdentifier for the content-encryption algorithm that will
          be used to encrypt the content, including both the algorithm and
          optional parameters.</li>
          <li pn="section-5.1-4.2">
            <t indent="0" pn="section-5.1-4.2.1">Derive the new content-encryption key (CEK') from the original
          content-encryption key (CEK) and the
          ContentEncryptionAlgorithmIdentifier, which is carried in the
          contentEncryptionAlgorithm.parameters field:</t>
            <artwork align="left" pn="section-5.1-4.2.2">
CEK' = CMS_CEK_HKDF_SHA256(CEK, ContentEncryptionAlgorithmIdentifier)
</artwork>
          </li>
          <li pn="section-5.1-4.3">The content is encrypted with the new content-encryption key
          (CEK').  Content encryption may require that the content be padded
          to a multiple of some block size; see <xref section="6.3" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6.3" derivedContent="RFC5652"/>.</li>
        </ul>
        <t indent="0" pn="section-5.1-5">The presence of the id-alg-cek-hkdf-sha256 algorithm identifier in the
contentEncryptionAlgorithm.algorithm field of the EncryptedContentInfo
structure tells the recipient to derive the new content-encryption
key (CEK') as shown above, and then use it for decryption of the
EncryptedContent.  If the id-alg-cek-hkdf-sha256 algorithm identifier
is not present in the contentEncryptionAlgorithm.algorithm field of
the EncryptedContentInfo structure, then the recipient uses the original
content-encryption key (CEK) for decryption of the EncryptedContent.</t>
      </section>
      <section anchor="encrypted-data-content-type" numbered="true" removeInRFC="false" toc="include" pn="section-5.2">
        <name slugifiedName="name-encrypted-data-content-type">Encrypted-Data Content Type</name>
        <t indent="0" pn="section-5.2-1">As specified in <xref section="8" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-8" derivedContent="RFC5652"/>, the content-encryption key
is managed by other means.</t>
        <t indent="0" pn="section-5.2-2">To implement this mitigation, the originator performs the following:</t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-5.2-3">
          <li pn="section-5.2-3.1">Include the id-alg-cek-hkdf-sha256 algorithm identifier in
          the contentEncryptionAlgorithm.algorithm field of the
          EncryptedContentInfo structure, and set the
          contentEncryptionAlgorithm.parameters field to the
          AlgorithmIdentifier for the content-encryption algorithm that will
          be used to encrypt the content, including both the algorithm and
          optional parameters.</li>
          <li pn="section-5.2-3.2">
            <t indent="0" pn="section-5.2-3.2.1">Derive the new content-encryption key (CEK') from the
          original content-encryption key (CEK) and the
          ContentEncryptionAlgorithmIdentifier, which is carried in the
          contentEncryptionAlgorithm.parameters field:</t>
            <artwork align="left" pn="section-5.2-3.2.2">
CEK' = CMS_CEK_HKDF_SHA256(CEK, ContentEncryptionAlgorithmIdentifier)
</artwork>
          </li>
          <li pn="section-5.2-3.3">The content is encrypted with the new content-encryption key
          (CEK').  Content encryption may require that the content be padded
          to a multiple of some block size; see <xref section="6.3" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6.3" derivedContent="RFC5652"/>.</li>
        </ul>
        <t indent="0" pn="section-5.2-4">The presence of the id-alg-cek-hkdf-sha256 algorithm identifier in the
contentEncryptionAlgorithm.algorithm field of the EncryptedContentInfo
structure tells the recipient to derive the new content-encryption
key (CEK') as shown above, and then use it for decryption of the
EncryptedContent.  If the id-alg-cek-hkdf-sha256 algorithm identifier
is not present in the contentEncryptionAlgorithm.algorithm field of
the EncryptedContentInfo structure, then the recipient uses the original
content-encryption key (CEK) for decryption of the EncryptedContent.</t>
      </section>
      <section anchor="authenticated-enveloped-data-content-type" numbered="true" removeInRFC="false" toc="include" pn="section-5.3">
        <name slugifiedName="name-authenticated-enveloped-dat">Authenticated-Enveloped-Data Content Type</name>
        <t indent="0" pn="section-5.3-1">The fifth step of constructing an authenticated-enveloped-data content type is
repeated below from <xref section="2" sectionFormat="of" target="RFC5083" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5083#section-2" derivedContent="RFC5083"/>:</t>
        <blockquote pn="section-5.3-2">
          <ol start="5" indent="adaptive" spacing="normal" type="1" pn="section-5.3-2.1"><li pn="section-5.3-2.1.1" derivedCounter="5."> The attributes collected in step 4 are authenticated and the CMS
    content is authenticated and encrypted with the content-
    authenticated-encryption key.  If the authenticated encryption
    algorithm requires either the additional authenticated data (AAD)
    or the content to be padded to a multiple of some block size,
    then the padding is added as described in Section <xref target="RFC3852" sectionFormat="bare" section="6.3" format="default" derivedLink="https://rfc-editor.org/rfc/rfc3852#section-6.3" derivedContent="RFC3852"/> of [CMS].</li>
          </ol>
        </blockquote>
        <aside pn="section-5.3-3">
          <t indent="0" pn="section-5.3-3.1">Note that [CMS] refers to <xref target="RFC3852" format="default" sectionFormat="of" derivedContent="RFC3852"/>, which has been obsoleted by <xref target="RFC5652" format="default" sectionFormat="of" derivedContent="RFC5652"/>, but the text in Section 6.3 was unchanged in RFC 5652.</t>
        </aside>
        <t indent="0" pn="section-5.3-4">To implement this mitigation, the originator expands this step as follows:</t>
        <ul spacing="normal" bare="false" empty="false" indent="3" pn="section-5.3-5">
          <li pn="section-5.3-5.1">Include the id-alg-cek-hkdf-sha256 algorithm identifier in the
          contentEncryptionAlgorithm.algorithm field of the
          EncryptedContentInfo structure, and set the
          contentEncryptionAlgorithm.parameters field to the
          AlgorithmIdentifier for the content-authenticated-encryption
          algorithm that will be used for authenticated encryption of the
          content, including both the algorithm and optional parameters.</li>
          <li pn="section-5.3-5.2">
            <t indent="0" pn="section-5.3-5.2.1">Derive the new content-authenticated-encryption key (CEK')
          from the original content-authenticated-encryption key (CEK) and the
          ContentEncryptionAlgorithmIdentifier:</t>
            <artwork align="left" pn="section-5.3-5.2.2">
CEK' = CMS_CEK_HKDF_SHA256(CEK, ContentEncryptionAlgorithmIdentifier)
</artwork>
          </li>
          <li pn="section-5.3-5.3">The attributes collected in step 4 are authenticated and the CMS
          content is authenticated and encrypted with the new
          content-authenticated-encryption key (CEK').  If the authenticated
          encryption algorithm requires either the additional authenticated
          data (AAD) or the content to be padded to a multiple of some block
          size, then the padding is added as described in <xref section="6.3" sectionFormat="of" target="RFC5652" format="default" derivedLink="https://rfc-editor.org/rfc/rfc5652#section-6.3" derivedContent="RFC5652"/>.</li>
        </ul>
        <t indent="0" pn="section-5.3-6">The presence of the id-alg-cek-hkdf-sha256 algorithm identifier in the
contentEncryptionAlgorithm.algorithm field of the EncryptedContentInfo
structure tells the recipient to derive the new content-authenticated-encryption
key (CEK') as shown above, and then use it for authenticated decryption of the
EncryptedContent and the authentication of the AAD.  If the id-alg-cek-hkdf-sha256
algorithm identifier is not present in the contentEncryptionAlgorithm.algorithm
field of the EncryptedContentInfo structure, then the recipient uses the original
content-authenticated-encryption (CEK) for decryption and authentication of
the EncryptedContent and the authentication of the AAD.</t>
      </section>
    </section>
    <section anchor="security-considerations" numbered="true" removeInRFC="false" toc="include" pn="section-6">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t indent="0" pn="section-6-1">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.</t>
      <t indent="0" pn="section-6-2">If the attacker removes the id-alg-cek-hkdf-sha256 object identifier from the
contentEncryptionAlgorithm.algorithm field of the EncryptedContentInfo
structure prior to delivery to the recipient, then the recipient will not
attempt to derive CEK', which will deny the recipient access to the content
but will not assist the attacker in recovering the plaintext content.</t>
      <t indent="0" pn="section-6-3">If the attacker changes contentEncryptionAlgorithm.parameters field of the
EncryptedContentInfo structure prior to delivery to the recipient, then the
recipient will derive a different CEK', which will not assist the attacker in
recovering the plaintext content.  Providing the object identifier as an input to
the key derivation function is sufficient to mitigate the attack described
in <xref target="RS2023" format="default" sectionFormat="of" derivedContent="RS2023"/>, but this mitigation includes both the object identifier and the
parameters to protect against some yet-to-be-discovered attack that only
manipulates the parameters.</t>
      <t indent="0" pn="section-6-4">Implementations <bcp14>MUST</bcp14> protect the content-encryption keys and
content-authenticated-encryption keys, including the CEK and CEK'.
Compromise of a content-encryption key may result in disclosure of the
associated encrypted content.  Compromise of a content-authenticated-encryption
key may result in disclosure of the associated encrypted content or allow
modification of the authenticated content and the AAD.</t>
      <t indent="0" pn="section-6-5">Implementations <bcp14>MUST</bcp14> randomly generate content-encryption keys and
content-authenticated-encryption keys.  Using an inadequate pseudorandom
number generator (PRNG) 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 and then search the resulting small set
of possibilities, rather than brute-force searching the whole key space.  The
generation of quality random numbers is difficult.  <xref target="RFC4086" format="default" sectionFormat="of" derivedContent="RFC4086"/> offers important
guidance on this topic.</t>
    </section>
    <section anchor="privacy-considerations" numbered="true" removeInRFC="false" toc="include" pn="section-7">
      <name slugifiedName="name-privacy-considerations">Privacy Considerations</name>
      <t indent="0" pn="section-7-1">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 <bcp14>SHOULD NOT</bcp14> contain the message-digest attribute.</t>
    </section>
    <section anchor="operational-considerations" numbered="true" removeInRFC="false" toc="include" pn="section-8">
      <name slugifiedName="name-operational-considerations">Operational Considerations</name>
      <t indent="0" pn="section-8-1">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.</t>
    </section>
    <section anchor="iana" numbered="true" removeInRFC="false" toc="include" pn="section-9">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t indent="0" pn="section-9-1">For the ASN.1 module in <xref target="appendix-asn1" format="default" sectionFormat="of" derivedContent="Appendix A"/> of this document, IANA has assigned the following object identifier (OID) in the "SMI Security for S/MIME Module Identifier (1.2.840.113549.1.9.16.0)" registry: </t>
      <table anchor="tab1" align="center" pn="table-1">
        <name/>
        <thead>
          <tr>
            <th align="left" colspan="1" rowspan="1">Decimal</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">References</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">80</td>
            <td align="left" colspan="1" rowspan="1">id-mod-CMS-CEK-HKDF-SHA256-2023</td>
            <td align="left" colspan="1" rowspan="1">RFC 9709</td>
          </tr>
        </tbody>
      </table>
      <t indent="0" pn="section-9-3">IANA has allocated the id-alg-cek-hkdf-sha256 algorithm identifier as specified
in <xref target="alg-def" format="default" sectionFormat="of" derivedContent="Section 3"/> in the "SMI Security for S/MIME Algorithms (1.2.840.113549.1.9.16.3)" registry as follows:  </t>
      <table anchor="tab2" align="center" pn="table-2">
        <name/>
        <thead>
          <tr>
            <th align="left" colspan="1" rowspan="1">Decimal</th>
            <th align="left" colspan="1" rowspan="1">Description</th>
            <th align="left" colspan="1" rowspan="1">References</th>
          </tr>
        </thead>
        <tbody>
          <tr>
            <td align="left" colspan="1" rowspan="1">31</td>
            <td align="left" colspan="1" rowspan="1">id-alg-cek-hkdf-sha256</td>
            <td align="left" colspan="1" rowspan="1">RFC 9709</td>
          </tr>
        </tbody>
      </table>
    </section>
  </middle>
  <back>
    <references anchor="sec-combined-references" pn="section-10">
      <name slugifiedName="name-references">References</name>
      <references anchor="sec-normative-references" pn="section-10.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="FIPS180" target="https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf" quoteTitle="true" derivedAnchor="FIPS180">
          <front>
            <title>Secure Hash Standard (SHS)</title>
            <author>
              <organization showOnFrontPage="true">National Institute of Standards and Technology (NIST)</organization>
            </author>
            <date year="2015" month="August"/>
          </front>
          <seriesInfo name="FIPS PUB" value="180-4"/>
          <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author fullname="S. Bradner" initials="S." surname="Bradner"/>
            <date month="March" year="1997"/>
            <abstract>
              <t indent="0">In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="2119"/>
          <seriesInfo name="DOI" value="10.17487/RFC2119"/>
        </reference>
        <reference anchor="RFC5083" target="https://www.rfc-editor.org/info/rfc5083" quoteTitle="true" derivedAnchor="RFC5083">
          <front>
            <title>Cryptographic Message Syntax (CMS) Authenticated-Enveloped-Data Content Type</title>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <date month="November" year="2007"/>
            <abstract>
              <t indent="0">This document describes an additional content type for the Cryptographic Message Syntax (CMS). The authenticated-enveloped-data content type is intended for use with authenticated encryption modes. All of the various key management techniques that are supported in the CMS enveloped-data content type are also supported by the CMS authenticated-enveloped-data content type. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5083"/>
          <seriesInfo name="DOI" value="10.17487/RFC5083"/>
        </reference>
        <reference anchor="RFC5652" target="https://www.rfc-editor.org/info/rfc5652" quoteTitle="true" derivedAnchor="RFC5652">
          <front>
            <title>Cryptographic Message Syntax (CMS)</title>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <date month="September" year="2009"/>
            <abstract>
              <t indent="0">This document describes the Cryptographic Message Syntax (CMS). This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="70"/>
          <seriesInfo name="RFC" value="5652"/>
          <seriesInfo name="DOI" value="10.17487/RFC5652"/>
        </reference>
        <reference anchor="RFC5869" target="https://www.rfc-editor.org/info/rfc5869" quoteTitle="true" derivedAnchor="RFC5869">
          <front>
            <title>HMAC-based Extract-and-Expand Key Derivation Function (HKDF)</title>
            <author fullname="H. Krawczyk" initials="H." surname="Krawczyk"/>
            <author fullname="P. Eronen" initials="P." surname="Eronen"/>
            <date month="May" year="2010"/>
            <abstract>
              <t indent="0">This document specifies a simple Hashed Message Authentication Code (HMAC)-based key derivation function (HKDF), which can be used as a building block in various protocols and applications. The key derivation function (KDF) is intended to support a wide range of applications and requirements, and is conservative in its use of cryptographic hash functions. This document is not an Internet Standards Track specification; it is published for informational purposes.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5869"/>
          <seriesInfo name="DOI" value="10.17487/RFC5869"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author fullname="B. Leiba" initials="B." surname="Leiba"/>
            <date month="May" year="2017"/>
            <abstract>
              <t indent="0">RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
        <reference anchor="RFC8551" target="https://www.rfc-editor.org/info/rfc8551" quoteTitle="true" derivedAnchor="RFC8551">
          <front>
            <title>Secure/Multipurpose Internet Mail Extensions (S/MIME) Version 4.0 Message Specification</title>
            <author fullname="J. Schaad" initials="J." surname="Schaad"/>
            <author fullname="B. Ramsdell" initials="B." surname="Ramsdell"/>
            <author fullname="S. Turner" initials="S." surname="Turner"/>
            <date month="April" year="2019"/>
            <abstract>
              <t indent="0">This document defines Secure/Multipurpose Internet Mail Extensions (S/MIME) version 4.0. S/MIME provides a consistent way to send and receive secure MIME data. Digital signatures provide authentication, message integrity, and non-repudiation with proof of origin. Encryption provides data confidentiality. Compression can be used to reduce data size. This document obsoletes RFC 5751.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8551"/>
          <seriesInfo name="DOI" value="10.17487/RFC8551"/>
        </reference>
        <reference anchor="X680" target="https://www.itu.int/rec/T-REC-X.680" quoteTitle="true" derivedAnchor="X680">
          <front>
            <title>Information technology -- Abstract Syntax Notation One (ASN.1): Specification of basic notation</title>
            <author>
              <organization showOnFrontPage="true">ITU-T</organization>
            </author>
            <date year="2021" month="February"/>
          </front>
          <seriesInfo name="ITU-T Recommendation" value="X.680"/>
          <seriesInfo name="ISO/IEC" value="8824-1:2021"/>
        </reference>
        <reference anchor="X690" target="https://www.itu.int/rec/T-REC-X.690" quoteTitle="true" derivedAnchor="X690">
          <front>
            <title>Information technology -- ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)</title>
            <author>
              <organization showOnFrontPage="true">ITU-T</organization>
            </author>
            <date year="2021" month="February"/>
          </front>
          <seriesInfo name="ITU-T Recommendation" value="X.690"/>
          <seriesInfo name="ISO/IEC" value="8825-1-2021"/>
        </reference>
      </references>
      <references anchor="sec-informative-references" pn="section-10.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="RFC3852" target="https://www.rfc-editor.org/info/rfc3852" quoteTitle="true" derivedAnchor="RFC3852">
          <front>
            <title>Cryptographic Message Syntax (CMS)</title>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <date month="July" year="2004"/>
            <abstract>
              <t indent="0">This document describes the Cryptographic Message Syntax (CMS). This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="3852"/>
          <seriesInfo name="DOI" value="10.17487/RFC3852"/>
        </reference>
        <reference anchor="RFC4086" target="https://www.rfc-editor.org/info/rfc4086" quoteTitle="true" derivedAnchor="RFC4086">
          <front>
            <title>Randomness Requirements for Security</title>
            <author fullname="D. Eastlake 3rd" initials="D." surname="Eastlake 3rd"/>
            <author fullname="J. Schiller" initials="J." surname="Schiller"/>
            <author fullname="S. Crocker" initials="S." surname="Crocker"/>
            <date month="June" year="2005"/>
            <abstract>
              <t indent="0">Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts. However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities. The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.</t>
              <t indent="0">Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult. This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities. It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="106"/>
          <seriesInfo name="RFC" value="4086"/>
          <seriesInfo name="DOI" value="10.17487/RFC4086"/>
        </reference>
        <reference anchor="RFC5084" target="https://www.rfc-editor.org/info/rfc5084" quoteTitle="true" derivedAnchor="RFC5084">
          <front>
            <title>Using AES-CCM and AES-GCM Authenticated Encryption in the Cryptographic Message Syntax (CMS)</title>
            <author fullname="R. Housley" initials="R." surname="Housley"/>
            <date month="November" year="2007"/>
            <abstract>
              <t indent="0">This document specifies the conventions for using the AES-CCM and the AES-GCM authenticated encryption algorithms with the Cryptographic Message Syntax (CMS) authenticated-enveloped-data content type. [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5084"/>
          <seriesInfo name="DOI" value="10.17487/RFC5084"/>
        </reference>
        <reference anchor="RFC5911" target="https://www.rfc-editor.org/info/rfc5911" quoteTitle="true" derivedAnchor="RFC5911">
          <front>
            <title>New ASN.1 Modules for Cryptographic Message Syntax (CMS) and S/MIME</title>
            <author fullname="P. Hoffman" initials="P." surname="Hoffman"/>
            <author fullname="J. Schaad" initials="J." surname="Schaad"/>
            <date month="June" year="2010"/>
            <abstract>
              <t indent="0">The Cryptographic Message Syntax (CMS) format, and many associated formats, are expressed using ASN.1. The current ASN.1 modules conform to the 1988 version of ASN.1. This document updates those ASN.1 modules to conform to the 2002 version of ASN.1. There are no bits-on-the-wire changes to any of the formats; this is simply a change to the syntax. This document is not an Internet Standards Track specification; it is published for informational purposes.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="5911"/>
          <seriesInfo name="DOI" value="10.17487/RFC5911"/>
        </reference>
        <reference anchor="RS2023" target="https://datatracker.ietf.org/meeting/118/materials/slides-118-lamps-attack-against-aead-in-cms" quoteTitle="true" derivedAnchor="RS2023">
          <front>
            <title>AEAD-to-CBC Downgrade Attacks on CMS</title>
            <author initials="J." surname="Roth" fullname="Johannes Roth">
              <organization showOnFrontPage="true">MTG AG</organization>
            </author>
            <author initials="F." surname="Strenzke" fullname="Falko Strenzke">
              <organization showOnFrontPage="true">MTG AG</organization>
            </author>
            <date year="2023" month="November" day="08"/>
          </front>
          <refcontent>IETF 118 Proceedings</refcontent>
        </reference>
      </references>
    </references>
    <section anchor="appendix-asn1" numbered="true" removeInRFC="false" toc="include" pn="section-appendix.a">
      <name slugifiedName="name-asn1-module">ASN.1 Module</name>
      <t indent="0" pn="section-appendix.a-1">This ASN.1 module builds upon the conventions established in <xref target="RFC5911" format="default" sectionFormat="of" derivedContent="RFC5911"/>.</t>
      <sourcecode type="asn.1" markers="true" pn="section-appendix.a-2">
CMS-CEK-HKDF-SHA256-Module-2023
  { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-9(9)
    id-smime(16) id-mod(0) id-mod-CMS-CEK-HKDF-SHA256-2023(80) }

DEFINITIONS IMPLICIT TAGS ::= BEGIN

EXPORTS ALL;

IMPORTS
  AlgorithmIdentifier{}, CONTENT-ENCRYPTION, SMIME-CAPS
  FROM AlgorithmInformation-2009 -- in RFC 5911
    { iso(1) identified-organization(3) dod(6) internet(1)
      security(5) mechanisms(5) pkix(7) id-mod(0)
      id-mod-algorithmInformation-02(58) } ;


--
-- CEK-HKDF-SHA256 Algorithm
--

id-alg-cek-hkdf-sha256 OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) id-smime(16) alg(3) 31 }

ContentEncryptionAlgorithmIdentifier ::=
    AlgorithmIdentifier{CONTENT-ENCRYPTION, { ... } }

cea-CEKHKDFSHA256 CONTENT-ENCRYPTION ::= {
    IDENTIFIER id-alg-cek-hkdf-sha256
    PARAMS TYPE ContentEncryptionAlgorithmIdentifier ARE required
    SMIME-CAPS { IDENTIFIED BY id-alg-cek-hkdf-sha256 } }

--
-- S/MIME Capability for CEK-HKDF-SHA256 Algorithm
--

SMimeCaps SMIME-CAPS ::= { cap-CMSCEKHKDFSHA256, ... }

cap-CMSCEKHKDFSHA256 SMIME-CAPS ::=
    { -- No value -- IDENTIFIED BY id-alg-cek-hkdf-sha256 }

END
</sourcecode>
    </section>
    <section anchor="cmscekhkdfsha256-function-examples" numbered="true" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-cms_cek_hkdf_sha256-functio">CMS_CEK_HKDF_SHA256 Function Examples</name>
      <t indent="0" pn="section-appendix.b-1">This appendix provides two test vectors for the CMS_CEK_HKDF_SHA256 function.</t>
      <section anchor="cmscekhkdfsha256-with-aes-128-gcm" numbered="true" removeInRFC="false" toc="include" pn="section-appendix.b.1">
        <name slugifiedName="name-cms_cek_hkdf_sha256-with-ae">CMS_CEK_HKDF_SHA256 with AES-128-GCM</name>
        <t indent="0" pn="section-appendix.b.1-1">This test vector includes an AlgorithmIdentifier for AES-128-GCM.</t>
        <sourcecode type="test-vectors" markers="false" pn="section-appendix.b.1-2">
IKM = c702e7d0a9e064b09ba55245fb733cf3

The AES-128-GCM AlgorithmIdentifier:
 algorithm=2.16.840.1.101.3.4.1.6
 parameters=GCMParameters:
  aes-nonce=0x5c79058ba2f43447639d29e2
  aes-ICVlen is omitted; it indicates the DEFAULT of 12

DER-encoded AlgorithmIdentifier:
  301b0609608648016503040106300e040c5c79058ba2f43447639d29e2

OKM = 2124ffb29fac4e0fbbc7d5d87492bff3
</sourcecode>
      </section>
      <section anchor="cmscekhkdfsha256-with-aes-128-cbc" numbered="true" removeInRFC="false" toc="include" pn="section-appendix.b.2">
        <name slugifiedName="name-cms_cek_hkdf_sha256-with-aes">CMS_CEK_HKDF_SHA256 with AES-128-CBC</name>
        <t indent="0" pn="section-appendix.b.2-1">This test vector uses includes an AlgorithmIdentifier for AES-128-CBC.</t>
        <sourcecode type="test-vectors" markers="false" pn="section-appendix.b.2-2">
IKM = c702e7d0a9e064b09ba55245fb733cf3

The AES-128-CBC AlgorithmIdentifier:
 algorithm=2.16.840.1.101.3.4.1.2
 parameters=AES-IV=0x651f722ffd512c52fe072e507d72b377

DER-encoded AlgorithmIdentifier:
  301d06096086480165030401020410651f722ffd512c52fe072e507d72b377

OKM = 9cd102c52f1e19ece8729b35bfeceb50
</sourcecode>
      </section>
    </section>
    <section anchor="acknowledgements" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.c">
      <name slugifiedName="name-acknowledgements">Acknowledgements</name>
      <t indent="0" pn="section-appendix.c-1">Thanks to <contact fullname="Mike Ounsworth"/>, <contact fullname="Carl Wallace"/>, and <contact fullname="Joe Mandel"/> their
      careful review and constructive comments.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.d">
      <name slugifiedName="name-authors-address">Author's Address</name>
      <author initials="R." surname="Housley" fullname="Russ Housley">
        <organization abbrev="Vigil Security" showOnFrontPage="true">Vigil Security, LLC</organization>
        <address>
          <postal>
            <city>Herndon</city>
            <region>VA</region>
            <country>United States of America</country>
          </postal>
          <email>housley@vigilsec.com</email>
        </address>
      </author>
    </section>
  </back>
</rfc>
