<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.1 (Ruby 3.0.2) -->


<!DOCTYPE rfc  [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">

]>


<rfc ipr="trust200902" docName="draft-tschofenig-cose-cek-hkdf-sha256-02" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true">
  <front>
    <title abbrev="Encryption Key Derivation in COSE">Encryption Key Derivation in the COSE using HKDF with SHA-256</title>

    <author initials="H." surname="Tschofenig" fullname="Hannes Tschofenig">
      <organization abbrev="H-BRS">University of Applied Sciences Bonn-Rhein-Sieg</organization>
      <address>
        <email>Hannes.Tschofenig@gmx.net</email>
      </address>
    </author>
    <author initials="R." surname="Housley" fullname="Russ Housley">
      <organization abbrev="Vigil Security">Vigil Security, LLC</organization>
      <address>
        <email>housley@vigilsec.com</email>
      </address>
    </author>
    <author initials="K." surname="Takayama" fullname="Ken Takayama">
      <organization>SECOM CO., LTD.</organization>
      <address>
        <email>ken.takayama.ietf@gmail.com</email>
      </address>
    </author>

    <date year="2024" month="October" day="20"/>

    <area>Security</area>
    <workgroup>COSE</workgroup>
    <keyword>COSE</keyword> <keyword>AEAD Downgrade Attack</keyword>

    <abstract>


<?line 66?>

<t>This document specifies the derivation of the content-encryption key in
CBOR Object Signing and Encryption (COSE). This mechanism protects against
attacks where an attacker manipulates the content-encryption algorithm
identifier.</t>



    </abstract>

    <note title="About This Document" removeInRFC="true">
      <t>
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-tschofenig-cose-cek-hkdf-sha256/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        COSE Working Group mailing list (<eref target="mailto:cose@ietf.org"/>),
        which is archived at <eref target="https://datatracker.ietf.org/wg/cose/about/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/cose/"/>.
      </t>
    </note>


  </front>

  <middle>


<?line 73?>

<section anchor="introduction"><name>Introduction</name>

<t>This document specifies the derivation of the content-encryption key
for COSE. The use of this mechanism provides protection against
where the
attacker manipulates the content-encryption algorithm identifier. This
attack has been demonstrated against CMS and the mitigation can be
found in <xref target="I-D.ietf-lamps-cms-cek-hkdf-sha256"/>.  This attack is generic
and can apply to other protocols with similar characteristics, such as
COSE. However, the attack requires several preconditions:</t>

<t><list style="numbers">
  <t>The attacker intercepts a COSE Encrypt payload an changes the
algorithm identifier to use the same underlying cipher with a different
encryption mode, such as AES-GCM to AES-CBC.</t>
  <t>The attacker converts the intercepted content into a "garbage" COSE
Encrypt payload composed of AES-CBC guess blocks.</t>
  <t>The attacker sends the "garbage" message to the victim, who then
reveals the result of the decryption to the attacker.</t>
  <t>If any of the transformed plaintext blocks match the guess for
that block, then the attacker learns the plaintext for that
block.</t>
</list></t>

<t>With highly structured messages, one block can reveal the only
sensitive part of the original message.</t>

<t>This attack is thwarted if the encryption key depends upon the
delivery of the unmodified algorithm identifier.</t>

<t>The mitigation for this attack has two parts:</t>

<t><list style="symbols">
  <t>Potential recipients include a new parameter, cek-hkdf, in the
outermost protected header of the COSE_Encrypt payload to indicate
support for this mitigation. This parameter <bcp14>MUST</bcp14> use the value true.</t>
  <t>Perform encryption with a derived content-encryption key or
content-authenticated-encryption key. The new CEK' is the result
of deriving a CEK. This key derivation uses the alg parameter
found in the outermost COSE_Encrypt header.</t>
</list></t>

<figure><artwork><![CDATA[
CEK' = HKDF(CEK, COSE_Encrypt.alg)
]]></artwork></figure>

</section>
<section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>

<t>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"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>

<?line -18?>

</section>
<section anchor="updated-encryption-flow-for-each-content-key-distribution-method"><name>Updated Encryption Flow for each Content Key Distribution Method</name>

<t>This section describes the key distribution and encryption flows on sender side.
Only the payload encryption process will be changed with the mitigation.</t>

<t>Some content key distribution methods generate encrypted CEK (eCEK) from randomly generated CEK.
<xref target="_figure-generating-ecek"/> shows that each procedure is NOT changed by the mitigation.</t>

