<?xml version='1.0' encoding='utf-8'?>

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

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" ipr="trust200902" docName="draft-ietf-cose-cwt-claims-in-headers-10" number="9597" updates="" obsoletes="" submissionType="IETF" consensus="true" category="std" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true">

<front>
  <title abbrev="CWT Claims in COSE Headers">CBOR Web Token (CWT) Claims in COSE Headers</title>
  <seriesInfo name="RFC" value="9597"/>
  <author initials="T." surname="Looker" fullname="Tobias Looker">
    <organization>Mattr</organization>
    <address>
      <email>tobias.looker@mattr.global</email>
    </address>
    </author>
    <author initials="M.B." surname="Jones" fullname="Michael B. Jones">
      <organization>Self-Issued Consulting</organization><address>
      <email>michael_b_jones@hotmail.com</email>
      <uri>https://self-issued.info/</uri>
      </address>
      </author>
      <date year="2024" month="June"/>

      <area>SEC</area>
      <workgroup>cose</workgroup>

<keyword>COSE</keyword>
<keyword>JOSE</keyword>

<abstract>
<t>This document describes how to include CBOR Web Token (CWT) claims in the header parameters of any CBOR Object Signing and Encryption (COSE) structure. This functionality helps to facilitate applications that wish to make use of CWT claims in encrypted COSE structures and/or COSE structures featuring detached signatures, while having some of those claims be available before decryption and/or without inspecting the detached payload.
Another use case is using CWT claims with payloads that are not CWT Claims Sets, including payloads that are not CBOR at all.</t>
</abstract>
</front>
<middle>

<section anchor="introduction"><name>Introduction</name>
<t>In some applications of COSE, it is useful to have a standard representation of CWT claims <xref target="RFC8392"/> available in the header parameters. These include encrypted COSE structures, which may or may not be an encrypted CWT, and/or those featuring a detached signature.
Another use case is using CWT claims with payloads that are not CWT Claims Sets, including payloads that are not CBOR at all.
For instance, an application might want to include an "iss" (issuer) claim in a COSE_Sign1 structure
when the payload being signed is a non-CBOR data structure, such as a bitmap image, and the issuer value is used for key discovery.</t>

<t><xref target="RFC7519" sectionFormat="of" section="5.3"/>, "JSON Web Token (JWT)", defined a similar mechanism for expressing selected JWT-based claims as JSON Object Signing and Encryption (JOSE) header parameters.  This JWT feature was motivated by the desire to have certain claims, such as the Issuer value, be visible to software processing the JWT, even though the JWT is encrypted.  No corresponding feature was standardized for CWTs, which was an omission that this specification corrects.</t>
<t>Directly including CWT claim values as COSE header parameter values would not work, since there are conflicts between the numeric header parameter assignments and the numeric CWT claim assignments.  Instead, this specification defines a single header parameter registered in the IANA "COSE Header Parameters" registry that creates a location to store CWT claims in a COSE header parameter.</t>
<t>This specification does not define how to use CWT claims and their
semantics for particular applications, whether they are in the COSE
payload or the CWT Claims header parameter, or both.
Therefore, understanding how to process the CWT Claims header
parameter requires unambiguously knowing the intended interpretation.
The necessary information about this <bcp14>MAY</bcp14> come from other header parameters.
Unless there already is a natural way of providing this information at
an appropriate level of integrity protection and authentication, a
<bcp14>RECOMMENDED</bcp14> way to include this information in the COSE structure is
use of the "typ" (type) Header Parameter
<xref target="RFC9596"/>.
Other methods for determining the intended interpretation <bcp14>MAY</bcp14> also be used.
Recipients of the CWT Claims header parameter <bcp14>MUST NOT</bcp14> use the
information in the CWT Claims header parameter beyond the integrity
protection or authentication afforded to the CWT Claims header and the
information used to derive its intended interpretation.</t>

<section anchor="requirements-terminology"><name>Requirements Terminology</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&nbsp;14 <xref target="RFC2119"/> <xref
    target="RFC8174"/> when, and only when, they appear in all capitals, as
    shown here.
        </t>
</section>
</section>

<section anchor="representation"><name>Representation</name>
<t>This document defines the following COSE header parameter:</t>

<table anchor="iana-tab">
<thead>
<tr>
<th>Name</th>
<th>Label</th>
<th>Value Type</th>
<th>Value Registry</th>
<th>Description</th>
<th>Reference</th>
</tr>
</thead>

