<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type='text/xsl' href='http://xml2rfc.tools.ietf.org/authoring/rfc2629.xslt' ?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" ipr="trust200902" docName="draft-ietf-cose-typ-header-parameter-05" tocInclude="true" tocDepth="5" symRefs="true" sortRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.20.1 -->
  <front>
    <title>COSE "typ" (type) Header Parameter</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-cose-typ-header-parameter-05"/>
    <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 day="3" month="April" year="2024"/>
    <area>Security</area>
    <workgroup>COSE Working Group</workgroup>
    <keyword>Explicit Typing</keyword>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>
	This specification adds the equivalent of the JSON Object Signing and Encryption (JOSE)
  <tt>typ</tt> (type) header parameter to
	CBOR Object Signing and Encryption (COSE).
	This enables the benefits of explicit typing,
	as defined in the JSON Web Token Best Current Practices BCP,
	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)
	<xref target="RFC7515"/> <xref target="RFC7516"/> specifications.
	However, one way in which COSE does not provide equivalent functionality to JOSE is that
	it does not define an equivalent of the <tt>typ</tt> (type) header parameter,
	which is used for declaring the type of the entire JOSE data structure.
	The security benefits of having <tt>typ</tt> (type) are described in
  Section 3.11 of the JSON Web Token Best Current Practices <xref target="RFC8725"/>,
	which recommends its use for "explicit typing" --
	using <tt>typ</tt> values to distinguish between
	different kinds of JSON Web Tokens (JWTs) <xref target="RFC7519"/>.
      </t>
      <t>
	This specification adds the equivalent of the JOSE <tt>typ</tt> (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 integer CoAP Content-Formats <xref target="IANA.CoAP.ContentFormats"/> values
	and string Media Type <xref target="IANA.MediaTypes"/> values 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 Section 4.2 of <xref target="RFC9052"/>.
      </t>
      <section anchor="rnc">
        <name>Requirements Notation and Conventions</name>
        <t>
	  The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
	  "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
	  "OPTIONAL" in this document are to be interpreted as described in
	  BCP 14 <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 <tt>typ</tt> (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 OPTIONAL.
      </t>
      <t>
	The syntax of this header parameter value is the same as the content type header parameter
	defined in Section 3.1 of <xref target="RFC9052"/>;
	it is either
	an unsigned integer CoAP Content-Formats <xref target="IANA.CoAP.ContentFormats"/> value
	or a string Content Type value.
	Content Type values have a Media Type name <xref target="IANA.MediaTypes"/>
	and MAY include Media Type parameters.
      </t>
      <t>
	This 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 <tt>typ</tt> value
	is a particular application-chosen media type and reject the data structure if it is not.
      </t>
      <t>
  The <tt>typ</tt> parameter MUST NOT be present in unprotected headers.
      </t>
      <t>
  The <tt>typ</tt> 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 Section 3.11 of JSON Web Token Best Current Practices <xref target="RFC8725"/>:
  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>
	  This section registers the following value in the
	  IANA "COSE Header Parameters" registry <xref target="IANA.COSE.HeaderParameters"/>.
        </t>
        <ul spacing="compact">
          <li>
            <t>
	      Name: typ (type)
            </t>
          </li>
          <li>
            <t>
	      Label: TBD (requested assignment 16)
            </t>
          </li>
          <li>
            <t>
	      Value Type: uint / tstr
            </t>
          </li>
          <li>
            <t>
	      Value Registry: <xref target="IANA.CoAP.ContentFormats"/> or <xref target="IANA.MediaTypes"/>
            </t>
          </li>
          <li>
            <t>
	      Description: Type of the complete COSE object
            </t>
          </li>
          <li>
            <t>
	      Reference: <xref target="typ"/> of this specification
            </t>
          </li>
        </ul>
      </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="IANA.COSE.HeaderParameters" target="https://www.iana.org/assignments/cose/cose.xhtml#header-parameters">
          <front>
            <title>COSE Header Parameters</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>
        <reference anchor="IANA.CoAP.ContentFormats" target="https://www.iana.org/assignments/core-parameters/core-parameters.xhtml#content-formats">
          <front>
            <title>CoAP Content-Formats</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
        </reference>
        <reference anchor="IANA.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="History">
      <name>Document History</name>
      <t>
        [[ to be removed by the RFC Editor before publication as an RFC ]]
      </t>
      <t>
        -05
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Addressed Area Director review comments.
          </t>
        </li>
      </ul>
      <t>
        -04
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Addressed SECDIR review comments.
          </t>
        </li>
      </ul>
      <t>
        -03
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Addressed GENART and OPSDIR review comments.
          </t>
        </li>
      </ul>
      <t>
        -02
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Addressed working group last call comments.
          </t>
        </li>
        <li>
          <t>
	    Changed requested assignment from 14 to 16 due to conflict a with new assignment.
          </t>
        </li>
      </ul>
      <t>
        -01
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Added language about media type parameters.
          </t>
        </li>
      </ul>
      <t>
        -00
      </t>
      <ul spacing="normal">
        <li>
          <t>
	    Initial working group version based on draft-jones-cose-typ-header-parameter-01.
          </t>
        </li>
      </ul>
    </section>
    <section anchor="Acknowledgements" numbered="false">
      <name>Acknowledgements</name>
      <t>
	We would like to thank
        Henk Birkholz,
	Carsten Bormann,
	Susan Hares,
	Dan Harkins,
	Murray Kucherawy,
	Marco Tiloca,
	Gunter Van de Velde,
	Éric Vyncke,
	and
	Dale Worley
	for their valuable contributions to this specification.
      </t>
    </section>
  </back>
</rfc>