<figure title="eCEK Generation Flow for each Content Key Distribution Method" anchor="_figure-generating-ecek"><artset><artwork  type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="592" width="576" viewBox="0 0 576 592" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px">
<path d="M 128,352 L 128,384" fill="none" stroke="black"/>
<path d="M 144,80 L 144,344" fill="none" stroke="black"/>
<path d="M 168,384 L 168,408" fill="none" stroke="black"/>
<path d="M 200,80 L 200,344" fill="none" stroke="black"/>
<path d="M 216,352 L 216,384" fill="none" stroke="black"/>
<path d="M 336,112 L 336,144" fill="none" stroke="black"/>
<path d="M 336,240 L 336,272" fill="none" stroke="black"/>
<path d="M 336,352 L 336,384" fill="none" stroke="black"/>
<path d="M 360,80 L 360,104" fill="none" stroke="black"/>
<path d="M 360,144 L 360,168" fill="none" stroke="black"/>
<path d="M 360,208 L 360,232" fill="none" stroke="black"/>
<path d="M 360,272 L 360,344" fill="none" stroke="black"/>
<path d="M 376,384 L 376,408" fill="none" stroke="black"/>
<path d="M 400,320 L 400,344" fill="none" stroke="black"/>
<path d="M 416,80 L 416,104" fill="none" stroke="black"/>
<path d="M 424,208 L 424,232" fill="none" stroke="black"/>
<path d="M 424,352 L 424,384" fill="none" stroke="black"/>
<path d="M 440,112 L 440,144" fill="none" stroke="black"/>
<path d="M 440,240 L 440,272" fill="none" stroke="black"/>
<path d="M 472,352 L 472,384" fill="none" stroke="black"/>
<path d="M 488,80 L 488,104" fill="none" stroke="black"/>
<path d="M 488,144 L 488,344" fill="none" stroke="black"/>
<path d="M 504,240 L 504,344" fill="none" stroke="black"/>
<path d="M 512,384 L 512,408" fill="none" stroke="black"/>
<path d="M 544,80 L 544,104" fill="none" stroke="black"/>
<path d="M 544,320 L 544,344" fill="none" stroke="black"/>
<path d="M 560,352 L 560,384" fill="none" stroke="black"/>
<path d="M 136,48 L 152,48" fill="none" stroke="black"/>
<path d="M 192,48 L 208,48" fill="none" stroke="black"/>
<path d="M 352,48 L 368,48" fill="none" stroke="black"/>
<path d="M 408,48 L 424,48" fill="none" stroke="black"/>
<path d="M 480,48 L 496,48" fill="none" stroke="black"/>
<path d="M 536,48 L 552,48" fill="none" stroke="black"/>
<path d="M 136,80 L 152,80" fill="none" stroke="black"/>
<path d="M 192,80 L 208,80" fill="none" stroke="black"/>
<path d="M 352,80 L 368,80" fill="none" stroke="black"/>
<path d="M 408,80 L 424,80" fill="none" stroke="black"/>
<path d="M 480,80 L 496,80" fill="none" stroke="black"/>
<path d="M 536,80 L 552,80" fill="none" stroke="black"/>
<path d="M 336,112 L 440,112" fill="none" stroke="black"/>
<path d="M 480,112 L 552,112" fill="none" stroke="black"/>
<path d="M 336,144 L 440,144" fill="none" stroke="black"/>
<path d="M 480,144 L 552,144" fill="none" stroke="black"/>
<path d="M 344,176 L 376,176" fill="none" stroke="black"/>
<path d="M 416,176 L 432,176" fill="none" stroke="black"/>
<path d="M 528,176 L 544,176" fill="none" stroke="black"/>
<path d="M 344,208 L 376,208" fill="none" stroke="black"/>
<path d="M 416,208 L 432,208" fill="none" stroke="black"/>
<path d="M 528,208 L 544,208" fill="none" stroke="black"/>
<path d="M 336,240 L 440,240" fill="none" stroke="black"/>
<path d="M 336,272 L 440,272" fill="none" stroke="black"/>
<path d="M 392,288 L 408,288" fill="none" stroke="black"/>
<path d="M 536,288 L 552,288" fill="none" stroke="black"/>
<path d="M 392,320 L 408,320" fill="none" stroke="black"/>
<path d="M 536,320 L 552,320" fill="none" stroke="black"/>
<path d="M 128,352 L 216,352" fill="none" stroke="black"/>
<path d="M 336,352 L 424,352" fill="none" stroke="black"/>
<path d="M 472,352 L 560,352" fill="none" stroke="black"/>
<path d="M 128,384 L 216,384" fill="none" stroke="black"/>
<path d="M 336,384 L 424,384" fill="none" stroke="black"/>
<path d="M 472,384 L 560,384" fill="none" stroke="black"/>
<path d="M 160,416 L 184,416" fill="none" stroke="black"/>
<path d="M 368,416 L 392,416" fill="none" stroke="black"/>
<path d="M 504,416 L 528,416" fill="none" stroke="black"/>
<path d="M 160,448 L 184,448" fill="none" stroke="black"/>
<path d="M 368,448 L 392,448" fill="none" stroke="black"/>
<path d="M 504,448 L 528,448" fill="none" stroke="black"/>
<path d="M 136,48 C 127.16936,48 120,55.16936 120,64" fill="none" stroke="black"/>
<path d="M 152,48 C 160.83064,48 168,55.16936 168,64" fill="none" stroke="black"/>
<path d="M 192,48 C 183.16936,48 176,55.16936 176,64" fill="none" stroke="black"/>
<path d="M 208,48 C 216.83064,48 224,55.16936 224,64" fill="none" stroke="black"/>
<path d="M 352,48 C 343.16936,48 336,55.16936 336,64" fill="none" stroke="black"/>
<path d="M 368,48 C 376.83064,48 384,55.16936 384,64" fill="none" stroke="black"/>
<path d="M 408,48 C 399.16936,48 392,55.16936 392,64" fill="none" stroke="black"/>
<path d="M 424,48 C 432.83064,48 440,55.16936 440,64" fill="none" stroke="black"/>
<path d="M 480,48 C 471.16936,48 464,55.16936 464,64" fill="none" stroke="black"/>
<path d="M 496,48 C 504.83064,48 512,55.16936 512,64" fill="none" stroke="black"/>
<path d="M 536,48 C 527.16936,48 520,55.16936 520,64" fill="none" stroke="black"/>
<path d="M 552,48 C 560.83064,48 568,55.16936 568,64" fill="none" stroke="black"/>
<path d="M 136,80 C 127.16936,80 120,72.83064 120,64" fill="none" stroke="black"/>
<path d="M 152,80 C 160.83064,80 168,72.83064 168,64" fill="none" stroke="black"/>
<path d="M 192,80 C 183.16936,80 176,72.83064 176,64" fill="none" stroke="black"/>
<path d="M 208,80 C 216.83064,80 224,72.83064 224,64" fill="none" stroke="black"/>
<path d="M 352,80 C 343.16936,80 336,72.83064 336,64" fill="none" stroke="black"/>
<path d="M 368,80 C 376.83064,80 384,72.83064 384,64" fill="none" stroke="black"/>
<path d="M 408,80 C 399.16936,80 392,72.83064 392,64" fill="none" stroke="black"/>
<path d="M 424,80 C 432.83064,80 440,72.83064 440,64" fill="none" stroke="black"/>
<path d="M 480,80 C 471.16936,80 464,72.83064 464,64" fill="none" stroke="black"/>
<path d="M 496,80 C 504.83064,80 512,72.83064 512,64" fill="none" stroke="black"/>
<path d="M 536,80 C 527.16936,80 520,72.83064 520,64" fill="none" stroke="black"/>
<path d="M 552,80 C 560.83064,80 568,72.83064 568,64" fill="none" stroke="black"/>
<path d="M 480,112 C 471.16936,112 464,119.16936 464,128" fill="none" stroke="black"/>
<path d="M 552,112 C 560.83064,112 568,119.16936 568,128" fill="none" stroke="black"/>
<path d="M 480,144 C 471.16936,144 464,136.83064 464,128" fill="none" stroke="black"/>
<path d="M 552,144 C 560.83064,144 568,136.83064 568,128" fill="none" stroke="black"/>
<path d="M 344,176 C 335.16936,176 328,183.16936 328,192" fill="none" stroke="black"/>
<path d="M 376,176 C 384.83064,176 392,183.16936 392,192" fill="none" stroke="black"/>
<path d="M 416,176 C 407.16936,176 400,183.16936 400,192" fill="none" stroke="black"/>
<path d="M 432,176 C 440.83064,176 448,183.16936 448,192" fill="none" stroke="black"/>
<path d="M 528,176 C 519.16936,176 512,183.16936 512,192" fill="none" stroke="black"/>
<path d="M 544,176 C 552.83064,176 560,183.16936 560,192" fill="none" stroke="black"/>
<path d="M 344,208 C 335.16936,208 328,200.83064 328,192" fill="none" stroke="black"/>
<path d="M 376,208 C 384.83064,208 392,200.83064 392,192" fill="none" stroke="black"/>
<path d="M 416,208 C 407.16936,208 400,200.83064 400,192" fill="none" stroke="black"/>
<path d="M 432,208 C 440.83064,208 448,200.83064 448,192" fill="none" stroke="black"/>
<path d="M 528,208 C 519.16936,208 512,200.83064 512,192" fill="none" stroke="black"/>
<path d="M 544,208 C 552.83064,208 560,200.83064 560,192" fill="none" stroke="black"/>
<path d="M 520,224 C 511.16936,224 504,231.16936 504,240" fill="none" stroke="black"/>
<path d="M 520,224 C 528.83064,224 536,216.83064 536,208" fill="none" stroke="black"/>
<path d="M 392,288 C 383.16936,288 376,295.16936 376,304" fill="none" stroke="black"/>
<path d="M 408,288 C 416.83064,288 424,295.16936 424,304" fill="none" stroke="black"/>
<path d="M 536,288 C 527.16936,288 520,295.16936 520,304" fill="none" stroke="black"/>
<path d="M 552,288 C 560.83064,288 568,295.16936 568,304" fill="none" stroke="black"/>
<path d="M 392,320 C 383.16936,320 376,312.83064 376,304" fill="none" stroke="black"/>
<path d="M 408,320 C 416.83064,320 424,312.83064 424,304" fill="none" stroke="black"/>
<path d="M 536,320 C 527.16936,320 520,312.83064 520,304" fill="none" stroke="black"/>
<path d="M 552,320 C 560.83064,320 568,312.83064 568,304" fill="none" stroke="black"/>
<path d="M 160,416 C 151.16936,416 144,423.16936 144,432" fill="none" stroke="black"/>
<path d="M 184,416 C 192.83064,416 200,423.16936 200,432" fill="none" stroke="black"/>
<path d="M 368,416 C 359.16936,416 352,423.16936 352,432" fill="none" stroke="black"/>
<path d="M 392,416 C 400.83064,416 408,423.16936 408,432" fill="none" stroke="black"/>
<path d="M 504,416 C 495.16936,416 488,423.16936 488,432" fill="none" stroke="black"/>
<path d="M 528,416 C 536.83064,416 544,423.16936 544,432" fill="none" stroke="black"/>
<path d="M 160,448 C 151.16936,448 144,440.83064 144,432" fill="none" stroke="black"/>
<path d="M 184,448 C 192.83064,448 200,440.83064 200,432" fill="none" stroke="black"/>
<path d="M 368,448 C 359.16936,448 352,440.83064 352,432" fill="none" stroke="black"/>
<path d="M 392,448 C 400.83064,448 408,440.83064 408,432" fill="none" stroke="black"/>
<path d="M 504,448 C 495.16936,448 488,440.83064 488,432" fill="none" stroke="black"/>
<path d="M 528,448 C 536.83064,448 544,440.83064 544,432" fill="none" stroke="black"/>
<polygon class="arrowhead" points="552,344 540,338.4 540,349.6 " fill="black" transform="rotate(90,544,344)"/>
<polygon class="arrowhead" points="552,104 540,98.4 540,109.6 " fill="black" transform="rotate(90,544,104)"/>
<polygon class="arrowhead" points="520,408 508,402.4 508,413.6 " fill="black" transform="rotate(90,512,408)"/>
<polygon class="arrowhead" points="512,344 500,338.4 500,349.6 " fill="black" transform="rotate(90,504,344)"/>
<polygon class="arrowhead" points="496,344 484,338.4 484,349.6 " fill="black" transform="rotate(90,488,344)"/>
<polygon class="arrowhead" points="496,104 484,98.4 484,109.6 " fill="black" transform="rotate(90,488,104)"/>
<polygon class="arrowhead" points="432,232 420,226.4 420,237.6 " fill="black" transform="rotate(90,424,232)"/>
<polygon class="arrowhead" points="424,104 412,98.4 412,109.6 " fill="black" transform="rotate(90,416,104)"/>
<polygon class="arrowhead" points="408,344 396,338.4 396,349.6 " fill="black" transform="rotate(90,400,344)"/>
<polygon class="arrowhead" points="384,408 372,402.4 372,413.6 " fill="black" transform="rotate(90,376,408)"/>
<polygon class="arrowhead" points="368,344 356,338.4 356,349.6 " fill="black" transform="rotate(90,360,344)"/>
<polygon class="arrowhead" points="368,232 356,226.4 356,237.6 " fill="black" transform="rotate(90,360,232)"/>
<polygon class="arrowhead" points="368,168 356,162.4 356,173.6 " fill="black" transform="rotate(90,360,168)"/>
<polygon class="arrowhead" points="368,104 356,98.4 356,109.6 " fill="black" transform="rotate(90,360,104)"/>
<polygon class="arrowhead" points="208,344 196,338.4 196,349.6 " fill="black" transform="rotate(90,200,344)"/>
<polygon class="arrowhead" points="176,408 164,402.4 164,413.6 " fill="black" transform="rotate(90,168,408)"/>
<polygon class="arrowhead" points="152,344 140,338.4 140,349.6 " fill="black" transform="rotate(90,144,344)"/>
<g class="text">
<text x="172" y="36">AES-KW</text>
<text x="392" y="36">ECDH+AES-KW</text>
<text x="512" y="36">COSE-HPKE</text>
<text x="144" y="68">PSK</text>
<text x="200" y="68">CEK</text>
<text x="360" y="68">pkR</text>
<text x="416" y="68">skS</text>
<text x="488" y="68">pkR</text>
<text x="544" y="68">skS</text>
<text x="388" y="132">ECDH</text>
<text x="516" y="132">ContextS</text>
<text x="348" y="196">DH</text>
<text x="372" y="196">SS</text>
<text x="424" y="196">CIS</text>
<text x="536" y="196">aad</text>
<text x="388" y="260">HKDF</text>
<text x="400" y="308">CEK</text>
<text x="544" y="308">CEK</text>
<text x="172" y="372">Wrap</text>
<text x="380" y="372">Wrap</text>
<text x="516" y="372">open</text>
<text x="172" y="436">eCEK</text>
<text x="380" y="436">eCEK</text>
<text x="516" y="436">eCEK</text>
<text x="16" y="484">PSK</text>
<text x="56" y="484">:</text>
<text x="80" y="484">Pre</text>
<text x="124" y="484">Shared</text>
<text x="168" y="484">Key</text>
<text x="16" y="500">CEK</text>
<text x="56" y="500">:</text>
<text x="96" y="500">Content</text>
<text x="172" y="500">Encryption</text>
<text x="232" y="500">Key</text>
<text x="16" y="516">pkR</text>
<text x="56" y="516">:</text>
<text x="112" y="516">Recipient's</text>
<text x="188" y="516">Public</text>
<text x="232" y="516">Key</text>
<text x="16" y="532">skS</text>
<text x="56" y="532">:</text>
<text x="96" y="532">(Static</text>
<text x="140" y="532">or</text>
<text x="196" y="532">Ephemeral)</text>
<text x="276" y="532">Sender's</text>
<text x="344" y="532">Private</text>
<text x="392" y="532">Key</text>
<text x="12" y="548">DH</text>
<text x="36" y="548">SS</text>
<text x="56" y="548">:</text>
<text x="104" y="548">DH-Shared</text>
<text x="172" y="548">Secret</text>
<text x="16" y="564">CIS</text>
<text x="56" y="564">:</text>
<text x="84" y="564">COSE</text>
<text x="136" y="564">Context</text>
<text x="216" y="564">Information</text>
<text x="304" y="564">Structure</text>
<text x="20" y="580">eCEK</text>
<text x="56" y="580">:</text>
<text x="104" y="580">Encrypted</text>
<text x="160" y="580">CEK</text>
<text x="196" y="580">into</text>
<text x="236" y="580">COSE</text>
<text x="288" y="580">message</text>
</g>
</svg>
</artwork><artwork  type="ascii-art"><![CDATA[
                  AES-KW                   ECDH+AES-KW     COSE-HPKE
               .---.  .---.               .---.  .---.    .---.  .---.
              | PSK || CEK |             | pkR || skS |  | pkR || skS |
               '-+-'  '-+-'               '-+-'  '-+-'    '-+-'  '-+-'
                 |      |                   v      v        v      v
                 |      |                +------------+   .----------.
                 |      |                |    ECDH    |  |  ContextS  |
                 |      |                +--+---------+   '-+--------'
                 |      |                   v               |
                 |      |                .-----.  .---.     |   .---.
                 |      |               | DH SS || CIS |    |  | aad |
                 |      |                '--+--'  '-+-'     |   '-+-'
                 |      |                   v       v       |  .-'
                 |      |                +------------+     | |
                 |      |                |    HKDF    |     | |
                 |      |                +--+---------+     | |
                 |      |                   |  .---.        | |  .---.
                 |      |                   | | CEK |       | | | CEK |
                 |      |                   |  '-+-'        | |  '-+-'
                 v      v                   v    v          v v    v
               +----------+              +----------+     +----------+
               |   Wrap   |              |   Wrap   |     |   open   |
               +----+-----+              +----+-----+     +----+-----+
                    v                         v                v
                  .----.                    .----.           .----.
                 | eCEK |                  | eCEK |         | eCEK |
                  '----'                    '----'           '----'

PSK   : Pre Shared Key
CEK   : Content Encryption Key
pkR   : Recipient's Public Key
skS   : (Static or Ephemeral) Sender's Private Key
DH SS : DH-Shared Secret
CIS   : COSE Context Information Structure
eCEK  : Encrypted CEK into COSE message
]]></artwork></artset></figure>