<tbody>
<tr>
<td>CWT Claims</td>
<td>15</td>
<td>map</td>
<td><t>map keys in <xref target="CWT.Claims"/></t></td>
<td>Location for CWT Claims in COSE Header Parameters</td>
<td><xref target="representation"/> of RFC 9597</td>
</tr>
</tbody>
</table><t>The following is a non-normative description for the value type of the CWT claim header parameter using CDDL <xref target="RFC8610"/>.</t>

<sourcecode type="cddl">
<![CDATA[CWT-Claims = {
 * Claim-Label => any
}

Claim-Label = int / text
]]>
</sourcecode>
<t>In cases where CWT claims are present both in the payload and the header of a CWT, an application receiving such a structure <bcp14>MUST</bcp14> verify that their values are identical, unless the application defines other specific processing rules for these claims.</t>
<t>It is <bcp14>RECOMMENDED</bcp14> that the CWT Claims header parameter only be used in a protected header to avoid the contents being malleable. The header parameter <bcp14>MUST</bcp14> only occur once in either the protected or unprotected header of a COSE structure.</t>
<t>The CWT Claims header parameter <bcp14>MAY</bcp14> be used in any COSE object using header parameters, such as COSE_Sign objects.  Its use is not restricted to CWTs.</t>
</section>

<section anchor="privacy-considerations"><name>Privacy Considerations</name>
<t>Some of the registered CWT claims may contain privacy-sensitive information. Since CWT claims in COSE headers are not encrypted, when privacy-sensitive information is present in these claims, applications and protocols using them should ensure that these COSE objects are only made visible to parties for which it is appropriate for them to have access to this sensitive information.</t>
</section>

<section anchor="security-considerations"><name>Security Considerations</name>
<t>Implementers should also review the security considerations for CWT, which are documented in <xref target="RFC8392" sectionFormat="of" section="8"/>.</t>
<t>As described in <xref target="RFC9052"/>, if the COSE payload is transported separately ("detached content"), then it is the responsibility of the application to ensure that it will be transported without changes.</t>

<t>The reason for applications to verify that CWT claims present in both the payload and the header of a CWT are identical, unless they define other specific processing rules for these claims, is to eliminate potential confusion that might arise by having different values for the same claim, which could result in inconsistent processing of such claims.</t>
<t>Processing information in claims prior to validating that their integrity is cryptographically secure can pose security risks.
This is true whether the claims are in the payload or a header parameter.
Implementers must ensure that any tentative decisions made based on previously unverified information are confirmed once the cryptographic processing has been completed.
This includes any information that was used to derive the intended
interpretation of the CWT claims parameter.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>IANA has registered the new COSE header parameter "CWT Claims" defined in 
<xref target="iana-tab"/> in the "COSE Header Parameters" registry <xref target="COSE.HeaderParameters"/>.</t>
</section>

</middle>

<back>
  <references>
    <name>References</name>
    <references>
      <name>Normative References</name>

<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9596.xml"/>
<reference anchor="COSE.HeaderParameters" target="https://www.iana.org/assignments/cose/">
  <front>
    <title>COSE Header Parameters</title>
    <author>
      <organization>IANA</organization>
    </author>
  </front>
</reference>


<reference anchor="CWT.Claims" target="https://www.iana.org/assignments/cwt/">
 <front>
   <title>CBOR Web Token (CWT) Claims</title>
   <author>
     <organization>IANA</organization>
   </author>
 </front>
</reference>

<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8392.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8610.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9052.xml"/>
</references>
</references>


<section anchor="Acknowledgements" numbered="false"><name>Acknowledgements</name>
<t>We would like to thank
<contact fullname="Daisuke Ajitomi"/>,
<contact fullname="Claudio Allocchio"/>,
<contact fullname="Carsten Bormann"/>,
<contact fullname="Laurence Lundblade"/>,
<contact fullname="Ivaylo Petrov"/>,
<contact fullname="Ines Robles"/>,
<contact fullname="Orie Steele"/>,
<contact fullname="Hannes Tschofenig"/>,
<contact fullname="Paul Wouters"/>,
and
<contact fullname="Peter Yee"/>
for their valuable contributions to this specification.</t>
</section>
</back>

</rfc>
