CBOR Object Signing and Encryption (COSE) "typ" (type) Header Parameter
Extracted elements (11)
The syntax of the COSE "typ" value intentionally reuses the existing COSE content type header parameter syntax, allowing both CoAP Content-Format unsigned integers and string media type values to be used without introducing new value formats.
The "typ" parameter was added to COSE to provide parity with the JOSE "typ" header parameter, enabling explicit typing as recommended by RFC 8725 (JWT Best Current Practices). COSE previously lacked a mechanism to declare the type of the entire COSE data structure, only the payload type.
The COSE "typ" header parameter is modeled directly on the JOSE "typ" header parameter defined in RFC 7515 (JWS) and RFC 7516 (JWE), enabling consistent explicit typing practices across both JOSE and COSE ecosystems.
Content type string values for the "typ" parameter MAY include media type parameters in addition to the media type name.
The "typ" parameter MUST NOT be present in unprotected headers. It only applies to the complete COSE object and changes to unprotected headers do not change the type of the COSE object.
Use of the "typ" header parameter is OPTIONAL. It will typically not be used by applications when the kind of COSE object is already known.
COSE implementations (libraries) ignore the "typ" header parameter other than passing it through to applications. Any processing of the "typ" parameter is performed by the COSE application using application-specific processing rules, such as verifying that the value matches an expected media type.
The "typ" (type) header parameter declares the type of the complete COSE object, as opposed to the content type header parameter which declares the type of the COSE object payload. It is intended to disambiguate among different kinds of COSE objects that might be present in an application data structure.
IANA has registered the "typ" (type) header parameter in the "COSE Header Parameters" registry with label 16, value type uint/tstr, referencing the CoAP Content-Formats or Media Types registries, describing the content type of the complete COSE object.
Explicit typing via the "typ" header parameter prevents confusion between different kinds of COSE objects. Applications employing explicit typing should reject COSE objects with an unexpected type header parameter value, and should also reject COSE objects without a type header parameter when one is expected.
The value of the "typ" header parameter is either an unsigned integer (uint) registered in the "CoAP Content-Formats" registry or a text string (tstr) content type value. String values have a media type name and MAY include media type parameters. This mirrors the syntax of the COSE content type header parameter defined in RFC 9052 Section 3.1.