<t><xref target="_figure-generating-encrypted-payload"/> shows that the mitigation layer
is inserted just before the encrypting the plaintext payload.
Note that Enc_structure is fed to encryption function (Encrypt) if the COSE_Encrypt.alg is an AEAD.</t>

<figure title="Payload Encryption Flow for each Content Key Distribution Method" anchor="_figure-generating-encrypted-payload"><artset><artwork  type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="608" width="552" viewBox="0 0 552 608" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px">
<path d="M 8,304 L 8,336" fill="none" stroke="black"/>
<path d="M 32,80 L 32,296" fill="none" stroke="black"/>
<path d="M 56,240 L 56,272" fill="none" stroke="black"/>
<path d="M 72,176 L 72,232" fill="none" stroke="black"/>
<path d="M 88,272 L 88,296" fill="none" stroke="black"/>
<path d="M 104,80 L 104,144" fill="none" stroke="black"/>
<path d="M 112,208 L 112,232" fill="none" stroke="black"/>
<path d="M 128,240 L 128,272" fill="none" stroke="black"/>
<path d="M 168,80 L 168,296" fill="none" stroke="black"/>
<path d="M 208,112 L 208,144" fill="none" stroke="black"/>
<path d="M 208,240 L 208,272" fill="none" stroke="black"/>
<path d="M 232,80 L 232,104" fill="none" stroke="black"/>
<path d="M 232,144 L 232,168" fill="none" stroke="black"/>
<path d="M 232,208 L 232,232" fill="none" stroke="black"/>
<path d="M 232,368 L 232,400" fill="none" stroke="black"/>
<path d="M 256,272 L 256,296" fill="none" stroke="black"/>
<path d="M 272,336 L 272,360" fill="none" stroke="black"/>
<path d="M 272,400 L 272,424" fill="none" stroke="black"/>
<path d="M 288,80 L 288,104" fill="none" stroke="black"/>
<path d="M 296,208 L 296,232" fill="none" stroke="black"/>
<path d="M 312,112 L 312,144" fill="none" stroke="black"/>
<path d="M 312,240 L 312,272" fill="none" stroke="black"/>
<path d="M 312,368 L 312,400" fill="none" stroke="black"/>
<path d="M 392,80 L 392,296" fill="none" stroke="black"/>
<path d="M 512,80 L 512,296" fill="none" stroke="black"/>
<path d="M 536,304 L 536,336" fill="none" stroke="black"/>
<path d="M 24,48 L 40,48" fill="none" stroke="black"/>
<path d="M 96,48 L 104,48" fill="none" stroke="black"/>
<path d="M 160,48 L 176,48" fill="none" stroke="black"/>
<path d="M 224,48 L 240,48" fill="none" stroke="black"/>
<path d="M 280,48 L 296,48" fill="none" stroke="black"/>
<path d="M 384,48 L 400,48" fill="none" stroke="black"/>
<path d="M 504,48 L 520,48" fill="none" stroke="black"/>
<path d="M 24,80 L 40,80" fill="none" stroke="black"/>
<path d="M 96,80 L 104,80" fill="none" stroke="black"/>
<path d="M 160,80 L 176,80" fill="none" stroke="black"/>
<path d="M 224,80 L 240,80" fill="none" stroke="black"/>
<path d="M 280,80 L 296,80" fill="none" stroke="black"/>
<path d="M 384,80 L 400,80" fill="none" stroke="black"/>
<path d="M 504,80 L 520,80" fill="none" stroke="black"/>
<path d="M 208,112 L 312,112" fill="none" stroke="black"/>
<path d="M 208,144 L 312,144" fill="none" stroke="black"/>
<path d="M 104,176 L 120,176" fill="none" stroke="black"/>
<path d="M 216,176 L 248,176" fill="none" stroke="black"/>
<path d="M 288,176 L 304,176" fill="none" stroke="black"/>
<path d="M 104,208 L 120,208" fill="none" stroke="black"/>
<path d="M 216,208 L 248,208" fill="none" stroke="black"/>
<path d="M 288,208 L 304,208" fill="none" stroke="black"/>
<path d="M 56,240 L 128,240" fill="none" stroke="black"/>
<path d="M 208,240 L 312,240" fill="none" stroke="black"/>
<path d="M 56,272 L 128,272" fill="none" stroke="black"/>
<path d="M 208,272 L 312,272" fill="none" stroke="black"/>
<path d="M 8,304 L 536,304" fill="none" stroke="black"/>
<path d="M 8,336 L 536,336" fill="none" stroke="black"/>
<path d="M 232,368 L 312,368" fill="none" stroke="black"/>
<path d="M 360,368 L 488,368" fill="none" stroke="black"/>
<path d="M 320,384 L 344,384" fill="none" stroke="black"/>
<path d="M 232,400 L 312,400" fill="none" stroke="black"/>
<path d="M 360,400 L 488,400" fill="none" stroke="black"/>
<path d="M 208,432 L 344,432" fill="none" stroke="black"/>
<path d="M 208,464 L 344,464" fill="none" stroke="black"/>
<path d="M 24,48 C 15.16936,48 8,55.16936 8,64" fill="none" stroke="black"/>
<path d="M 40,48 C 48.83064,48 56,55.16936 56,64" fill="none" stroke="black"/>
<path d="M 96,48 C 87.16936,48 80,55.16936 80,64" fill="none" stroke="black"/>
<path d="M 104,48 C 112.83064,48 120,55.16936 120,64" fill="none" stroke="black"/>
<path d="M 160,48 C 151.16936,48 144,55.16936 144,64" fill="none" stroke="black"/>
<path d="M 176,48 C 184.83064,48 192,55.16936 192,64" fill="none" stroke="black"/>
<path d="M 224,48 C 215.16936,48 208,55.16936 208,64" fill="none" stroke="black"/>
<path d="M 240,48 C 248.83064,48 256,55.16936 256,64" fill="none" stroke="black"/>
<path d="M 280,48 C 271.16936,48 264,55.16936 264,64" fill="none" stroke="black"/>
<path d="M 296,48 C 304.83064,48 312,55.16936 312,64" fill="none" stroke="black"/>
<path d="M 384,48 C 375.16936,48 368,55.16936 368,64" fill="none" stroke="black"/>
<path d="M 400,48 C 408.83064,48 416,55.16936 416,64" fill="none" stroke="black"/>
<path d="M 504,48 C 495.16936,48 488,55.16936 488,64" fill="none" stroke="black"/>
<path d="M 520,48 C 528.83064,48 536,55.16936 536,64" fill="none" stroke="black"/>
<path d="M 24,80 C 15.16936,80 8,72.83064 8,64" fill="none" stroke="black"/>
<path d="M 40,80 C 48.83064,80 56,72.83064 56,64" fill="none" stroke="black"/>
<path d="M 96,80 C 87.16936,80 80,72.83064 80,64" fill="none" stroke="black"/>
<path d="M 104,80 C 112.83064,80 120,72.83064 120,64" fill="none" stroke="black"/>
<path d="M 160,80 C 151.16936,80 144,72.83064 144,64" fill="none" stroke="black"/>
<path d="M 176,80 C 184.83064,80 192,72.83064 192,64" fill="none" stroke="black"/>
<path d="M 224,80 C 215.16936,80 208,72.83064 208,64" fill="none" stroke="black"/>
<path d="M 240,80 C 248.83064,80 256,72.83064 256,64" fill="none" stroke="black"/>
<path d="M 280,80 C 271.16936,80 264,72.83064 264,64" fill="none" stroke="black"/>
<path d="M 296,80 C 304.83064,80 312,72.83064 312,64" fill="none" stroke="black"/>
<path d="M 384,80 C 375.16936,80 368,72.83064 368,64" fill="none" stroke="black"/>
<path d="M 400,80 C 408.83064,80 416,72.83064 416,64" fill="none" stroke="black"/>
<path d="M 504,80 C 495.16936,80 488,72.83064 488,64" fill="none" stroke="black"/>
<path d="M 520,80 C 528.83064,80 536,72.83064 536,64" fill="none" stroke="black"/>
<path d="M 88,160 C 79.16936,160 72,167.16936 72,176" fill="none" stroke="black"/>
<path d="M 88,160 C 96.83064,160 104,152.83064 104,144" fill="none" stroke="black"/>
<path d="M 104,176 C 95.16936,176 88,183.16936 88,192" fill="none" stroke="black"/>
<path d="M 120,176 C 128.83064,176 136,183.16936 136,192" fill="none" stroke="black"/>
<path d="M 216,176 C 207.16936,176 200,183.16936 200,192" fill="none" stroke="black"/>
<path d="M 248,176 C 256.83064,176 264,183.16936 264,192" fill="none" stroke="black"/>
<path d="M 288,176 C 279.16936,176 272,183.16936 272,192" fill="none" stroke="black"/>
<path d="M 304,176 C 312.83064,176 320,183.16936 320,192" fill="none" stroke="black"/>
<path d="M 104,208 C 95.16936,208 88,200.83064 88,192" fill="none" stroke="black"/>
<path d="M 120,208 C 128.83064,208 136,200.83064 136,192" fill="none" stroke="black"/>
<path d="M 216,208 C 207.16936,208 200,200.83064 200,192" fill="none" stroke="black"/>
<path d="M 248,208 C 256.83064,208 264,200.83064 264,192" fill="none" stroke="black"/>
<path d="M 288,208 C 279.16936,208 272,200.83064 272,192" fill="none" stroke="black"/>
<path d="M 304,208 C 312.83064,208 320,200.83064 320,192" fill="none" stroke="black"/>
<path d="M 360,368 C 351.16936,368 344,375.16936 344,384" fill="none" stroke="black"/>
<path d="M 488,368 C 496.83064,368 504,375.16936 504,384" fill="none" stroke="black"/>
<path d="M 360,400 C 351.16936,400 344,392.83064 344,384" fill="none" stroke="black"/>
<path d="M 488,400 C 496.83064,400 504,392.83064 504,384" fill="none" stroke="black"/>
<path d="M 208,432 C 199.16936,432 192,439.16936 192,448" fill="none" stroke="black"/>
<path d="M 344,432 C 352.83064,432 360,439.16936 360,448" fill="none" stroke="black"/>
<path d="M 208,464 C 199.16936,464 192,456.83064 192,448" fill="none" stroke="black"/>
<path d="M 344,464 C 352.83064,464 360,456.83064 360,448" fill="none" stroke="black"/>
<polygon class="arrowhead" points="520,296 508,290.4 508,301.6 " fill="black" transform="rotate(90,512,296)"/>
<polygon class="arrowhead" points="400,296 388,290.4 388,301.6 " fill="black" transform="rotate(90,392,296)"/>
<polygon class="arrowhead" points="328,384 316,378.4 316,389.6 " fill="black" transform="rotate(180,320,384)"/>
<polygon class="arrowhead" points="304,232 292,226.4 292,237.6 " fill="black" transform="rotate(90,296,232)"/>
<polygon class="arrowhead" points="296,104 284,98.4 284,109.6 " fill="black" transform="rotate(90,288,104)"/>
<polygon class="arrowhead" points="280,424 268,418.4 268,429.6 " fill="black" transform="rotate(90,272,424)"/>
<polygon class="arrowhead" points="280,360 268,354.4 268,365.6 " fill="black" transform="rotate(90,272,360)"/>
<polygon class="arrowhead" points="264,296 252,290.4 252,301.6 " fill="black" transform="rotate(90,256,296)"/>
<polygon class="arrowhead" points="240,232 228,226.4 228,237.6 " fill="black" transform="rotate(90,232,232)"/>
<polygon class="arrowhead" points="240,168 228,162.4 228,173.6 " fill="black" transform="rotate(90,232,168)"/>
<polygon class="arrowhead" points="240,104 228,98.4 228,109.6 " fill="black" transform="rotate(90,232,104)"/>
<polygon class="arrowhead" points="176,296 164,290.4 164,301.6 " fill="black" transform="rotate(90,168,296)"/>
<polygon class="arrowhead" points="120,232 108,226.4 108,237.6 " fill="black" transform="rotate(90,112,232)"/>
<polygon class="arrowhead" points="96,296 84,290.4 84,301.6 " fill="black" transform="rotate(90,88,296)"/>
<polygon class="arrowhead" points="80,232 68,226.4 68,237.6 " fill="black" transform="rotate(90,72,232)"/>
<polygon class="arrowhead" points="40,296 28,290.4 28,301.6 " fill="black" transform="rotate(90,32,296)"/>
<g class="text">
<text x="28" y="36">Direct</text>
<text x="100" y="36">Direct+KDF</text>
<text x="172" y="36">AES-KW</text>
<text x="244" y="36">Direct</text>
<text x="292" y="36">ECDH</text>
<text x="392" y="36">ECDH+AES-KW</text>
<text x="512" y="36">COSE-HPKE</text>
<text x="32" y="68">PSK</text>
<text x="100" y="68">SS</text>
<text x="168" y="68">CEK</text>
<text x="232" y="68">pkR</text>
<text x="288" y="68">skS</text>
<text x="392" y="68">CEK</text>
<text x="512" y="68">CEK</text>
<text x="260" y="132">ECDH</text>
<text x="112" y="196">CIS</text>
<text x="220" y="196">DH</text>
<text x="244" y="196">SS</text>
<text x="296" y="196">CIS</text>
<text x="92" y="260">HKDF</text>
<text x="260" y="260">HKDF</text>
<text x="108" y="324">CEK'</text>
<text x="136" y="324">=</text>
<text x="184" y="324">HKDF(CEK,</text>
<text x="296" y="324">COSE_Encrypt.alg)</text>
<text x="412" y="324">[Proposal]</text>
<text x="272" y="388">Encrypt</text>
<text x="392" y="388">Plaintext</text>
<text x="464" y="388">Payload</text>
<text x="240" y="452">Encrypted</text>
<text x="312" y="452">Payload</text>
<text x="16" y="500">PSK</text>
<text x="56" y="500">:</text>
<text x="80" y="500">Pre</text>
<text x="124" y="500">Shared</text>
<text x="168" y="500">Key</text>
<text x="12" y="516">SS</text>
<text x="56" y="516">:</text>
<text x="92" y="516">Shared</text>
<text x="148" y="516">Secret</text>
<text x="16" y="532">CEK</text>
<text x="56" y="532">:</text>
<text x="96" y="532">Content</text>
<text x="172" y="532">Encryption</text>
<text x="232" y="532">Key</text>
<text x="16" y="548">pkR</text>
<text x="56" y="548">:</text>
<text x="96" y="548">(Static</text>
<text x="140" y="548">or</text>
<text x="196" y="548">Ephemeral)</text>
<text x="288" y="548">Recipient's</text>
<text x="364" y="548">Public</text>
<text x="408" y="548">Key</text>
<text x="16" y="564">skS</text>
<text x="56" y="564">:</text>
<text x="100" y="564">Sender's</text>
<text x="168" y="564">Private</text>
<text x="216" y="564">Key</text>
<text x="12" y="580">DH</text>
<text x="36" y="580">SS</text>
<text x="56" y="580">:</text>
<text x="104" y="580">DH-Shared</text>
<text x="172" y="580">Secret</text>
<text x="16" y="596">CIS</text>
<text x="56" y="596">:</text>
<text x="84" y="596">COSE</text>
<text x="136" y="596">Context</text>
<text x="216" y="596">Information</text>
<text x="304" y="596">Structure</text>
</g>
</svg>
</artwork><artwork  type="ascii-art"><![CDATA[
Direct Direct+KDF AES-KW   Direct ECDH     ECDH+AES-KW     COSE-HPKE
 .---.    .--.    .---.   .---.  .---.        .---.          .---.
| PSK |  | SS |  | CEK | | pkR || skS |      | CEK |        | CEK |
 '-+-'    '-+'    '-+-'   '-+-'  '-+-'        '-+-'          '-+-'
   |        |       |       v      v            |              |
   |        |       |    +------------+         |              |
   |        |       |    |    ECDH    |         |              |
   |        |       |    +--+---------+         |              |
   |     .-'        |       v                   |              |
   |    |  .---.    |    .-----.  .---.         |              |
   |    | | CIS |   |   | DH SS || CIS |        |              |
   |    |  '-+-'    |    '--+--'  '-+-'         |              |
   |    v    v      |       v       v           |              |
   |  +--------+    |    +------------+         |              |
   |  |  HKDF  |    |    |    HKDF    |         |              |
   |  +---+----+    |    +-----+------+         |              |
   v      v         v          v                v              v
+-----------------------------------------------------------------+
|          CEK' = HKDF(CEK, COSE_Encrypt.alg) [Proposal]          |
+--------------------------------+--------------------------------+
                                 v
                            +---------+    .-----------------.
                            | Encrypt |<--+ Plaintext Payload |
                            +----+----+    '-----------------'
                                 v
                        .------------------.
                       | Encrypted Payload  |
                        '------------------'

PSK   : Pre Shared Key
SS    : Shared Secret
CEK   : Content Encryption Key
pkR   : (Static or Ephemeral) Recipient's Public Key
skS   : Sender's Private Key
DH SS : DH-Shared Secret
CIS   : COSE Context Information Structure
]]></artwork></artset></figure>

