<?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" category="std" ipr="trust200902" docName="draft-ietf-cose-typ-header-parameter-05" number="9596" updates="" obsoletes="" submissionType="IETF" consensus="true" tocInclude="true" tocDepth="5" symRefs="true" sortRefs="true" version="3" xml:lang="en">

  <front>
    <title abbrev='COSE "typ" (type) Header Parameter'>CBOR Object Signing and Encryption (COSE) "typ" (type) Header Parameter</title>
    <seriesInfo name="RFC" value="9596"/>
    <author fullname="Michael B. Jones" initials="M.B." surname="Jones">
      <organization>Self-Issued Consulting</organization>
      <address>
        <email>michael_b_jones@hotmail.com</email>
        <uri>https://self-issued.info/</uri>
      </address>
    </author>
    <author fullname="Orie Steele" initials="O." surname="Steele">
      <organization>Transmute</organization>
      <address>
        <email>orie@transmute.industries</email>
      </address>
    </author>
    <date month="June" year="2024"/>
    <area>SEC</area>
    <workgroup>cose</workgroup>
    <keyword>Explicit Typing</keyword>
    <abstract>
      <t>
	This specification adds the equivalent of the JSON Object Signing and Encryption (JOSE)
  "typ" (type) header parameter to
	CBOR Object Signing and Encryption (COSE).
	This enables the benefits of explicit typing (as defined in RFC 8725, "JSON Web Token Best Current Practices")
	to be brought to COSE objects.
	The syntax of the COSE type header parameter value is the same as the existing COSE content type header parameter.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="Introduction">
      <name>Introduction</name>
      <t>
	CBOR Object Signing and Encryption (COSE) <xref target="RFC9052"/> defines header parameters
	that parallel many of those defined by the JSON Object Signing and Encryption (JOSE) specifications 
	<xref target="RFC7515"/> <xref target="RFC7516"/>.
	However, one way in which COSE does not provide equivalent functionality to JOSE is that
	it does not define an equivalent of the "typ" (type) header parameter,
	which is used for declaring the type of the entire JOSE data structure.
	The security benefits of having "typ" (type) are described in
  <xref target="RFC8725" sectionFormat="of" section="3.11"/>,
	which recommends its use for "explicit typing" --
	using "typ" values to distinguish between
	different kinds of JSON Web Tokens (JWTs) <xref target="RFC7519"/>.
      </t>
      <t>
	This specification adds the equivalent of the JOSE "typ" (type) header parameter to COSE
	so that the benefits of explicit typing
	can be brought to COSE objects.
	The syntax of the COSE type header parameter value is the same as the existing COSE content type header parameter,
	allowing both unsigned integers as registered in the "CoAP Content-Formats" registry <xref target="CoAP.ContentFormats"/> 
	and string media type values <xref target="MediaTypes"/> to be used.
      </t>
      <t>
	The term "COSE object" is used as defined in <xref target="RFC9052"/>.
	An example of a COSE object is a COSE_Sign1 structure,
	as described in <xref target="RFC9052" sectionFormat="of" section="4.2"/>.
      </t>
      <section anchor="rnc">
        <name>Requirements Notation and Conventions</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="typ">
      <name>COSE "typ" (type) Header Parameter</name>
      <t>
	The "typ" (type) header parameter
	is used by COSE applications to declare the
	type of this complete COSE object, as compared to the content type header parameter,
  which declares the type of the COSE object payload.
	This is intended for use by the application when
	more than one kind of COSE object could be present in
	an application data structure that can contain a COSE object;
	the application can use this value to disambiguate among
	the different kinds of COSE objects that might be present.
	It will typically not be used by applications when
	the kind of COSE object is already known.
	Use of this header parameter is <bcp14>OPTIONAL</bcp14>.
      </t>
      <t>
	The syntax of this header parameter value is the same as the content type header parameter
	defined in <xref target="RFC9052" sectionFormat="of" section="3.1"/>;
	it is either
	an unsigned integer as registered in the "CoAP Content-Formats" registry  <xref target="CoAP.ContentFormats"/> 
	or a string content type value.
	Content type values have a media type name <xref target="MediaTypes"/>
	and <bcp14>MAY</bcp14> include media type parameters.
      </t>
      <t>
	The "typ" (type) header parameter is ignored by COSE implementations
	(libraries implementing <xref target="RFC9052"/> and this specification),
	other than being passed through to applications using those implementations.
	Any processing of this parameter is performed by the COSE application
	using application-specific processing rules.
	For instance, an application might verify that the "typ" value
	is a particular application-chosen media type and reject the data structure if it is not.
      </t>
      <t>
  The "typ" parameter <bcp14>MUST NOT</bcp14> be present in unprotected headers.
      </t>
      <t>
  The "typ" parameter does not describe the content of unprotected headers.
  Changes to unprotected headers do not change the type of the COSE object.
      </t>
    </section>
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>
	The case for explicit typing of COSE objects is equivalent to the case made for explicit typing
	in <xref target="RFC8725" section="3.11" sectionFormat="of"/>:
  Explicit typing can prevent confusion between different kinds of COSE objects.
      </t>
      <t>
	COSE applications employing explicit typing should reject COSE objects
	with a type header parameter value different than values that they expect in that application context.
	They should also reject COSE objects without a type header parameter when one is expected.
      </t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <section anchor="cose-algorithms-registrations">
        <name>COSE Header Parameter Registrations</name>
        <t>
	  IANA has registered the following value in the
	  IANA "COSE Header Parameters" registry <xref target="COSE.HeaderParameters"/>.
        </t>

<table anchor="iana-tab">
  <name></name>
  <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>typ (type)</td>
      <td>16</td>
      <td>uint&nbsp;/ tstr</td>
      <td><xref target="CoAP.ContentFormats"/> or <xref        
target="MediaTypes"/> registry</td>
      <td>Content type of the complete COSE object</td>
      <td><xref target="typ"/> of RFC 9596</td>
    </tr>
  </tbody>
</table>
      </section>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <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.8725.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9052.xml"/>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7515.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7516.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7519.xml"/>

        <reference anchor="COSE.HeaderParameters" target="https://www.iana.org/assignments/cose">
          <front>
            <title>COSE Header Parameters</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>

        <reference anchor="CoAP.ContentFormats" target="https://www.iana.org/assignments/core-parameters">
          <front>
            <title>CoAP Content-Formats</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>

        <reference anchor="MediaTypes" target="https://www.iana.org/assignments/media-types">
          <front>
            <title>Media Types</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>

      </references>
    </references>

    <section anchor="Acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>
	We would like to thank
        <contact fullname="Henk Birkholz" />,
<contact fullname="Carsten Bormann" />,
<contact fullname="Susan Hares" />,
<contact fullname="Dan Harkins" />,
<contact fullname="Murray Kucherawy" />,
<contact fullname="Marco Tiloca" />,
<contact fullname="Gunter Van de Velde" />,
<contact fullname="Éric Vyncke" />,
	and
<contact fullname="Dale Worley" />
	for their valuable contributions to this specification.
      </t>
    </section>
  </back>
</rfc>