<t>Then the sender creates COSE_Encrypt0 or COSE_Encrypt structure using these parameters if necessary.</t>

<t><list style="symbols">
  <t>layer 0: The content encryption layer
  <list style="symbols">
      <t>protected or unprotected headers
      <list style="symbols">
          <t>content encryption algorithm id</t>
          <t>its parameters such as IV</t>
          <t>cek-hkdf = true</t>
        </list></t>
      <t>encrypted payload</t>
    </list></t>
  <t>layer 1: The content key distribution layer
  <list style="symbols">
      <t>protected or unprotected headers
      <list style="symbols">
          <t>content key distribution method algorithm id</t>
          <t>its parameters such as ephemeral key</t>
          <t>kid</t>
        </list></t>
      <t>eCEK</t>
    </list></t>
</list></t>

<t>TODO: provide an example binary (in appendix?)</t>

</section>
<section anchor="updated-decryption-flow-for-each-content-key-distribution-method"><name>Updated Decryption Flow for Each Content Key Distribution Method</name>

<t>This section describes the decryption flows on recipient side
for each content key distribution method.</t>

<t><xref target="_figure-decrypting-encrypted-payload"/> shows that the mitigation layer
is inserted between the content key distribution methods and content decryption
if the cek-hkdf parameter with true value locates in outer header.
Note that Enc_structure is fed to decryption function (Decrypt) if the COSE_Encrypt.alg is an AEAD.</t>

<figure title="Payload Decryption Flow for each Content Key Distribution Method" anchor="_figure-decrypting-encrypted-payload"><artset><artwork  type="svg"><svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="784" width="576" viewBox="0 0 576 784" class="diagram" text-anchor="middle" font-family="monospace" font-size="13px">
<path d="M 32,80 L 32,408" fill="none" stroke="black"/>
<path d="M 40,480 L 40,512" fill="none" stroke="black"/>
<path d="M 48,240 L 48,272" fill="none" stroke="black"/>
<path d="M 64,176 L 64,232" fill="none" stroke="black"/>
<path d="M 88,272 L 88,408" fill="none" stroke="black"/>
<path d="M 104,80 L 104,144" fill="none" stroke="black"/>
<path d="M 104,208 L 104,232" fill="none" stroke="black"/>
<path d="M 112,352 L 112,384" fill="none" stroke="black"/>
<path d="M 120,240 L 120,272" fill="none" stroke="black"/>
<path d="M 136,288 L 136,344" fill="none" stroke="black"/>
<path d="M 152,384 L 152,408" fill="none" stroke="black"/>
<path d="M 168,80 L 168,256" fill="none" stroke="black"/>
<path d="M 176,320 L 176,344" fill="none" stroke="black"/>
<path d="M 200,352 L 200,384" fill="none" stroke="black"/>
<path d="M 208,112 L 208,144" fill="none" stroke="black"/>
<path d="M 208,240 L 208,272" fill="none" stroke="black"/>
<path d="M 232,80 L 232,104" fill="none" stroke="black"/>
<path d="M 232,144 L 232,168" fill="none" stroke="black"/>
<path d="M 232,208 L 232,232" fill="none" stroke="black"/>
<path d="M 240,544 L 240,576" fill="none" stroke="black"/>
<path d="M 256,272 L 256,408" fill="none" stroke="black"/>
<path d="M 280,448 L 280,472" fill="none" stroke="black"/>
<path d="M 280,512 L 280,536" fill="none" stroke="black"/>
<path d="M 280,576 L 280,600" fill="none" stroke="black"/>
<path d="M 288,80 L 288,104" fill="none" stroke="black"/>
<path d="M 296,208 L 296,232" fill="none" stroke="black"/>
<path d="M 312,112 L 312,144" fill="none" stroke="black"/>
<path d="M 312,240 L 312,272" fill="none" stroke="black"/>
<path d="M 320,544 L 320,576" fill="none" stroke="black"/>
<path d="M 344,112 L 344,144" fill="none" stroke="black"/>
<path d="M 344,240 L 344,272" fill="none" stroke="black"/>
<path d="M 352,352 L 352,384" fill="none" stroke="black"/>
<path d="M 368,80 L 368,104" fill="none" stroke="black"/>
<path d="M 368,144 L 368,168" fill="none" stroke="black"/>
<path d="M 368,208 L 368,232" fill="none" stroke="black"/>
<path d="M 368,272 L 368,344" fill="none" stroke="black"/>
<path d="M 392,384 L 392,408" fill="none" stroke="black"/>
<path d="M 424,80 L 424,104" fill="none" stroke="black"/>
<path d="M 424,320 L 424,344" fill="none" stroke="black"/>
<path d="M 432,208 L 432,232" fill="none" stroke="black"/>
<path d="M 440,352 L 440,384" fill="none" stroke="black"/>
<path d="M 448,112 L 448,144" fill="none" stroke="black"/>
<path d="M 448,240 L 448,272" fill="none" stroke="black"/>
<path d="M 472,352 L 472,384" fill="none" stroke="black"/>
<path d="M 488,80 L 488,104" fill="none" stroke="black"/>
<path d="M 488,144 L 488,344" fill="none" stroke="black"/>
<path d="M 504,240 L 504,344" fill="none" stroke="black"/>
<path d="M 512,384 L 512,408" fill="none" stroke="black"/>
<path d="M 528,480 L 528,512" fill="none" stroke="black"/>
<path d="M 544,80 L 544,104" fill="none" stroke="black"/>
<path d="M 544,320 L 544,344" fill="none" stroke="black"/>
<path d="M 560,352 L 560,384" fill="none" stroke="black"/>
<path d="M 24,48 L 40,48" fill="none" stroke="black"/>
<path d="M 96,48 L 104,48" fill="none" stroke="black"/>
<path d="M 160,48 L 176,48" fill="none" stroke="black"/>
<path d="M 224,48 L 240,48" fill="none" stroke="black"/>
<path d="M 280,48 L 296,48" fill="none" stroke="black"/>
<path d="M 360,48 L 376,48" fill="none" stroke="black"/>
<path d="M 416,48 L 432,48" fill="none" stroke="black"/>
<path d="M 480,48 L 496,48" fill="none" stroke="black"/>
<path d="M 536,48 L 552,48" fill="none" stroke="black"/>
<path d="M 24,80 L 40,80" fill="none" stroke="black"/>
<path d="M 96,80 L 104,80" fill="none" stroke="black"/>
<path d="M 160,80 L 176,80" fill="none" stroke="black"/>
<path d="M 224,80 L 240,80" fill="none" stroke="black"/>
<path d="M 280,80 L 296,80" fill="none" stroke="black"/>
<path d="M 360,80 L 376,80" fill="none" stroke="black"/>
<path d="M 416,80 L 432,80" fill="none" stroke="black"/>
<path d="M 480,80 L 496,80" fill="none" stroke="black"/>
<path d="M 536,80 L 552,80" fill="none" stroke="black"/>
<path d="M 208,112 L 312,112" fill="none" stroke="black"/>
<path d="M 344,112 L 448,112" fill="none" stroke="black"/>
<path d="M 480,112 L 552,112" fill="none" stroke="black"/>
<path d="M 208,144 L 312,144" fill="none" stroke="black"/>
<path d="M 344,144 L 448,144" fill="none" stroke="black"/>
<path d="M 480,144 L 552,144" fill="none" stroke="black"/>
<path d="M 80,160 L 88,160" fill="none" stroke="black"/>
<path d="M 96,176 L 112,176" fill="none" stroke="black"/>
<path d="M 216,176 L 248,176" fill="none" stroke="black"/>
<path d="M 288,176 L 304,176" fill="none" stroke="black"/>
<path d="M 352,176 L 384,176" fill="none" stroke="black"/>
<path d="M 424,176 L 440,176" fill="none" stroke="black"/>
<path d="M 528,176 L 544,176" fill="none" stroke="black"/>
<path d="M 96,208 L 112,208" fill="none" stroke="black"/>
<path d="M 216,208 L 248,208" fill="none" stroke="black"/>
<path d="M 288,208 L 304,208" fill="none" stroke="black"/>
<path d="M 352,208 L 384,208" fill="none" stroke="black"/>
<path d="M 424,208 L 440,208" fill="none" stroke="black"/>
<path d="M 528,208 L 544,208" fill="none" stroke="black"/>
<path d="M 48,240 L 120,240" fill="none" stroke="black"/>
<path d="M 208,240 L 312,240" fill="none" stroke="black"/>
<path d="M 344,240 L 448,240" fill="none" stroke="black"/>
<path d="M 48,272 L 120,272" fill="none" stroke="black"/>
<path d="M 208,272 L 312,272" fill="none" stroke="black"/>
<path d="M 344,272 L 448,272" fill="none" stroke="black"/>
<path d="M 160,288 L 184,288" fill="none" stroke="black"/>
<path d="M 408,288 L 432,288" fill="none" stroke="black"/>
<path d="M 528,288 L 552,288" fill="none" stroke="black"/>
<path d="M 160,320 L 184,320" fill="none" stroke="black"/>
<path d="M 408,320 L 432,320" fill="none" stroke="black"/>
<path d="M 528,320 L 552,320" fill="none" stroke="black"/>
<path d="M 112,352 L 200,352" fill="none" stroke="black"/>
<path d="M 352,352 L 440,352" fill="none" stroke="black"/>
<path d="M 472,352 L 560,352" fill="none" stroke="black"/>
<path d="M 112,384 L 200,384" fill="none" stroke="black"/>
<path d="M 352,384 L 440,384" fill="none" stroke="black"/>
<path d="M 472,384 L 560,384" fill="none" stroke="black"/>
<path d="M 32,416 L 536,416" fill="none" stroke="black"/>
<path d="M 32,448 L 536,448" fill="none" stroke="black"/>
<path d="M 40,480 L 528,480" fill="none" stroke="black"/>
<path d="M 40,512 L 528,512" fill="none" stroke="black"/>
<path d="M 240,544 L 320,544" fill="none" stroke="black"/>
<path d="M 368,544 L 496,544" fill="none" stroke="black"/>
<path d="M 328,560 L 352,560" fill="none" stroke="black"/>
<path d="M 240,576 L 320,576" fill="none" stroke="black"/>
<path d="M 368,576 L 496,576" fill="none" stroke="black"/>
<path d="M 216,608 L 352,608" fill="none" stroke="black"/>
<path d="M 216,640 L 352,640" fill="none" stroke="black"/>
<path d="M 24,48 C 15.16936,48 8,55.16936 8,64" fill="none" stroke="black"/>
<path d="M 40,48 C 48.83064,48 56,55.16936 56,64" fill="none" stroke="black"/>
<path d="M 96,48 C 87.16936,48 80,55.16936 80,64" fill="none" stroke="black"/>
<path d="M 104,48 C 112.83064,48 120,55.16936 120,64" fill="none" stroke="black"/>
<path d="M 160,48 C 151.16936,48 144,55.16936 144,64" fill="none" stroke="black"/>
<path d="M 176,48 C 184.83064,48 192,55.16936 192,64" fill="none" stroke="black"/>
<path d="M 224,48 C 215.16936,48 208,55.16936 208,64" fill="none" stroke="black"/>
<path d="M 240,48 C 248.83064,48 256,55.16936 256,64" fill="none" stroke="black"/>
<path d="M 280,48 C 271.16936,48 264,55.16936 264,64" fill="none" stroke="black"/>
<path d="M 296,48 C 304.83064,48 312,55.16936 312,64" fill="none" stroke="black"/>
<path d="M 360,48 C 351.16936,48 344,55.16936 344,64" fill="none" stroke="black"/>
<path d="M 376,48 C 384.83064,48 392,55.16936 392,64" fill="none" stroke="black"/>
<path d="M 416,48 C 407.16936,48 400,55.16936 400,64" fill="none" stroke="black"/>
<path d="M 432,48 C 440.83064,48 448,55.16936 448,64" fill="none" stroke="black"/>
<path d="M 480,48 C 471.16936,48 464,55.16936 464,64" fill="none" stroke="black"/>
<path d="M 496,48 C 504.83064,48 512,55.16936 512,64" fill="none" stroke="black"/>
<path d="M 536,48 C 527.16936,48 520,55.16936 520,64" fill="none" stroke="black"/>
<path d="M 552,48 C 560.83064,48 568,55.16936 568,64" fill="none" stroke="black"/>
<path d="M 24,80 C 15.16936,80 8,72.83064 8,64" fill="none" stroke="black"/>
<path d="M 40,80 C 48.83064,80 56,72.83064 56,64" fill="none" stroke="black"/>
<path d="M 96,80 C 87.16936,80 80,72.83064 80,64" fill="none" stroke="black"/>
<path d="M 104,80 C 112.83064,80 120,72.83064 120,64" fill="none" stroke="black"/>
<path d="M 160,80 C 151.16936,80 144,72.83064 144,64" fill="none" stroke="black"/>
<path d="M 176,80 C 184.83064,80 192,72.83064 192,64" fill="none" stroke="black"/>
<path d="M 224,80 C 215.16936,80 208,72.83064 208,64" fill="none" stroke="black"/>
<path d="M 240,80 C 248.83064,80 256,72.83064 256,64" fill="none" stroke="black"/>
<path d="M 280,80 C 271.16936,80 264,72.83064 264,64" fill="none" stroke="black"/>
<path d="M 296,80 C 304.83064,80 312,72.83064 312,64" fill="none" stroke="black"/>
<path d="M 360,80 C 351.16936,80 344,72.83064 344,64" fill="none" stroke="black"/>
<path d="M 376,80 C 384.83064,80 392,72.83064 392,64" fill="none" stroke="black"/>
<path d="M 416,80 C 407.16936,80 400,72.83064 400,64" fill="none" stroke="black"/>
<path d="M 432,80 C 440.83064,80 448,72.83064 448,64" fill="none" stroke="black"/>
<path d="M 480,80 C 471.16936,80 464,72.83064 464,64" fill="none" stroke="black"/>
<path d="M 496,80 C 504.83064,80 512,72.83064 512,64" fill="none" stroke="black"/>
<path d="M 536,80 C 527.16936,80 520,72.83064 520,64" fill="none" stroke="black"/>
<path d="M 552,80 C 560.83064,80 568,72.83064 568,64" fill="none" stroke="black"/>
<path d="M 480,112 C 471.16936,112 464,119.16936 464,128" fill="none" stroke="black"/>
<path d="M 552,112 C 560.83064,112 568,119.16936 568,128" fill="none" stroke="black"/>
<path d="M 480,144 C 471.16936,144 464,136.83064 464,128" fill="none" stroke="black"/>
<path d="M 552,144 C 560.83064,144 568,136.83064 568,128" fill="none" stroke="black"/>
<path d="M 80,160 C 71.16936,160 64,167.16936 64,176" fill="none" stroke="black"/>
<path d="M 88,160 C 96.83064,160 104,152.83064 104,144" fill="none" stroke="black"/>
<path d="M 96,176 C 87.16936,176 80,183.16936 80,192" fill="none" stroke="black"/>
<path d="M 112,176 C 120.83064,176 128,183.16936 128,192" fill="none" stroke="black"/>
<path d="M 216,176 C 207.16936,176 200,183.16936 200,192" fill="none" stroke="black"/>
<path d="M 248,176 C 256.83064,176 264,183.16936 264,192" fill="none" stroke="black"/>
<path d="M 288,176 C 279.16936,176 272,183.16936 272,192" fill="none" stroke="black"/>
<path d="M 304,176 C 312.83064,176 320,183.16936 320,192" fill="none" stroke="black"/>
<path d="M 352,176 C 343.16936,176 336,183.16936 336,192" fill="none" stroke="black"/>
<path d="M 384,176 C 392.83064,176 400,183.16936 400,192" fill="none" stroke="black"/>
<path d="M 424,176 C 415.16936,176 408,183.16936 408,192" fill="none" stroke="black"/>
<path d="M 440,176 C 448.83064,176 456,183.16936 456,192" fill="none" stroke="black"/>
<path d="M 528,176 C 519.16936,176 512,183.16936 512,192" fill="none" stroke="black"/>
<path d="M 544,176 C 552.83064,176 560,183.16936 560,192" fill="none" stroke="black"/>
<path d="M 96,208 C 87.16936,208 80,200.83064 80,192" fill="none" stroke="black"/>
<path d="M 112,208 C 120.83064,208 128,200.83064 128,192" fill="none" stroke="black"/>
<path d="M 216,208 C 207.16936,208 200,200.83064 200,192" fill="none" stroke="black"/>
<path d="M 248,208 C 256.83064,208 264,200.83064 264,192" fill="none" stroke="black"/>
<path d="M 288,208 C 279.16936,208 272,200.83064 272,192" fill="none" stroke="black"/>
<path d="M 304,208 C 312.83064,208 320,200.83064 320,192" fill="none" stroke="black"/>
<path d="M 352,208 C 343.16936,208 336,200.83064 336,192" fill="none" stroke="black"/>
<path d="M 384,208 C 392.83064,208 400,200.83064 400,192" fill="none" stroke="black"/>
<path d="M 424,208 C 415.16936,208 408,200.83064 408,192" fill="none" stroke="black"/>
<path d="M 440,208 C 448.83064,208 456,200.83064 456,192" fill="none" stroke="black"/>
<path d="M 528,208 C 519.16936,208 512,200.83064 512,192" fill="none" stroke="black"/>
<path d="M 544,208 C 552.83064,208 560,200.83064 560,192" fill="none" stroke="black"/>
<path d="M 520,224 C 511.16936,224 504,231.16936 504,240" fill="none" stroke="black"/>
<path d="M 520,224 C 528.83064,224 536,216.83064 536,208" fill="none" stroke="black"/>
<path d="M 152,272 C 143.16936,272 136,279.16936 136,288" fill="none" stroke="black"/>
<path d="M 152,272 C 160.83064,272 168,264.83064 168,256" fill="none" stroke="black"/>
<path d="M 160,288 C 151.16936,288 144,295.16936 144,304" fill="none" stroke="black"/>
<path d="M 184,288 C 192.83064,288 200,295.16936 200,304" fill="none" stroke="black"/>
<path d="M 408,288 C 399.16936,288 392,295.16936 392,304" fill="none" stroke="black"/>
<path d="M 432,288 C 440.83064,288 448,295.16936 448,304" fill="none" stroke="black"/>
<path d="M 528,288 C 519.16936,288 512,295.16936 512,304" fill="none" stroke="black"/>
<path d="M 552,288 C 560.83064,288 568,295.16936 568,304" fill="none" stroke="black"/>
<path d="M 160,320 C 151.16936,320 144,312.83064 144,304" fill="none" stroke="black"/>
<path d="M 184,320 C 192.83064,320 200,312.83064 200,304" fill="none" stroke="black"/>
<path d="M 408,320 C 399.16936,320 392,312.83064 392,304" fill="none" stroke="black"/>
<path d="M 432,320 C 440.83064,320 448,312.83064 448,304" fill="none" stroke="black"/>
<path d="M 528,320 C 519.16936,320 512,312.83064 512,304" fill="none" stroke="black"/>
<path d="M 552,320 C 560.83064,320 568,312.83064 568,304" fill="none" stroke="black"/>
<path d="M 32,416 C 23.16936,416 16,423.16936 16,432" fill="none" stroke="black"/>
<path d="M 536,416 C 544.83064,416 552,423.16936 552,432" fill="none" stroke="black"/>
<path d="M 32,448 C 23.16936,448 16,440.83064 16,432" fill="none" stroke="black"/>
<path d="M 536,448 C 544.83064,448 552,440.83064 552,432" fill="none" stroke="black"/>
<path d="M 368,544 C 359.16936,544 352,551.16936 352,560" fill="none" stroke="black"/>
<path d="M 496,544 C 504.83064,544 512,551.16936 512,560" fill="none" stroke="black"/>
<path d="M 368,576 C 359.16936,576 352,568.83064 352,560" fill="none" stroke="black"/>
<path d="M 496,576 C 504.83064,576 512,568.83064 512,560" fill="none" stroke="black"/>
<path d="M 216,608 C 207.16936,608 200,615.16936 200,624" fill="none" stroke="black"/>
<path d="M 352,608 C 360.83064,608 368,615.16936 368,624" fill="none" stroke="black"/>
<path d="M 216,640 C 207.16936,640 200,632.83064 200,624" fill="none" stroke="black"/>
<path d="M 352,640 C 360.83064,640 368,632.83064 368,624" fill="none" stroke="black"/>
<polygon class="arrowhead" points="552,344 540,338.4 540,349.6 " fill="black" transform="rotate(90,544,344)"/>
<polygon class="arrowhead" points="552,104 540,98.4 540,109.6 " fill="black" transform="rotate(90,544,104)"/>
<polygon class="arrowhead" points="520,408 508,402.4 508,413.6 " fill="black" transform="rotate(90,512,408)"/>
<polygon class="arrowhead" points="512,344 500,338.4 500,349.6 " fill="black" transform="rotate(90,504,344)"/>
<polygon class="arrowhead" points="496,344 484,338.4 484,349.6 " fill="black" transform="rotate(90,488,344)"/>
<polygon class="arrowhead" points="496,104 484,98.4 484,109.6 " fill="black" transform="rotate(90,488,104)"/>
<polygon class="arrowhead" points="440,232 428,226.4 428,237.6 " fill="black" transform="rotate(90,432,232)"/>
<polygon class="arrowhead" points="432,344 420,338.4 420,349.6 " fill="black" transform="rotate(90,424,344)"/>
<polygon class="arrowhead" points="432,104 420,98.4 420,109.6 " fill="black" transform="rotate(90,424,104)"/>
<polygon class="arrowhead" points="400,408 388,402.4 388,413.6 " fill="black" transform="rotate(90,392,408)"/>
<polygon class="arrowhead" points="376,344 364,338.4 364,349.6 " fill="black" transform="rotate(90,368,344)"/>
<polygon class="arrowhead" points="376,232 364,226.4 364,237.6 " fill="black" transform="rotate(90,368,232)"/>
<polygon class="arrowhead" points="376,168 364,162.4 364,173.6 " fill="black" transform="rotate(90,368,168)"/>
<polygon class="arrowhead" points="376,104 364,98.4 364,109.6 " fill="black" transform="rotate(90,368,104)"/>
<polygon class="arrowhead" points="336,560 324,554.4 324,565.6 " fill="black" transform="rotate(180,328,560)"/>
<polygon class="arrowhead" points="304,232 292,226.4 292,237.6 " fill="black" transform="rotate(90,296,232)"/>
<polygon class="arrowhead" points="296,104 284,98.4 284,109.6 " fill="black" transform="rotate(90,288,104)"/>
<polygon class="arrowhead" points="288,600 276,594.4 276,605.6 " fill="black" transform="rotate(90,280,600)"/>
<polygon class="arrowhead" points="288,536 276,530.4 276,541.6 " fill="black" transform="rotate(90,280,536)"/>
<polygon class="arrowhead" points="288,472 276,466.4 276,477.6 " fill="black" transform="rotate(90,280,472)"/>
<polygon class="arrowhead" points="264,408 252,402.4 252,413.6 " fill="black" transform="rotate(90,256,408)"/>
<polygon class="arrowhead" points="240,232 228,226.4 228,237.6 " fill="black" transform="rotate(90,232,232)"/>
<polygon class="arrowhead" points="240,168 228,162.4 228,173.6 " fill="black" transform="rotate(90,232,168)"/>
<polygon class="arrowhead" points="240,104 228,98.4 228,109.6 " fill="black" transform="rotate(90,232,104)"/>
<polygon class="arrowhead" points="184,344 172,338.4 172,349.6 " fill="black" transform="rotate(90,176,344)"/>
<polygon class="arrowhead" points="160,408 148,402.4 148,413.6 " fill="black" transform="rotate(90,152,408)"/>
<polygon class="arrowhead" points="144,344 132,338.4 132,349.6 " fill="black" transform="rotate(90,136,344)"/>
<polygon class="arrowhead" points="112,232 100,226.4 100,237.6 " fill="black" transform="rotate(90,104,232)"/>
<polygon class="arrowhead" points="96,408 84,402.4 84,413.6 " fill="black" transform="rotate(90,88,408)"/>
<polygon class="arrowhead" points="72,232 60,226.4 60,237.6 " fill="black" transform="rotate(90,64,232)"/>
<polygon class="arrowhead" points="40,408 28,402.4 28,413.6 " fill="black" transform="rotate(90,32,408)"/>
<g class="text">
<text x="28" y="36">Direct</text>
<text x="100" y="36">Direct+KDF</text>
<text x="172" y="36">AES-KW</text>
<text x="244" y="36">Direct</text>
<text x="292" y="36">ECDH</text>
<text x="392" y="36">ECDH+AES-KW</text>
<text x="512" y="36">COSE-HPKE</text>
<text x="32" y="68">PSK</text>
<text x="100" y="68">SS</text>
<text x="168" y="68">PSK</text>
<text x="232" y="68">pkS</text>
<text x="288" y="68">skR</text>
<text x="368" y="68">pkS</text>
<text x="424" y="68">skR</text>
<text x="488" y="68">pkS</text>
<text x="544" y="68">skR</text>
<text x="260" y="132">ECDH</text>
<text x="396" y="132">ECDH</text>
<text x="516" y="132">ContextR</text>
<text x="104" y="196">CIS</text>
<text x="220" y="196">DH</text>
<text x="244" y="196">SS</text>
<text x="296" y="196">CIS</text>
<text x="356" y="196">DH</text>
<text x="380" y="196">SS</text>
<text x="432" y="196">CIS</text>
<text x="536" y="196">aad</text>
<text x="84" y="260">HKDF</text>
<text x="260" y="260">HKDF</text>
<text x="396" y="260">HKDF</text>
<text x="172" y="308">eCEK</text>
<text x="420" y="308">eCEK</text>
<text x="540" y="308">eCEK</text>
<text x="156" y="372">Unwrap</text>
<text x="396" y="372">Unwrap</text>
<text x="516" y="372">open</text>
<text x="200" y="436">Content</text>
<text x="276" y="436">Encryption</text>
<text x="336" y="436">Key</text>
<text x="376" y="436">(CEK)</text>
<text x="68" y="500">CEK'</text>
<text x="96" y="500">=</text>
<text x="144" y="500">HKDF(CEK,</text>
<text x="256" y="500">COSE_Encrypt.alg)</text>
<text x="340" y="500">if</text>
<text x="388" y="500">cek-hkdf</text>
<text x="468" y="500">[Proposal]</text>
<text x="280" y="564">Decrypt</text>
<text x="400" y="564">Encrypted</text>
<text x="472" y="564">Payload</text>
<text x="248" y="628">Plaintext</text>
<text x="320" y="628">Payload</text>
<text x="16" y="676">PSK</text>
<text x="56" y="676">:</text>
<text x="80" y="676">Pre</text>
<text x="124" y="676">Shared</text>
<text x="168" y="676">Key</text>
<text x="12" y="692">SS</text>
<text x="56" y="692">:</text>
<text x="92" y="692">Shared</text>
<text x="148" y="692">Secret</text>
<text x="16" y="708">pkS</text>
<text x="56" y="708">:</text>
<text x="96" y="708">(Static</text>
<text x="140" y="708">or</text>
<text x="196" y="708">Ephemeral)</text>
<text x="276" y="708">Sender's</text>
<text x="340" y="708">Public</text>
<text x="384" y="708">Key</text>
<text x="16" y="724">skR</text>
<text x="56" y="724">:</text>
<text x="112" y="724">Recipient's</text>
<text x="192" y="724">Private</text>
<text x="240" y="724">Key</text>
<text x="16" y="740">CIS</text>
<text x="56" y="740">:</text>
<text x="84" y="740">COSE</text>
<text x="136" y="740">Context</text>
<text x="216" y="740">Information</text>
<text x="304" y="740">Structure</text>
<text x="12" y="756">DH</text>
<text x="36" y="756">SS</text>
<text x="56" y="756">:</text>
<text x="104" y="756">DH-Shared</text>
<text x="172" y="756">Secret</text>
<text x="20" y="772">eCEK</text>
<text x="56" y="772">:</text>
<text x="104" y="772">Encrypted</text>
<text x="160" y="772">CEK</text>
<text x="188" y="772">in</text>
<text x="220" y="772">COSE</text>
<text x="272" y="772">message</text>
</g>
</svg>
</artwork><artwork  type="ascii-art"><![CDATA[
Direct Direct+KDF AES-KW   Direct ECDH     ECDH+AES-KW     COSE-HPKE
 .---.    .--.    .---.   .---.  .---.     .---.  .---.   .---.  .---.
| PSK |  | SS |  | PSK | | pkS || skR |   | pkS || skR | | pkS || skR |
 '-+-'    '-+'    '-+-'   '-+-'  '-+-'     '-+-'  '-+-'   '-+-'  '-+-'
   |        |       |       v      v         v      v       v      v
   |        |       |    +------------+   +------------+  .----------.
   |        |       |    |    ECDH    |   |    ECDH    | |  ContextR  |
   |        |       |    +--+---------+   +--+---------+  '-+--------'
   |    .--'        |       v                v              |
   |   |  .---.     |    .-----.  .---.   .-----.  .---.    |   .---.
   |   | | CIS |    |   | DH SS || CIS | | DH SS || CIS |   |  | aad |
   |   |  '-+-'     |    '--+--'  '-+-'   '--+--'  '-+-'    |   '-+-'
   |   v    v       |       v       v        v       v      |  .-'
   | +--------+     |    +------------+   +------------+    | |
   | |  HKDF  |     |    |    HKDF    |   |    HKDF    |    | |
   | +----+---+  .-'     +-----+------+   +--+---------+    | |
   |      |     | .----.       |             |   .----.     | | .----.
   |      |     || eCEK |      |             |  | eCEK |    | || eCEK |
   |      |     | '--+-'       |             |   '--+-'     | | '--+-'
   |      |     v    v         |             v      v       v v    v
   |      |  +----------+      |           +----------+   +----------+
   |      |  |  Unwrap  |      |           |  Unwrap  |   |   open   |
   |      |  +----+-----+      |           +----+-----+   +----+-----+
   v      v       v            v                v              v
  .----------------------------------------------------------------.
 |                   Content Encryption Key (CEK)                   |
  '-------------------------------+--------------------------------'
                                  v
    +------------------------------------------------------------+
    | CEK' = HKDF(CEK, COSE_Encrypt.alg) if cek-hkdf [Proposal]  |
    +-----------------------------+------------------------------+
                                  v
                             +---------+    .-----------------.
                             | Decrypt |<--+ Encrypted Payload |
                             +----+----+    '-----------------'
                                  v
                         .------------------.
                        | Plaintext Payload  |
                         '------------------'

PSK   : Pre Shared Key
SS    : Shared Secret
pkS   : (Static or Ephemeral) Sender's Public Key
skR   : Recipient's Private Key
CIS   : COSE Context Information Structure
DH SS : DH-Shared Secret
eCEK  : Encrypted CEK in COSE message
]]></artwork></artset></figure>

</section>
<section anchor="use-of-of-hkdf-with-sha-256-to-derive-encryption-keys"><name>Use of of HKDF with SHA-256 to Derive Encryption Keys</name>

<t>The mitigation uses the HMAC-based Extract-and-Expand Key Derivation
Function (HKDF) <xref target="RFC5869"/> to derive output keying material (OKM) from
input key material (IKM). HKDF is used with the SHA-256 hash
function <xref target="FIPS180"/>.</t>

<t>If an attacker were to change the originator-provided COSE_Encrypt
algorithm identifier then the recipient will derive a different
content-encryption key.</t>

<t>The CEK_HKDF function uses the HKDF-Extract and HKDF-
Expand functions to derive the OKM from the IKM:</t>

<figure><artwork><![CDATA[
Inputs:
  IKM        Input keying material
  alg        COSE_Key algorithm identifier

Output:
  OKM      output keying material (same size as IKM)
]]></artwork></figure>

<t>The output OKM is calculated as follows:</t>

<figure><artwork><![CDATA[
  OKM_SIZE = len(IKM)
  IF OKM_SIZE > 8160 THEN raise error

  salt = "CBOR Object Signing and Encryption"
  PRK = HKDF-Extract(salt, IKM)

  OKM = HKDF-Expand(PRK, alg, OKM_SIZE)
]]></artwork></figure>

</section>
<section anchor="security-considerations"><name>Security Considerations</name>

<t>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>If the attacker removes the cek-hkdf header parameter from the COSE_Encrypt header 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>If the attacker changes the value of the COSE_Encrypt alg parameter 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 algorithm identifer as an input to the key derivation function is sufficient to mitigate the attack described in <xref target="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>Implementations <bcp14>MUST</bcp14> protect the content-encryption keys, this includes 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 additional authenticated data (AAD).</t>

<t>Implementations <bcp14>MUST</bcp14> randomly generate content-encryption keys and content-authenticated-encryption keys. Content key distribution methods are described in Section 8.5 of <xref target="RFC9052"/> and in Section 6 of <xref target="RFC9053"/>. These algorithms define derivation and protection of content-encryption keys.</t>

</section>
<section anchor="iana-considerations"><name>IANA Considerations</name>

<t>IANA is requested to add a new header parameter to the "COSE Common
Header Parameters" established with <xref target="RFC9052"/>.</t>

<figure><artwork><![CDATA[
+-----------+-------+--------------+-------------+------------------+
| Name      | Label | Value Type   | Value       | Description      |
|           |       |              | Registry    |                  |
+-----------+-------+--------------+-------------+------------------+
| cek-hkdf  | TBD   | bool         | N/A         | CEK-HKDF-SHA256  |
+-----------+-------+--------------+-------------+------------------+
]]></artwork></figure>

</section>


  </middle>

  <back>


    <references title='Normative References' anchor="sec-normative-references">



<reference anchor="RFC9052">
  <front>
    <title>CBOR Object Signing and Encryption (COSE): Structures and Process</title>
    <author fullname="J. Schaad" initials="J." surname="Schaad"/>
    <date month="August" year="2022"/>
    <abstract>
      <t>Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size. There is a need to be able to define basic security services for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol. This specification describes how to create and process signatures, message authentication codes, and encryption using CBOR for serialization. This specification additionally describes how to represent cryptographic keys using CBOR.</t>
      <t>This document, along with RFC 9053, obsoletes RFC 8152.</t>
    </abstract>
  </front>
  <seriesInfo name="STD" value="96"/>
  <seriesInfo name="RFC" value="9052"/>
  <seriesInfo name="DOI" value="10.17487/RFC9052"/>
</reference>

<reference anchor="RFC9053">
  <front>
    <title>CBOR Object Signing and Encryption (COSE): Initial Algorithms</title>
    <author fullname="J. Schaad" initials="J." surname="Schaad"/>
    <date month="August" year="2022"/>
    <abstract>
      <t>Concise Binary Object Representation (CBOR) is a data format designed for small code size and small message size. There is a need to be able to define basic security services for this data format. This document defines a set of algorithms that can be used with the CBOR Object Signing and Encryption (COSE) protocol (RFC 9052).</t>
      <t>This document, along with RFC 9052, obsoletes RFC 8152.</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="9053"/>
  <seriesInfo name="DOI" value="10.17487/RFC9053"/>
</reference>

<reference anchor="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>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="FIPS180" target="https://csrc.nist.gov/pubs/fips/180-4/upd1/final">
  <front>
    <title>Secure Hash Standard (SHS), FIPS PUB 180-4</title>
    <author >
      <organization>National Institute of Standards and Technology (NIST)</organization>
    </author>
    <date year="2015" month="August"/>
  </front>
</reference>


<reference anchor="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>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="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>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>




    </references>

    <references title='Informative References' anchor="sec-informative-references">




<reference anchor="I-D.ietf-lamps-cms-cek-hkdf-sha256">
   <front>
      <title>Encryption Key Derivation in the Cryptographic Message Syntax (CMS) using HKDF with SHA-256</title>
      <author fullname="Russ Housley" initials="R." surname="Housley">
         <organization>Vigil Security, LLC</organization>
      </author>
      <date day="19" month="September" year="2024"/>
      <abstract>
	 <t>   This document specifies the derivation of the content-encryption key
   or the content-authenticated-encryption key in the Cryptographic
   Message Syntax (CMS) using HMAC-based Extract-and-Expand Key
   Derivation Function (HKDF) with SHA-256.  The use of this mechanism
   provides protection against where the attacker manipulates the
   content-encryption algorithm identifier or the content-authenticated-
   encryption algorithm identifier.

	 </t>
      </abstract>
   </front>
   <seriesInfo name="Internet-Draft" value="draft-ietf-lamps-cms-cek-hkdf-sha256-05"/>
   
</reference>


<reference anchor="RS2023" target="https://datatracker.ietf.org/meeting/118/materials/slides-118-lamps-attack-against-aead-in-cms">
  <front>
    <title>AEAD-to-CBC Downgrade Attacks on CMS</title>
    <author initials="F." surname="Strenzke" fullname="Falko Strenzke">
      <organization>MTG AG</organization>
    </author>
    <author initials="J." surname="Roth" fullname="Johannes Roth">
      <organization>MTG AG</organization>
    </author>
    <date year="2023" month="November"/>
  </front>
</reference>


    </references>


<?line 373?>

<section anchor="acknowledgments"><name>Acknowledgments</name>

<t>Add your name here.</t>

</section>


  </back>

<!-- ##markdown-source:
H4sIAAAAAAAAA9U7a3PbOJLfVaX/g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