rfc9052.original.xml   rfc9052.xml 
<?xml version='1.0' encoding='utf-8'?> <?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?> <!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent">
<!DOCTYPE rfc SYSTEM "rfc2629-xhtml.ent" [
<!ENTITY RFC8152 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/refere
nce.RFC.8152.xml">
<!ENTITY HkdfSection "5.1">
<!ENTITY SectionDirectKdf "6.1.2">
<!ENTITY SectionECDH "6.3">
]>
<!-- <!ENTITY cose-alg SYSTEM "http://xml.resource.org/public/rfc/bibxml3/refer <!-- draft submitted in xml v3 -->
ence.I-D.schaad-cose-rfc8152bis-algs.xml"> -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" number="9052" docName="draft-iet
f-cose-rfc8152bis-struct-15" obsoletes="8152" updates=""
ipr="trust200902" tocInclude="true" symRefs="true"
sortRefs="true" submissionType="IETF" category="std" consensus="true" xml:lang=
"en" version="3">
<!-- RFC EDITOR <!-- RFC EDITOR
Issue has been raised about countersign vs counter sign. Issue has been raised about countersign vs counter sign.
The dictionaries seem to favor a single word, but when you did RFC 8152 you left it as a double word. The dictionaries seem to favor a single word, but when you did RFC 8152 you left it as a double word.
I have switched to the single word version except for tables 3 and 4 where it ca uses the text file to have long lines. I have switched to the single word version except for tables 3 and 4 where it ca uses the text file to have long lines.
--> -->
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft
-ietf-cose-rfc8152bis-struct-15" category="std" obsoletes="8152" updates="" subm
issionType="IETF" xml:lang="en" version="3" consensus="true">
<!-- xml2rfc v2v3 conversion 2.24.0 --> <!-- xml2rfc v2v3 conversion 2.24.0 -->
<front> <front>
<title abbrev="COSE Structure"> <title abbrev="COSE Structure">
CBOR Object Signing&nbsp;and&nbsp;Encryption&nbsp;(COSE): Structures and Pro CBOR Object Signing and Encryption (COSE): Structures and Process</title>
cess</title> <seriesInfo name="RFC" value="9052"/>
<seriesInfo name="Internet-Draft" value="draft-ietf-cose-rfc8152bis-struct-1 <!-- [rfced] We have assigned a new STD number to this document. Please confirm
5"/> that this is correct. Alternatively, should this document be part of STD 94, a
long with RFC 8949? See the full list of Internet Standards here: https://www.r
fc-editor.org/standards#IS
-->
<seriesInfo name="STD" value="96"/>
<author initials="J." surname="Schaad" fullname="Jim Schaad"> <author initials="J." surname="Schaad" fullname="Jim Schaad">
<organization>August Cellars</organization> <organization>August Cellars</organization>
<address> <address>
<email>ietf@augustcellars.com</email> <email>ietf@augustcellars.com</email>
</address> </address>
</author> </author>
<date/> <date year="2021" month="July" />
<area>Security</area> <area>Security</area>
<workgroup>COSE Working Group</workgroup> <workgroup>COSE Working Group</workgroup>
<!-- [rfced] Please insert any keywords (beyond those that appear in
the title) for use on https://www.rfc-editor.org/search. -->
<keyword>example</keyword>
<abstract> <abstract>
<t>Concise Binary Object Representation (CBOR) is a data format designed f or small code size and small message size. There is a need for the ability to h ave basic security services defined for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol. This specification des cribes how to create and process signatures, message authentication codes, and e ncryption using CBOR for serialization. This specification additionally describ es how to represent cryptographic keys using CBOR. </t> <t>Concise Binary Object Representation (CBOR) is a data format designed f or small code size and small message size. There is a need for the ability to h ave basic security services defined for this data format. This document defines the CBOR Object Signing and Encryption (COSE) protocol. This specification des cribes how to create and process signatures, message authentication codes, and e ncryption using CBOR for serialization. This specification additionally describ es how to represent cryptographic keys using CBOR. </t>
<t> <t>
This document along with <xref target="I-D.ietf-cose-rfc8152bis-algs"/> obsoletes RFC8152. This document, along with RFC 9053, obsoletes RFC 8152.
</t> </t>
</abstract> </abstract>
<note removeInRFC="true">
<name>Contributing to this document</name>
<!-- RFC EDITOR - Please remove this note before publishing -->
<t>
The source for this draft is being maintained in GitHub.
Suggested changes should be submitted as pull requests at <eref target=
"https://github.com/cose-wg/cose-rfc8152bis"/>.
Instructions are on that page as well.
Editorial changes can be managed in GitHub, but any substantial issues n
eed to be discussed on the COSE mailing list.
</t>
</note>
</front> </front>
<middle> <middle>
<section anchor="introduction"> <section anchor="introduction">
<name>Introduction</name> <name>Introduction</name>
<t>There has been an increased focus on small, constrained devices that ma ke up the Internet of Things (IoT). One of the standards that has come out of t his process is "Concise Binary Object Representation (CBOR)" <xref target="I-D.i etf-cbor-7049bis"/>. CBOR extended the data model of the JavaScript Object Nota tion (JSON) <xref target="STD90"/> by allowing for binary data, among other chan ges. CBOR has been adopted by several of the IETF working groups dealing with t he IoT world as their encoding of data structures. CBOR was designed specifical ly both to be small in terms of messages transported and implementation size and to be a schema-free decoder. A need exists to provide message security service s for IoT, and using CBOR as the message-encoding format makes sense. </t> <t>There has been an increased focus on small, constrained devices that ma ke up the Internet of Things (IoT). One of the standards that has come out of t his process is "Concise Binary Object Representation (CBOR)" <xref target="RFC89 49"/>. CBOR extended the data model of the JavaScript Object Notation (JSON) <x ref target="STD90"/> by allowing for binary data, among other changes. CBOR has been adopted by several of the IETF working groups dealing with the IoT world a s their encoding of data structures. CBOR was designed specifically to be small in terms of both messages transported and implementation size and to be a schem a-free decoder. A need exists to provide message security services for IoT, and using CBOR as the message-encoding format makes sense. </t>
<t>The JOSE working group produced a set of documents <xref target="RFC751 5"/> <xref target="RFC7516"/> <xref target="RFC7517"/> <xref target="RFC7518"/> that specified how to process encryption, signatures, and Message Authentication Code (MAC) operations and how to encode keys using JSON. This document defines the CBOR Object Signing and Encryption (COSE) standard, which does the same thi ng for the CBOR encoding format. This document is combined with <xref target="I -D.ietf-cose-rfc8152bis-algs"/> which provides an initial set of algorithms. W hile there is a strong attempt to keep the flavor of the original JSON Object Si gning and Encryption (JOSE) documents, two considerations are taken into account : </t> <t>The JOSE Working Group produced a set of documents <xref target="RFC751 5"/> <xref target="RFC7516"/> <xref target="RFC7517"/> <xref target="RFC7518"/> that specified how to process encryption, signatures, and Message Authentication Code (MAC) operations and how to encode keys using JSON. This document defines the CBOR Object Signing and Encryption (COSE) standard, which does the same thi ng for the CBOR encoding format. This document is combined with <xref target="R FC9053"/>, which provides an initial set of algorithms. While there is a stron g attempt to keep the flavor of the original JSON Object Signing and Encryption (JOSE) documents, two considerations are taken into account:</t>
<ul> <ul>
<li>CBOR has capabilities that are not present in JSON and are appropria te to use. One example of this is the fact that CBOR has a method of encoding b inary directly without first converting it into a base64-encoded text string. < /li> <li>CBOR has capabilities that are not present in JSON and are appropria te to use. One example of this is the fact that CBOR has a method of encoding b inary directly without first converting it into a base64-encoded text string. < /li>
<li>COSE is not a direct copy of the JOSE specification. In the process of creating COSE, decisions that were made for JOSE were re-examined. In many cases, different results were decided on as the criteria were not always the sam e. </li> <li>COSE is not a direct copy of the JOSE specification. In the process of creating COSE, decisions that were made for JOSE were re-examined. In many cases, different results were decided on, as the criteria were not always the sa me. </li>
</ul> </ul>
<t> <t>
This document contains: This document contains:
</t> </t>
<ul> <ul>
<li> <li>
The description of the structure for the CBOR objects which are tran The description of the structure for the CBOR objects that are trans
smitted over the wire. mitted over the wire.
Two objects are defined for each of encryption, signing and message Two objects each are defined for encryption, signing, and message au
authentication. thentication.
One object is defined for transporting keys and one for transporting groups of keys. One object is defined for transporting keys and one for transporting groups of keys.
</li> </li>
<li> <li>
The procedures used to build the inputs to the cryptographic functio ns required for each of the structures. The procedures used to build the inputs to the cryptographic functio ns required for each of the structures.
</li> </li>
<li> <li>
A set of attributes that apply to the different security objects. A set of attributes that apply to the different security objects.
</li> </li>
</ul> </ul>
<t> <t>
This document does not contain the rules and procedures for using specif ic cryptographic algorithms. This document does not contain the rules and procedures for using specif ic cryptographic algorithms.
Details on specific algorithms can be found in <xref target="I-D.ietf-co se-rfc8152bis-algs"/> and <xref target="RFC8230"/>. Details on specific algorithms can be found in <xref target="RFC9053"/> and <xref target="RFC8230"/>.
Details for additional algorithms are expected to be defined in future d ocuments. Details for additional algorithms are expected to be defined in future d ocuments.
</t> </t>
<t> <t>
COSE was initially designed as part of a solution to provide security to Constrained RESTful Environments (CoRE), and this is done using <xref target="R FC8613"/> and <xref target="I-D.ietf-core-groupcomm-bis"/>. COSE was initially designed as part of a solution to provide security to Constrained RESTful Environments (CoRE), and this is done using <xref target="R FC8613"/> and <xref target="I-D.ietf-core-groupcomm-bis"/>.
However, COSE is not restricted to just these cases and can be used in a However, COSE is not restricted to just these cases and can be used in a
ny place where one would consider either JOSE or CMS <xref target="RFC5652"/> fo ny place where one would consider either JOSE or Cryptographic Message Syntax (C
r the purpose of providing security services. MS) <xref target="RFC5652"/> for the purpose of providing security services.
COSE, like JOSE and CMS, is only for use in store and forward or offline COSE, like JOSE and CMS, is only for use in store-and-forward or offline
protocols. protocols.
The use of COSE in online protocols needing encryption, require that an The use of COSE in online protocols needing encryption requires that an
online key establishment process be done before sending objects back and forth. online key establishment process be done before sending objects back and forth.
Any application which uses COSE for security services first needs to det Any application that uses COSE for security services first needs to determine wh
ermine what security services are required and then select the appropriate COSE at security services are required and then select the appropriate COSE structure
structures and cryptographic algorithms based on those needs. s and cryptographic algorithms based on those needs.
<xref target="app-considerations"/> provides additional information on w hat applications need to specify when using COSE. <xref target="app-considerations"/> provides additional information on w hat applications need to specify when using COSE.
</t> </t>
<t> <t>
One feature that is present in CMS that is not present in this standard is a digest structure. One feature that is present in CMS that is not present in this standard is a digest structure.
This omission is deliberate. This omission is deliberate.
It is better for the structure to be defined in each protocol as differe nt protocols will want to include a different set of fields as part of the struc ture. It is better for the structure to be defined in each protocol as differe nt protocols will want to include a different set of fields as part of the struc ture.
While an algorithm identifier and the digest value are going to be commo n to all applications, the two values may not always be adjacent as the algorith m could be defined once with multiple values. While an algorithm identifier and the digest value are going to be commo n to all applications, the two values may not always be adjacent, as the algorit hm could be defined once with multiple values.
Applications may additionally want to define additional data fields as p art of the structure. Applications may additionally want to define additional data fields as p art of the structure.
One such application-specific element would be to include a URI or other pointer to where the data that is being hashed can be obtained. One such application-specific element would be to include a URI or other pointer to where the data that is being hashed can be obtained.
<xref target="I-D.ietf-cose-hash-algs"/> contains one such possible stru cture along with defining a set of digest algorithms. <xref target="RFC9054"/> contains one such possible structure and define s a set of digest algorithms.
</t> </t>
<t> <t>
During the process of advancing COSE to Internet Standard, it was notice During the process of advancing COSE to Internet Standard, it was notice
d the description of the security properties of countersignatures was incorrect d that the description of the security properties of countersignatures was incor
for the COSE_Sign1 structure. rect for the COSE_Sign1 structure.
Since the security properties that were described, those of a true count Since the security properties that were described -- those of a true cou
ersignature, were those that the working group desired, the decision was made to ntersignature -- were those that the working group desired, the decision was mad
remove all of the countersignature text from this document and create a new doc e to remove all of the countersignature text from this document and create a new
ument <xref target="I-D.ietf-cose-countersign"/> to both deprecate the old count document <xref target="I-D.ietf-cose-countersign"/> to both deprecate the old c
ersignature algorithm and header parameters and to define a new algorithm and he ountersignature algorithm and header parameters and define a new algorithm and h
ader parameters with the desired security properties. eader parameters with the desired security properties.
</t> </t>
<section anchor="requirements-terminology"> <section anchor="requirements-terminology">
<name>Requirements Terminology</name> <name>Requirements Terminology</name>
<t> <t>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "S The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQU
HOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in IRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
this document are to be interpreted as described in BCP 14 <xref target="RFC211 NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>
9"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
as shown here. "<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> </t>
</section> </section>
<section> <section>
<name>Changes from RFC8152</name> <name>Changes from RFC 8152</name>
<ul> <ul>
<li> Split the original document into this document and <xref target=" <li>Split the original document into this document and <xref target="R
I-D.ietf-cose-rfc8152bis-algs"/>.</li> FC9053"/>.</li>
<li>Add some text describing why there is no digest structure defined <li>Added some text describing why there is no digest structure define
by COSE.</li> d by COSE.</li>
<li>Text clarifications and changes in terminology.</li> <li>Made text clarifications and changes in terminology.</li>
<li> <li>Removed all of the details relating to countersignatures and place
All of the details relating to countersignatures have been removed a d in <xref target="I-D.ietf-cose-countersign"/>.
nd placed in <xref target="I-D.ietf-cose-countersign"/>.
</li> </li>
</ul> </ul>
</section> </section>
<section anchor="design-changes-from-jose"> <section anchor="design-changes-from-jose">
<name>Design Changes from JOSE</name> <name>Design Changes from JOSE</name>
<ul> <ul>
<li>Define a single overall message structure so that encrypted, signe d, and MACed messages can easily be identified and still have a consistent view. </li> <li>A single overall message structure has been defined so that encryp ted, signed, and MACed messages can easily be identified and still have a consis tent view. </li>
<li>Signed messages distinguish between the protected and unprotected header parameters that relate to the content and those that relate to the signat ure. </li> <li>Signed messages distinguish between the protected and unprotected header parameters that relate to the content and those that relate to the signat ure. </li>
<li>MACed messages are separated from signed messages. </li> <li>MACed messages are separated from signed messages. </li>
<li>MACed messages have the ability to use the same set of recipient a lgorithms as enveloped messages for obtaining the MAC authentication key. </li> <li>MACed messages have the ability to use the same set of recipient a lgorithms as enveloped messages for obtaining the MAC authentication key. </li>
<li>Use binary encodings, rather than base64url encodings, to encode b <li>Binary encodings are used, rather than base64url encodings, to enc
inary data. </li> ode binary data. </li>
<li>Combine the authentication tag for encryption algorithms with the <li>The authentication tag for encryption algorithms has been combined
ciphertext. </li> with the ciphertext. </li>
<li>The set of cryptographic algorithms has been expanded in some dire ctions and trimmed in others. </li> <li>The set of cryptographic algorithms has been expanded in some dire ctions and trimmed in others. </li>
</ul> </ul>
</section> </section>
<section anchor="cbor-grammar"> <section anchor="cbor-grammar">
<name>CBOR Grammar</name> <name>CBOR Grammar</name>
<t> <t>
There was not a standard CBOR grammar available when COSE was original ly written. There was not a standard CBOR grammar available when COSE was original ly written.
For that reason the CBOR data objects defined here are described in pr For that reason, the CBOR data objects defined here are described in p
ose. rose.
Since that time CBOR Data Definition Language (CDDL) <xref target="RFC <!--[rfced] This document expands CDDL as "CBOR Data Definition Language", but t
8610"/> has been published as an RFC. he cited defining document expands the abbreviation as "Concise Data Definition
Language". We have changed the expansion in this document to "Concise" Please le
t us know any objections.
Original:
Since that time CBOR Data Definition
Language (CDDL) [RFC8610] has been published as an RFC.
-->
Since that time, Concise Data Definition Language (CDDL) <xref target=
"RFC8610"/> has been published as an RFC.
The CBOR grammar presented in this document is compatible with CDDL. The CBOR grammar presented in this document is compatible with CDDL.
</t> </t>
<t> <t>
The document was developed by first working on the grammar and then de This document was developed by first working on the grammar and then d
veloping the prose to go with it. eveloping the prose to go with it.
An artifact of this is that the prose was written using the primitive An artifact of this is that the prose was written using the primitive-
type strings defined by CBOR Data Definition Language (CDDL) <xref target="RFC86 type strings defined by Concise Data Definition Language (CDDL) <xref target="RF
10"/>. C8610"/>.
In this specification, the following primitive types are used: In this specification, the following primitive types are used:
</t> </t>
<ul empty="true"> <dl>
<li>any -- non-specific value that permits all CBOR values to be place <dt>any:</dt><dd>A nonspecific value that permits all CBOR values to b
d here.</li> e placed here.</dd>
<li>bool -- a boolean value (true: major type 7, value 21; false: majo <dt>bool:</dt><dd>A boolean value (true: major type 7, value 21; false
r type 7, value 20).</li> : major type 7, value 20).</dd>
<li>bstr -- byte string (major type 2).</li> <dt>bstr:</dt><dd>Byte string (major type 2).</dd>
<li>int -- an unsigned integer or a negative integer.</li> <dt>int:</dt><dd>An unsigned integer or a negative integer.</dd>
<li>nil -- a null value (major type 7, value 22).</li> <dt>nil:</dt><dd>A null value (major type 7, value 22).</dd>
<li>nint -- a negative integer (major type 1).</li> <dt>nint:</dt><dd>A negative integer (major type 1).</dd>
<li>tstr -- a UTF-8 text string (major type 3).</li> <dt>tstr:</dt><dd>A UTF-8 text string (major type 3).</dd>
<li>uint -- an unsigned integer (major type 0).</li> <dt>uint:</dt><dd>An unsigned integer (major type 0).</dd>
</ul> </dl>
<t>Two syntaxes from CDDL appear in this document as shorthand. These a re: <t>Two syntaxes from CDDL appear in this document as shorthand. These a re:
</t> </t>
<ul empty="true"> <dl>
<li>FOO / BAR -- indicates that either FOO or BAR can appear here.</li <dt>FOO / BAR:</dt><dd>Indicates that either FOO or BAR can appear her
> e.</dd>
<li>[+ FOO] -- indicates that the type FOO appears one or more times i <dt>[+ FOO]:</dt><dd>Indicates that the type FOO appears one or more t
n an array.</li> imes in an array.</dd>
<li>* FOO -- indicates that the type FOO appears zero or more times.</ <dt>* FOO:</dt><dd>Indicates that the type FOO appears zero or more ti
li> mes.</dd>
</ul> </dl>
<t> <t>
Two of the constraints defined by CDDL are also used in this document. These are: Two of the constraints defined by CDDL are also used in this document. These are:
</t> </t>
<ul empty="true"> <dl>
<li>type1 .cbor type2 -- indicates that the contents of type1, usually <dt>type1 .cbor type2:</dt><dd>Indicates that the contents of type1, u
bstr, contains a value of type2.</li> sually bstr, contains a value of type2.</dd>
<li>type1 .size integer -- indicates that the contents of type1 is int <dt>type1 .size integer:</dt><dd>Indicates that the contents of type1
eger bytes long</li> is integer bytes long.</dd>
</ul> </dl>
<t> <t>
As well as the prose description, a version of a CBOR grammar is presented in CDDL. As well as the prose description, a version of a CBOR grammar is presented in CDDL.
The CDDL grammar is informational; the prose description is normative. The CDDL grammar is informational; the prose description is normative.
</t> </t>
<t>The collected CDDL can be extracted from the XML version of this docu ment via the following XPath expression below. (Depending on the XPath evaluato r one is using, it may be necessary to deal with &amp;gt; as an entity.) </t> <t>The collected CDDL can be extracted from the XML version of this docu ment via the XPath expression below. (Depending on the XPath evaluator one is us ing, it may be necessary to deal with &amp;gt; as an entity.) </t>
<sourcecode type="XPATH"><![CDATA[ <sourcecode type="XPATH"><![CDATA[
//sourcecode[@type='CDDL']/text() //sourcecode[@type='CDDL']/text()
]]></sourcecode> ]]></sourcecode>
<t>CDDL expects the initial non-terminal symbol to be the first symbol i
n the file. For this reason, the first fragment of CDDL is presented here. </t <t>CDDL expects the initial nonterminal symbol to be the first symbol in
> the file. For this reason, the first fragment of CDDL is presented here. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
start = COSE_Messages / COSE_Key / COSE_KeySet / Internal_Types start = COSE_Messages / COSE_Key / COSE_KeySet / Internal_Types
; This is defined to make the tool quieter: ; This is defined to make the tool quieter:
Internal_Types = Sig_structure / Enc_structure / MAC_structure Internal_Types = Sig_structure / Enc_structure / MAC_structure
]]></sourcecode> ]]></sourcecode>
<t>The non-terminal Internal_Types is defined for dealing with the autom
ated validation tools used during the writing of this document. It references t <t>The nonterminal Internal_Types is defined for dealing with the automa
hose non-terminals that are used for security computations but are not emitted f ted validation tools used during the writing of this document. It references th
or transport. </t> ose nonterminals that are used for security computations but are not emitted for
transport. </t>
</section> </section>
<section anchor="label"> <section anchor="label">
<name>CBOR-Related Terminology</name> <name>CBOR-Related Terminology</name>
<t>In JSON, maps are called objects and only have one kind of map key: a text string. In COSE, we use text strings, negative integers, and unsigned int egers as map keys. The integers are used for compactness of encoding and easy c omparison. The inclusion of text strings allows for an additional range of shor t encoded values to be used as well. Since the word "key" is mainly used in its other meaning, as a cryptographic key, we use the term "label" for this usage a s a map key. </t> <t>In JSON, maps are called objects and only have one kind of map key: a text string. In COSE, we use text strings, negative integers, and unsigned int egers as map keys. The integers are used for compactness of encoding and easy c omparison. The inclusion of text strings allows for an additional range of shor t encoded values to be used as well. Since the word "key" is mainly used in its other meaning, as a cryptographic key, we use the term "label" for this usage a s a map key. </t>
<t> <t>
The presence a label that is neither a text string or an integer, in a CBOR map, is an error. In a CBOR map, the presence a label that is neither a text string nor an integer is an error.
Applications can either fail processing or process messages by ignorin g incorrect labels; however, they <bcp14>MUST NOT</bcp14> create messages with i ncorrect labels. Applications can either fail processing or process messages by ignorin g incorrect labels; however, they <bcp14>MUST NOT</bcp14> create messages with i ncorrect labels.
</t> </t>
<t>A CDDL grammar fragment defines the non-terminal 'label', as in the p revious paragraph, and 'values', which permits any value to be used. </t> <t>A CDDL grammar fragment defines the nonterminal "label", as in the pr evious paragraph, and "values", which permits any value to be used. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
label = int / tstr label = int / tstr
values = any values = any
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section> <section>
<name>Document Terminology</name> <name>Document Terminology</name>
<t>In this document, we use the following terminology: </t> <t>In this document, we use the following terminology: </t>
<t>Byte is a synonym for octet.</t> <t>Byte is a synonym for octet.</t>
<t> <t>
Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use in constrained systems. It is defined in <xref target="RFC7252 "/>. Constrained Application Protocol (CoAP) is a specialized web transfer protocol for use in constrained systems. It is defined in <xref target="RFC7252 "/>.
</t> </t>
<t> <t>
Authenticated Encryption (AE) <xref target="RFC5116"/> algorithms are encryption algorithms that provide an authentication check of the contents with the encryption service. Authenticated Encryption (AE) <xref target="RFC5116"/> algorithms are encryption algorithms that provide an authentication check of the contents with the encryption service.
An example of an AE algorithm used in COSE is AES Key Wrap <xref targe An example of an AE algorithm used in COSE is Advanced Encryption Stan
t="RFC3394"/>. dard (AES) Key Wrap <xref target="RFC3394"/>.
These algorithms are used for key encryption algorithms, but AEAD algo These algorithms are used for key encryption algorithms, but Authentic
rithms would be preferred. ated Encryption with Associated Data (AEAD) algorithms would be preferred.
</t> </t>
<t> <t>
Authenticated Encryption with Associated Data (AEAD) <xref target="RFC AEAD <xref target="RFC5116"/> algorithms provide the same authenticati
5116"/> algorithms provide the same authentication service of the content as AE on service of the content as AE algorithms do.
algorithms do. They also allow associated data that is not part of the encrypted body
They also allow for associated data to be included in the authenticati to be included in the authentication service.
on service, but which is not part of the encrypted body. An example of an AEAD algorithm used in COSE is AES in Galois/Counter
An example of an AEAD algorithm used in COSE is AES-GCM <xref target=" Mode (GCM) <xref target="RFC5116"/>.
RFC5116"/>.
These algorithms are used for content encryption and can be used for k ey encryption as well. These algorithms are used for content encryption and can be used for k ey encryption as well.
</t> </t>
<t> <t>
Context is used throughout the document to represent information that "Context" is used throughout the document to represent information tha
is not part of the COSE message. t is not part of the COSE message.
Information which is part of the context can come from several differe Information that is part of the context can come from several differen
nt sources including: t sources, including
Protocol interactions, associated key structures, and program configur protocol interactions, associated key structures, and program configur
ation. ation.
The context to use can be implicit, identified using the 'kid context' The context to use can be implicit, identified using the "kid context"
header parameter defined in <xref target="RFC8613"/>, or identified by a protoc header parameter defined in <xref target="RFC8613"/>, or identified by a protoc
ol-specific identifier. ol-specific identifier.
Context should generally be included in the cryptographic construction Context should generally be included in the cryptographic construction
; for more details see <xref target="Extern_AAD"/>. ; for more details, see <xref target="Extern_AAD"/>.
</t> </t>
<t>The term 'byte string' is used for sequences of bytes, while the term 'text string' is used for sequences of characters.</t> <t>The term "byte string" is used for sequences of bytes, while the term "text string" is used for sequences of characters.</t>
</section> </section>
</section> </section>
<section anchor="the-cosemsg-structure"> <section anchor="the-cosemsg-structure">
<name>Basic COSE Structure</name> <name>Basic COSE Structure</name>
<t> <t>
The COSE object structure is designed so that there can be a large amoun t of common code when parsing and processing the different types of security mes sages. The COSE object structure is designed so that there can be a large amoun t of common code when parsing and processing the different types of security mes sages.
All of the message structures are built on the CBOR array type. All of the message structures are built on the CBOR array type.
The first three elements of the array always contain the same informatio n: The first three elements of the array always contain the same informatio n:
</t> </t>
<ol type="1"> <ol type="1">
<li>The protected header parameters, encoded and wrapped in a bstr.</li> <li>The protected header parameters, encoded and wrapped in a bstr.</li>
<li>The unprotected header parameters as a map.</li> <li>The unprotected header parameters as a map.</li>
<li> <li>
The content of the message. The content of the message.
The content is either the plaintext or the ciphertext as appropriate The content is either the plaintext or the ciphertext, as appropriat
. e.
The content may be detached (i.e. transported separately from the CO The content may be detached (i.e., transported separately from the C
SE structure), but the location is still used. OSE structure), but the location is still used.
The content is wrapped in a bstr when present and is a nil value whe n detached. The content is wrapped in a bstr when present and is a nil value whe n detached.
</li> </li>
</ol> </ol>
<t> <t>
Elements after this point are dependent on the specific message type. Elements after this point are dependent on the specific message type.
</t> </t>
<t>COSE messages are built using the concept of layers to separate differe nt types of cryptographic concepts. As an example of how this works, consider t he COSE_Encrypt message (<xref target="EnvelopedData"/>). This message type is broken into two layers: the content layer and the recipient layer. The content layer contains the encrypted plaintext and information about the encrypted messa ge. The recipient layer contains the encrypted content encryption key (CEK) and information about how it is encrypted for each recipient. A single layer versi on of the encryption message COSE_Encrypt0 (<xref target="EnvelopedData0"/>) is provided for cases where the CEK is pre-shared.</t> <t>COSE messages are built using the concept of layers to separate differe nt types of cryptographic concepts. As an example of how this works, consider t he COSE_Encrypt message (<xref target="EnvelopedData"/>). This message type is broken into two layers: the content layer and the recipient layer. The content layer contains the encrypted plaintext and information about the encrypted messa ge. The recipient layer contains the encrypted content encryption key (CEK) and information about how it is encrypted for each recipient. A single-layer versi on of the encryption message COSE_Encrypt0 (<xref target="EnvelopedData0"/>) is provided for cases where the CEK is preshared.</t>
<t>Identification of which type of message has been presented is done by t he following methods: <t>Identification of which type of message has been presented is done by t he following methods:
</t> </t>
<ol type="1"> <ol type="1">
<li>The specific message type is known from the context. This may be de fined by a marker in the containing structure or by restrictions specified by th e application protocol. </li> <li>The specific message type is known from the context. This may be de fined by a marker in the containing structure or by restrictions specified by th e application protocol. </li>
<li>The message type is identified by a CBOR tag. Messages with a CBOR tag are known in this specification as tagged messages, while those without the CBOR tag are known as untagged messages. This document defines a CBOR tag for e ach of the message structures. These tags can be found in <xref target="CBOR-Ta gs"/>. </li> <li>The message type is identified by a CBOR tag. Messages with a CBOR tag are known in this specification as tagged messages, while those without the CBOR tag are known as untagged messages. This document defines a CBOR tag for e ach of the message structures. These tags can be found in <xref target="CBOR-Ta gs"/>. </li>
<li> <li>
When a COSE object is carried in a media type of 'application/cose', t When a COSE object is carried in a media type of "application/cose", t
he optional parameter 'cose-type' can be used to identify the embedded object. he optional parameter "cose-type" can be used to identify the embedded object.
The parameter is OPTIONAL if the tagged version of the structure is us The parameter is <bcp14>OPTIONAL</bcp14> if the tagged version of the
ed. structure is used.
The parameter is <bcp14>REQUIRED</bcp14> if the untagged version of th e structure is used. The parameter is <bcp14>REQUIRED</bcp14> if the untagged version of th e structure is used.
The value to use with the parameter for each of the structures can be found in <xref target="CBOR-Tags"/>. The value to use with the parameter for each of the structures can be found in <xref target="CBOR-Tags"/>.
</li> </li>
<li>When a COSE object is carried as a CoAP payload, the CoAP Content-Fo rmat Option can be used to identify the message content. The CoAP Content-Forma t values can be found in <xref target="CoAP_content_type"/>. The CBOR tag for t he message structure is not required as each security message is uniquely identi fied. </li> <li>When a COSE object is carried as a CoAP payload, the CoAP Content-Fo rmat Option can be used to identify the message content. The CoAP Content-Forma t values can be found in <xref target="CoAP_content_type"/>. The CBOR tag for t he message structure is not required, as each security message is uniquely ident ified. </li>
</ol> </ol>
<!--Table 1 -->
<table anchor="CBOR-Tags" align="center"> <table anchor="CBOR-Tags" align="center">
<!-- [rfced] These questions are related to the CBOR Tags registry <https://www.
iana.org/assignments/cbor-tags/> and table 1 in the RFC.
a) Is it correct that cose-type info does not need to appear in the IANA registr
y?
+==========+===============+===============+=======================+
| CBOR Tag | cose-type | Data Item | Semantics |
+==========+===============+===============+=======================+
| 98 | cose-sign | COSE_Sign | COSE Signed Data |
| | | | Object |
| 18 | cose-sign1 | COSE_Sign1 | COSE Single Signer |
| | | | Data Object |
...
b) The order of the tags in table 1 matches what was in RFC 8152. Would you lik
e to reorder them so they appear in sequential order (table 2 would be reordered
as well)?
-->
<name>COSE Message Identification</name> <name>COSE Message Identification</name>
<thead> <thead>
<tr> <tr>
<th>CBOR Tag</th> <th>CBOR Tag</th>
<th>cose-type</th> <th>cose-type</th>
<th>Data Item</th> <th>Data Item</th>
<th>Semantics</th> <th>Semantics</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
skipping to change at line 364 skipping to change at line 381
<th>Encoding</th> <th>Encoding</th>
<th>ID</th> <th>ID</th>
<th>Reference</th> <th>Reference</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>application/cose; cose-type="cose-sign"</td> <td>application/cose; cose-type="cose-sign"</td>
<td/> <td/>
<td>98</td> <td>98</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose; cose-type="cose-sign1"</td> <td>application/cose; cose-type="cose-sign1"</td>
<td/> <td/>
<td>18</td> <td>18</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose; cose-type="cose-encrypt"</td> <td>application/cose; cose-type="cose-encrypt"</td>
<td/> <td/>
<td>96</td> <td>96</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose; cose-type="cose-encrypt0"</td> <td>application/cose; cose-type="cose-encrypt0"</td>
<td/> <td/>
<td>16</td> <td>16</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose; cose-type="cose-mac"</td> <td>application/cose; cose-type="cose-mac"</td>
<td/> <td/>
<td>97</td> <td>97</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose; cose-type="cose-mac0"</td> <td>application/cose; cose-type="cose-mac0"</td>
<td/> <td/>
<td>17</td> <td>17</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose-key</td> <td>application/cose-key</td>
<td/> <td/>
<td>101</td> <td>101</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
<tr> <tr>
<td>application/cose-key-set</td> <td>application/cose-key-set</td>
<td/> <td/>
<td>102</td> <td>102</td>
<td>[[THIS DOCUMENT]]</td> <td>RFC 9052</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<t>The following CDDL fragment identifies all of the top messages defined in this document. Separate non-terminals are defined for the tagged and the unt agged versions of the messages. </t> <t>The following CDDL fragment identifies all of the top messages defined in this document. Separate nonterminals are defined for the tagged and untagged versions of the messages. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message
COSE_Untagged_Message = COSE_Sign / COSE_Sign1 / COSE_Untagged_Message = COSE_Sign / COSE_Sign1 /
COSE_Encrypt / COSE_Encrypt0 / COSE_Encrypt / COSE_Encrypt0 /
COSE_Mac / COSE_Mac0 COSE_Mac / COSE_Mac0
COSE_Tagged_Message = COSE_Sign_Tagged / COSE_Sign1_Tagged / COSE_Tagged_Message = COSE_Sign_Tagged / COSE_Sign1_Tagged /
COSE_Encrypt_Tagged / COSE_Encrypt0_Tagged / COSE_Encrypt_Tagged / COSE_Encrypt0_Tagged /
COSE_Mac_Tagged / COSE_Mac0_Tagged COSE_Mac_Tagged / COSE_Mac0_Tagged
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="header-parameters"> <section anchor="header-parameters">
<name>Header Parameters</name> <name>Header Parameters</name>
<t>The structure of COSE has been designed to have two buckets of informat ion that are not considered to be part of the payload itself, but are used for h olding information about content, algorithms, keys, or evaluation hints for the processing of the layer. These two buckets are available for use in all of the structures except for keys. While these buckets are present, they may not alway s be usable in all instances. For example, while the protected bucket is define d as part of the recipient structure, some of the algorithms used for recipient structures do not provide for authenticated data. If this is the case, the prot ected bucket is left empty. </t> <t>The structure of COSE has been designed to have two buckets of informat ion that are not considered to be part of the payload itself, but are used for h olding information about content, algorithms, keys, or evaluation hints for the processing of the layer. These two buckets are available for use in all of the structures except for keys. While these buckets are present, they may not alway s be usable in all instances. For example, while the protected bucket is define d as part of the recipient structure, some of the algorithms used for recipient structures do not provide for authenticated data. If this is the case, the prot ected bucket is left empty. </t>
<t>Both buckets are implemented as CBOR maps. The map key is a 'label' (< xref target="label"/>). The value portion is dependent on the definition for th e label. Both maps use the same set of label/value pairs. The integer and text string values for labels have been divided into several sections including a st andard range, a private range, and a range that is dependent on the algorithm se lected. The defined labels can be found in the "COSE Header Parameters" IANA re gistry (<xref target="cose-header-key-table"/>). </t> <t>Both buckets are implemented as CBOR maps. The map key is a "label" (< xref target="label"/>). The value portion is dependent on the definition for th e label. Both maps use the same set of label/value pairs. The integer and text -string values for labels have been divided into several sections, including a s tandard range, a private range, and a range that is dependent on the algorithm s elected. The defined labels can be found in the "COSE Header Parameters" IANA r egistry (<xref target="cose-header-key-table"/>). </t>
<t> <t>
The two buckets are: The two buckets are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd> <dd>
<t> <t>
Contains parameters about the current layer that are cryptographical ly protected. Contains parameters about the current layer that are cryptographical ly protected.
This bucket <bcp14>MUST</bcp14> be empty if it is not going to be in cluded in a cryptographic computation. This bucket <bcp14>MUST</bcp14> be empty if it is not going to be in cluded in a cryptographic computation.
This bucket is encoded in the message as a binary object. This bucket is encoded in the message as a binary object.
This value is obtained by CBOR encoding the protected map and wrappi ng it in a bstr object. This value is obtained by CBOR encoding the protected map and wrappi ng it in a bstr object.
Senders <bcp14>SHOULD</bcp14> encode a zero-length map as a zero-len gth byte string rather than as a zero-length map (encoded as h'a0'). Senders <bcp14>SHOULD</bcp14> encode a zero-length map as a zero-len gth byte string rather than as a zero-length map (encoded as h'a0').
The zero-length binary encoding is preferred because it is both shor ter and the version used in the serialization structures for cryptographic compu tation. The zero-length binary encoding is preferred, because it is both sho rter and the version used in the serialization structures for cryptographic comp utation.
Recipients <bcp14>MUST</bcp14> accept both a zero-length byte string and a zero-length map encoded in a byte string. Recipients <bcp14>MUST</bcp14> accept both a zero-length byte string and a zero-length map encoded in a byte string.
</t> </t>
<t> <t>
Wrapping the encoding with a byte string allows for the protected ma p to be transported with a greater chance that it will not be altered accidental ly in transit. Wrapping the encoding with a byte string allows the protected map to be transported with a greater chance that it will not be altered accidentally i n transit.
(Badly behaved intermediates could decode and re-encode, but this wi ll result in a failure to verify unless the re-encoded byte string is identical to the decoded byte string.) (Badly behaved intermediates could decode and re-encode, but this wi ll result in a failure to verify unless the re-encoded byte string is identical to the decoded byte string.)
This avoids the problem of all parties needing to be able to do a co mmon canonical encoding of the map for input to cyprtographic operations. This avoids the problem of all parties needing to be able to do a co mmon canonical encoding of the map for input to crytographic operations.
</t> </t>
</dd> </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>Contains parameters about the current layer that are not cryptograph ically protected. </dd> <dd>Contains parameters about the current layer that are not cryptograph ically protected. </dd>
</dl> </dl>
<t> <t>
Only header parameters that deal with the current layer are to be placed at that layer. As an example of this, the header parameter 'content type' desc ribes the content of the message being carried in the message. As such, this he ader parameter is placed only in the content layer and is not placed in the reci pient or signature layers. In principle, one should be able to process any give n layer without reference to any other layer. With the exception of the COSE_Si gn structure, the only data that needs to cross layers is the cryptographic key. Only header parameters that deal with the current layer are to be placed at that layer. As an example of this, the header parameter "content type" desc ribes the content of the message being carried in the message. As such, this he ader parameter is placed only in the content layer and is not placed in the reci pient or signature layers. In principle, one should be able to process any give n layer without reference to any other layer. With the exception of the COSE_Si gn structure, the only data that needs to cross layers is the cryptographic key.
</t> </t>
<t> <t>
The buckets are present in all of the security objects defined in this d ocument. The fields in order are the 'protected' bucket (as a CBOR 'bstr' type) and then the 'unprotected' bucket (as a CBOR 'map' type). The presence of both buckets is required. The header parameters that go into the buckets come from the IANA "COSE Header Parameters" registry (<xref target="cose-header-key-table" />). The buckets are present in all of the security objects defined in this d ocument. The fields, in order, are the "protected" bucket (as a CBOR "bstr" typ e) and then the "unprotected" bucket (as a CBOR "map" type). The presence of bo th buckets is required. The header parameters that go into the buckets come fro m the IANA "COSE Header Parameters" registry (<xref target="cose-header-key-tabl e"/>).
Some header parameters are defined in the next section. Some header parameters are defined in the next section.
</t> </t>
<t>Labels in each of the maps <bcp14>MUST</bcp14> be unique. When process ing messages, if a label appears multiple times, the message <bcp14>MUST</bcp14> be rejected as malformed. Applications <bcp14>SHOULD</bcp14> verify that the s ame label does not occur in both the protected and unprotected header parameters . If the message is not rejected as malformed, attributes <bcp14>MUST</bcp14> b e obtained from the protected bucket, and only if not found are attributes obta ined from the unprotected bucket. </t> <t>Labels in each of the maps <bcp14>MUST</bcp14> be unique. When process ing messages, if a label appears multiple times, the message <bcp14>MUST</bcp14> be rejected as malformed. Applications <bcp14>SHOULD</bcp14> verify that the s ame label does not occur in both the protected and unprotected header parameters . If the message is not rejected as malformed, attributes <bcp14>MUST</bcp14> b e obtained from the protected bucket, and only if not found are attributes obta ined from the unprotected bucket. </t>
<t>The following CDDL fragment represents the two header parameter buckets . A group "Headers" is defined in CDDL that represents the two buckets in which attributes are placed. This group is used to provide these two fields consiste ntly in all locations. A type is also defined that represents the map of common header parameters. </t> <t>The following CDDL fragment represents the two header-parameter buckets . A group "Headers" is defined in CDDL that represents the two buckets in which attributes are placed. This group is used to provide these two fields consiste ntly in all locations. A type is also defined that represents the map of common header parameters. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
Headers = ( Headers = (
protected : empty_or_serialized_map, protected : empty_or_serialized_map,
unprotected : header_map unprotected : header_map
) )
header_map = { header_map = {
Generic_Headers, Generic_Headers,
* label => values * label => values
} }
empty_or_serialized_map = bstr .cbor header_map / bstr .size 0 empty_or_serialized_map = bstr .cbor header_map / bstr .size 0
]]></sourcecode> ]]></sourcecode>
<section anchor="cose-headers"> <section anchor="cose-headers">
<name>Common COSE Header Parameters</name> <name>Common COSE Header Parameters</name>
<t>This section defines a set of common header parameters. A summary of <t>This section defines a set of common header parameters. A summary of
these header parameters can be found in <xref target="Header-Table"/>. This ta these header parameters can be found in <xref target="Header-Table"/>. This ta
ble should be consulted to determine the value of label and the type of the valu ble should be consulted to determine the value of the label and the type of the
e. </t> value. </t>
<t>The set of header parameters defined in this section are: </t> <t>The set of header parameters defined in this section is as follows: <
/t>
<dl newline="false"> <dl newline="false">
<dt>alg:</dt> <dt>alg:</dt>
<dd> This header parameter is used to indicate the algorithm used for the security processing. This header parameter <bcp14>MUST</bcp14> be authentic ated where the ability to do so exists. This support is provided by AEAD algori thms or construction (e.g. COSE_Sign and COSE_Mac0). This authentication can be done either by placing the header parameter in the protected header parameter b ucket or as part of the externally supplied data <xref target="Extern_AAD"/>). The value is taken from the "COSE Algorithms" registry (see <xref target="COSE.A lgorithms"/>). </dd> <dd>This header parameter is used to indicate the algorithm used for t he security processing. This header parameter <bcp14>MUST</bcp14> be authentica ted where the ability to do so exists. This support is provided by AEAD algorit hms or construction (e.g., COSE_Sign and COSE_Mac0). This authentication can be done either by placing the header parameter in the protected-header-parameter b ucket or as part of the externally supplied data (<xref target="Extern_AAD"/>). The value is taken from the "COSE Algorithms" registry (see <xref target="COSE. Algorithms"/>). </dd>
<dt>crit:</dt> <dt>crit:</dt>
<dd> <dd>
<t> <t>This header parameter is used to indicate which protected header
This header parameter is used to indicate which protected header param parameters an application that is processing a message is required to understand
eters an application that is processing a message is required to understand. .
Header parameters defined in this document do not need to be included Header parameters defined in this document do not need to be included,
as they should be understood by all implementations. as they should be understood by all implementations.
When present, this the 'crit' header parameter <bcp14>MUST</bcp14> be When present, the "crit" header parameter <bcp14>MUST</bcp14> be place
placed in the protected header parameter bucket. d in the protected-header-parameter bucket.
The array <bcp14>MUST</bcp14> have at least one value in it. The array <bcp14>MUST</bcp14> have at least one value in it.
</t> </t>
<t> <t>
Not all header parameter labels need to be included in the 'crit' head er parameter. Not all header-parameter labels need to be included in the "crit" head er parameter.
The rules for deciding which header parameters are placed in the array are: The rules for deciding which header parameters are placed in the array are:
</t> </t>
<ul> <ul>
<li>Integer labels in the range of 0 to 7 <bcp14>SHOULD</bcp14> be omitted.</li> <li>Integer labels in the range of 0 to 7 <bcp14>SHOULD</bcp14> be omitted.</li>
<li> <li>
Integer labels in the range -1 to -128 can be omitted. Integer labels in the range -1 to -128 can be omitted.
Algorithms can assign labels in this range where the ability to process the content of the label is considered to be core to implementing the al gorithm. Algorithms can assign labels in this range where the ability to process the content of the label is considered to be core to implementing the al gorithm.
Algorithms can assign labels outside of this range where the abi Algorithms can assign labels outside of this range where the abi
lity to process the content of the label is not considered to be core, but needs lity to process the content of the label is not considered to be core but needs
to be understood to correctly process this instance. to be understood to correctly process this instance.
Integer labels in the range -129 to -65536 <bcp14>SHOULD</bcp14> Integer labels in the range -129 to -65536 <bcp14>SHOULD</bcp14>
be included as these would be less common header parameters that might not be g be included, as these would be less common header parameters that might not be
enerally supported. generally supported.
</li> </li>
<li>Labels for header parameters required for an application MAY b <li>Labels for header parameters required for an application <bcp1
e omitted. Applications should have a statement if the label can be omitted. < 4>MAY</bcp14> be omitted.
/li> <!--[rfced] Does the second sentence below mean that a statement should exist on
ly if the label can be omitted, or should there be a statement either way?
Original:
Labels for header parameters required for an application MAY be
omitted. Applications should have a statement if the label can
be omitted.
Perhaps 1:
... If the label can be omitted, applications should have a statement to that e
ffect.
Perhaps 2:
Applications should have a statement declaring whether or not the label can be o
mitted.
-->
Applications should have a statement if the label can be omitted. </li>
</ul> </ul>
<t> <t>
The header parameters indicated by 'crit' can be processed by either t he security library code or an application using a security library; the only re quirement is that the header parameter is processed. If the 'crit' value list i ncludes a label for which the header parameter is not in the protected header pa rameters bucket, this is a fatal error in processing the message. The header parameters indicated by "crit" can be processed by either t he security-library code or an application using a security library; the only re quirement is that the header parameter is processed. If the "crit" value list i ncludes a label for which the header parameter is not in the protected-header-pa rameters bucket, this is a fatal error in processing the message.
</t> </t>
</dd> </dd>
<dt>content type:</dt> <dt>content type:</dt>
<dd>This header parameter is used to indicate the content type of the data in the payload or ciphertext fields. Integers are from the "CoAP Content-F ormats" IANA registry table <xref target="COAP.Formats"/>. Text values followin g the syntax of "&lt;type-name&gt;/&lt;subtype-name&gt;" where &lt;type-name&gt; and &lt;subtype-name&gt; are defined in Section 4.2 of <xref target="RFC6838"/> . Leading and trailing whitespace is also omitted. Textual content values alon g with parameters and subparameters can be located using the IANA "Media Types" registry. Applications <bcp14>SHOULD</bcp14> provide this header parameter if t he content structure is potentially ambiguous. </dd> <dd>This header parameter is used to indicate the content type of the data in the "payload" or "ciphertext" fields. Integers are from the "CoAP Conte nt-Formats" IANA registry table <xref target="COAP.Formats"/>. Text values foll ow the syntax of "&lt;type-name&gt;/&lt;subtype-name&gt;", where &lt;type-name&g t; and &lt;subtype-name&gt; are defined in <xref target="RFC6838" sectionFormat= "of" section="4.2"/>. Leading and trailing whitespace is also omitted. Textual content values, along with parameters and subparameters, can be located using t he IANA "Media Types" registry. Applications <bcp14>SHOULD</bcp14> provide this header parameter if the content structure is potentially ambiguous. </dd>
<dt>kid:</dt> <dt>kid:</dt>
<dd>This header parameter identifies one piece of data that can be use d as input to find the needed cryptographic key. The value of this header param eter can be matched against the 'kid' member in a COSE_Key structure. Other met hods of key distribution can define an equivalent field to be matched. Applicat ions <bcp14>MUST NOT</bcp14> assume that 'kid' values are unique. There may be more than one key with the same 'kid' value, so all of the keys associated with this 'kid' may need to be checked. The internal structure of 'kid' values is no t defined and cannot be relied on by applications. Key identifier values are hi nts about which key to use. This is not a security-critical field. For this re ason, it can be placed in the unprotected header parameters bucket. </dd> <dd>This header parameter identifies one piece of data that can be use d as input to find the needed cryptographic key. The value of this header param eter can be matched against the "kid" member in a COSE_Key structure. Other met hods of key distribution can define an equivalent field to be matched. Applicat ions <bcp14>MUST NOT</bcp14> assume that "kid" values are unique. There may be more than one key with the same "kid" value, so all of the keys associated with this "kid" may need to be checked. The internal structure of "kid" values is no t defined and cannot be relied on by applications. Key identifier values are hi nts about which key to use. This is not a security-critical field. For this re ason, it can be placed in the unprotected-header-parameters bucket.</dd>
<dt>IV:</dt> <dt>IV:</dt>
<dd>This header parameter holds the Initialization Vector (IV) value.
For some symmetric encryption algorithms, this may be referred to as a nonce. <dd>This header parameter holds the Initialization Vector (IV) value.
The IV can be placed in the unprotected bucket as modifying the IV will cause th For some symmetric encryption algorithms, this may be referred to as a nonce.
e decryption to yield plaintext that is readily detectable as garbled. </dd> The IV can be placed in the unprotected bucket, as modifying the IV will cause t
he decryption to yield plaintext that is readily detectable as garbled.</dd>
<dt>Partial IV:</dt> <dt>Partial IV:</dt>
<dd> <dd>
<t> <t>
This header parameter holds a part of the IV value. This header parameter holds a part of the IV value.
When using the COSE_Encrypt0 structure, a portion of the IV can be part of the context associated with the key (Context IV) while a portion can be changed wit h each message (Partial IV). When using the COSE_Encrypt0 structure, a portion of the IV can be part of the context associated with the key (Context IV), while a portion can be changed wi th each message (Partial IV).
This field is used to carry a value that causes the IV to be changed for each message. This field is used to carry a value that causes the IV to be changed for each message.
The Partial IV can be placed in the unprotected bucket as modifying the value The Partial IV can be placed in the unprotected bucket, as modifying the value
will cause the decryption to yield plaintext that is readily detectable as garbl will cause the decryption to yield plaintext that is readily detectable as garb
ed. led.
The 'Initialization Vector' and 'Partial Initialization Vector' header paramet The "Initialization Vector" and "Partial Initialization Vector" header paramet
ers <bcp14>MUST NOT</bcp14> both be present in the same security layer. ers <bcp14>MUST NOT</bcp14> both be present in the same security layer.
</t> </t>
<t> <t>
The message IV is generated by the following steps: The message IV is generated by the following steps:
</t> </t>
<ol type="1"> <ol type="1">
<li>Left-pad the Partial IV with zeros to the length of IV (determ ined by the algorithm).</li> <li>Left-pad the Partial IV with zeros to the length of IV (determ ined by the algorithm).</li>
<li>XOR the padded Partial IV with the context IV.</li> <li>XOR the padded Partial IV with the Context IV.</li>
</ol> </ol>
</dd> </dd>
</dl> </dl>
<table anchor="Header-Table" align="center"> <table anchor="Header-Table" align="center">
<name>Common Header Parameters</name> <name>Common Header Parameters</name>
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Label</th> <th>Label</th>
skipping to change at line 591 skipping to change at line 622
</tr> </tr>
<tr> <tr>
<td>Partial IV</td> <td>Partial IV</td>
<td>6</td> <td>6</td>
<td>bstr</td> <td>bstr</td>
<td/> <td/>
<td>Partial Initialization Vector</td> <td>Partial Initialization Vector</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<t>The CDDL fragment that represents the set of header parameters define d in this section is given below. Each of the header parameters is tagged as op tional because they do not need to be in every map; header parameters required i n specific maps are discussed above. </t> <t>The CDDL fragment that represents the set of header parameters define d in this section is given below. Each of the header parameters is tagged as op tional, because they do not need to be in every map; header parameters required in specific maps are discussed above. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
Generic_Headers = ( Generic_Headers = (
? 1 => int / tstr, ; algorithm identifier ? 1 => int / tstr, ; algorithm identifier
? 2 => [+label], ; criticality ? 2 => [+label], ; criticality
? 3 => tstr / int, ; content type ? 3 => tstr / int, ; content type
? 4 => bstr, ; key identifier ? 4 => bstr, ; key identifier
? 5 => bstr, ; IV ? 5 => bstr, ; IV
? 6 => bstr ; Partial IV ? 6 => bstr ; Partial IV
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
</section> </section>
<section anchor="signing-structure"> <section anchor="signing-structure">
<name>Signing Objects</name> <name>Signing Objects</name>
<t>COSE supports two different signature structures. COSE_Sign allows for one or more signatures to be applied to the same content. COSE_Sign1 is restric ted to a single signer. The structures cannot be converted between each other; as the signature computation includes a parameter identifying which structure is being used, the converted structure will fail signature validation. </t> <t>COSE supports two different signature structures. COSE_Sign allows for one or more signatures to be applied to the same content. COSE_Sign1 is restric ted to a single signer. The structures cannot be converted between each other; as the signature computation includes a parameter identifying which structure is being used, the converted structure will fail signature validation. </t>
<section anchor="full-signature"> <section anchor="full-signature">
<name>Signing with One or More Signers</name> <name>Signing with One or More Signers</name>
<t>The COSE_Sign structure allows for one or more signatures to be appli <t>The COSE_Sign structure allows for one or more signatures to be appli
ed to a message payload. Header parameters relating to the content and header pa ed to a message payload. Header parameters relating to the content and header pa
rameters relating to the signature are carried along with the signature itself. rameters relating to the signature are carried along with the signature itself.
These header parameters may be authenticated by the signature, or just present. These header parameters may be authenticated by the signature, or just be prese
An example of a header parameter about the content is the content type header nt. An example of a header parameter about the content is the content type head
parameter. An example of a header parameter about the signature would be the al er parameter. An example of a header parameter about the signature would be the
gorithm and key used to create the signature.</t> algorithm and key used to create the signature.</t>
<t>RFC 5652 indicates that: <t>RFC 5652 indicates that:</t>
</t>
<blockquote> <blockquote>
When more than one signature is present, the successful validation of one signature associated with a given signer is usually treated as a successful signature by that signer. However, there are some application environments wher e other rules are needed. An application that employs a rule other than one val id signature for each signer must specify those rules. Also, where simple match ing of the signer identifier is not sufficient to determine whether the signatur es were generated by the same signer, the application specification must describ e how to determine which signatures were generated by the same signer. Support for different communities of recipients is the primary reason that signers choos e to include more than one signature. When more than one signature is present, the successful validation of one signature associated with a given signer is usually treated as a successful signature by that signer. However, there are some application environments wher e other rules are needed. An application that employs a rule other than one val id signature for each signer must specify those rules. Also, where simple match ing of the signer identifier is not sufficient to determine whether the signatur es were generated by the same signer, the application specification must describ e how to determine which signatures were generated by the same signer. Support of different communities of recipients is the primary reason that signers choose to include more than one signature.
</blockquote> </blockquote>
<t> <t>
For example, the COSE_Sign structure might include signatures generated with the For example, the COSE_Sign structure might include signatures generated with the
Edwards-curve Digital Signature Algorithm (EdDSA) <xref target="RFC8032"/> and Edwards-curve Digital Signature Algorithm (EdDSA) <xref target="RFC8032"/> and
with the Elliptic Curve Digital Signature Algorithm (ECDSA) <xref target="DSS"/> the Elliptic Curve Digital Signature Algorithm (ECDSA) <xref target="DSS"/>. Th
. This allows recipients to verify the signature associated with one algorithm is allows recipients to verify the signature associated with one algorithm or th
or the other. More-detailed information on multiple signature evaluations can be e other. More detailed information on multiple signature evaluations can be foun
found in <xref target="RFC5752"/>. </t> d in <xref target="RFC5752"/>. </t>
<t>The signature structure can be encoded as either tagged or untagged d <t>The signature structure can be encoded as either tagged or untagged,
epending on the context it will be used in. A tagged COSE_Sign structure is ide depending on the context it will be used in. A tagged COSE_Sign structure is id
ntified by the CBOR tag 98. The CDDL fragment that represents this is: </t> entified by the CBOR tag 98. The CDDL fragment that represents this is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Sign_Tagged = #6.98(COSE_Sign) COSE_Sign_Tagged = #6.98(COSE_Sign)
]]></sourcecode> ]]></sourcecode>
<t>A COSE Signed Message is defined in two parts. The CBOR object that carries the body and information about the body is called the COSE_Sign structur e. The CBOR object that carries the signature and information about the signatu re is called the COSE_Signature structure. Examples of COSE Signed Messages can be found in <xref target="SignedExamples"/>. </t> <t>A COSE Signed Message is defined in two parts. The CBOR object that carries the body and information about the body is called the COSE_Sign structur e. The CBOR object that carries the signature and information about the signatu re is called the COSE_Signature structure. Examples of COSE Signed Messages can be found in <xref target="SignedExamples"/>. </t>
<!-- Ben is complaining about the above, I think it is ok. Here is our <t>The COSE_Sign structure is a CBOR array. The fields of the array, in
email exchange: order, are:
> > > > A COSE Signed Message is defined in two parts. The CBOR object that
> > > > carries the body and information about the body is called the
> > > > COSE_Sign structure. The CBOR object that carries the
> > > > signature and
> > > >
> > > > (COSE_Sign also carries the signature parts?) [JLS] No - they are
> > > > carried in COSE_Signature
> > >
> > > I thought the COSE_Sign structure contained one or more
> > > COSE_Signature structures.
> >
> > Yes it does. I think of the "signature" as the byte string as being differe
nt
> from the COSE_Signature structure. This is referring to the first.
>
> Okay ... but even in this sense the "signature" is *indirectly* contained in
> COSE_Sign, and I at least did not get the sense from this text that we intende
d
> the "directly carries" sense of the term. Maybe we should leave a note to ask
> the RFC Editor for help; I'm failing to come up with a good wording right now.
>
<t>The COSE_Sign structure is a CBOR array. The fields of the array in
order are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>payload:</dt> <dt>payload:</dt>
<dd> <dd>
<t> <t>
This field contains the serialized content to be signed. This field contains the serialized content to be signed.
skipping to change at line 677 skipping to change at line 684
<dd>This field is an array of signatures. Each signature is represent ed as a COSE_Signature structure. </dd> <dd>This field is an array of signatures. Each signature is represent ed as a COSE_Signature structure. </dd>
</dl> </dl>
<t>The CDDL fragment that represents the above text for COSE_Sign follow s. </t> <t>The CDDL fragment that represents the above text for COSE_Sign follow s. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Sign = [ COSE_Sign = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
signatures : [+ COSE_Signature] signatures : [+ COSE_Signature]
] ]
]]></sourcecode> ]]></sourcecode>
<t>The COSE_Signature structure is a CBOR array. The fields of the arra y in order are: <t>The COSE_Signature structure is a CBOR array. The fields of the arra y, in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>signature:</dt> <dt>signature:</dt>
<dd>This field contains the computed signature value. The type of the field is a bstr. Algorithms <bcp14>MUST</bcp14> specify padding if the signatu re value is not a multiple of 8 bits. </dd> <dd>This field contains the computed signature value. The type of the field is a bstr. Algorithms <bcp14>MUST</bcp14> specify padding if the signatu re value is not a multiple of 8 bits. </dd>
</dl> </dl>
<t>The CDDL fragment that represents the above text for COSE_Signature f ollows. </t> <t>The CDDL fragment that represents the above text for COSE_Signature f ollows. </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Signature = [ COSE_Signature = [
Headers, Headers,
signature : bstr signature : bstr
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section> <section>
<name>Signing with One Signer</name> <name>Signing with One Signer</name>
<t>The COSE_Sign1 signature structure is used when only one signature is <t>The COSE_Sign1 signature structure is used when only one signature is
going to be placed on a message. The header parameters dealing with the conten going to be placed on a message. The header parameters dealing with the conten
t and the signature are placed in the same pair of buckets rather than having th t and the signature are placed in the same pair of buckets, rather than having t
e separation of COSE_Sign. </t> he separation of COSE_Sign. </t>
<t>The structure can be encoded as either tagged or untagged depending o <t>The structure can be encoded as either tagged or untagged depending o
n the context it will be used in. A tagged COSE_Sign1 structure is identified b n the context it will be used in. A tagged COSE_Sign1 structure is identified b
y the CBOR tag 18. The CDDL fragment that represents this is: </t> y the CBOR tag 18. The CDDL fragment that represents this is:</t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Sign1_Tagged = #6.18(COSE_Sign1) COSE_Sign1_Tagged = #6.18(COSE_Sign1)
]]></sourcecode> ]]></sourcecode>
<t>The CBOR object that carries the body, the signature, and the informa tion about the body and signature is called the COSE_Sign1 structure. Examples of COSE_Sign1 messages can be found in <xref target="Sign1_Examples"/>. </t> <t>The CBOR object that carries the body, the signature, and the informa tion about the body and signature is called the COSE_Sign1 structure. Examples of COSE_Sign1 messages can be found in <xref target="Sign1_Examples"/>. </t>
<t>The COSE_Sign1 structure is a CBOR array. The fields of the array in order are: <t>The COSE_Sign1 structure is a CBOR array. The fields of the array, i n order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>payload:</dt> <dt>payload:</dt>
<dd>This is as described in <xref target="full-signature"/>. </dd> <dd>This is as described in <xref target="full-signature"/>. </dd>
<dt>signature:</dt> <dt>signature:</dt>
<dd>This field contains the computed signature value. The type of the field is a bstr. </dd> <dd>This field contains the computed signature value. The type of the field is a bstr. </dd>
skipping to change at line 727 skipping to change at line 734
COSE_Sign1 = [ COSE_Sign1 = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
signature : bstr signature : bstr
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Extern_AAD"> <section anchor="Extern_AAD">
<name>Externally Supplied Data</name> <name>Externally Supplied Data</name>
<t> <t>
One of the features offered in the COSE document is the ability for ap plications to provide additional data to be authenticated, but that is not carri ed as part of the COSE object. One of the features offered in the COSE document is the ability for ap plications to provide additional data that is to be authenticated but is not car ried as part of the COSE object.
The primary reason for supporting this can be seen by looking at the C oAP message structure <xref target="RFC7252"/>, where the facility exists for op tions to be carried before the payload. The primary reason for supporting this can be seen by looking at the C oAP message structure <xref target="RFC7252"/>, where the facility exists for op tions to be carried before the payload.
Examples of data that can be placed in this location would be the CoAP code or CoAP options. Examples of data that can be placed in this location would be the CoAP code or CoAP options.
<!--[rfced] In the sentence below, does "its operations" refer to the operations
of the CoAP message or the data?
Original:
If the data is in the headers of the CoAP message, then it is available for prox
ies to help
in performing its operations.
Perhaps:
If the data is in the headers of the CoAP message, then it is available for prox
ies to help
in performing the message's operations.
-->
If the data is in the headers of the CoAP message, then it is availabl e for proxies to help in performing its operations. If the data is in the headers of the CoAP message, then it is availabl e for proxies to help in performing its operations.
For example, the Accept Option can be used by a proxy to determine if For example, the Accept option can be used by a proxy to determine if
an appropriate value is in the proxy's cache. an appropriate value is in the proxy's cache.
But the sender can cause a failure at the server if a proxy, or an att But the sender can cause a failure at the server if a proxy, or an att
acker, changes the set of accept values by including the field in the externally acker, changes the set of Accept values by including the field in the externally
supplied data. supplied data.
</t> </t>
<t> <t>
This document describes the process for using a byte array of external ly supplied authenticated data; the method of constructing the byte array is a f unction of the application. This document describes the process for using a byte array of external ly supplied authenticated data; the method of constructing the byte array is a f unction of the application.
Applications that use this feature need to define how the externally s upplied authenticated data is to be constructed. Such a construction needs to t ake into account the following issues: Applications that use this feature need to define how the externally s upplied authenticated data is to be constructed. Such a construction needs to t ake into account the following issues:
</t> </t>
<ul> <ul>
<li> <li>
If multiple items are included, applications need to ensure that t he same byte string cannot be produced if there are different inputs. If multiple items are included, applications need to ensure that t he same byte string cannot be produced if there are different inputs.
This would occur by concatenating the text strings 'AB' and 'CDE' or by concatenating the text strings 'ABC' and 'DE'. This would occur by concatenating the text strings "AB" and "CDE" or by concatenating the text strings "ABC" and "DE".
This is usually addressed by making fields a fixed width and/or en coding the length of the field as part of the output. This is usually addressed by making fields a fixed width and/or en coding the length of the field as part of the output.
Using options from CoAP <xref target="RFC7252"/> as an example, th ese fields use a TLV structure so they can be concatenated without any problems. Using options from CoAP <xref target="RFC7252"/> as an example, th ese fields use a TLV structure so they can be concatenated without any problems.
</li> </li>
<li>If multiple items are included, an order for the items needs to be defined. Using options from CoAP as an example, an application could state tha t the fields are to be ordered by the option number. </li> <li>If multiple items are included, an order for the items needs to be defined. Using options from CoAP as an example, an application could state tha t the fields are to be ordered by the option number. </li>
<li> <li>
Applications need to ensure that the byte string is going to be th e same on both sides. Applications need to ensure that the byte string is going to be th e same on both sides.
Using options from CoAP might give a problem if the same relative numbering is kept. Using options from CoAP might give a problem if the same relative numbering is kept.
An intermediate node could insert or remove an option, changing ho w the relative number is done. An intermediate node could insert or remove an option, changing ho w the relative numbering is done.
An application would need to specify that the relative number must be re-encoded to be relative only to the options that are in the external data. An application would need to specify that the relative number must be re-encoded to be relative only to the options that are in the external data.
</li> </li>
</ul> </ul>
</section> </section>
<section anchor="Sig_structure"> <section anchor="Sig_structure">
<name>Signing and Verification Process</name> <name>Signing and Verification Process</name>
<t> <t>
In order to create a signature, a well-defined byte string is needed. In order to create a signature, a well-defined byte string is needed.
The Sig_structure is used to create the canonical form. The Sig_structure is used to create the canonical form.
This signing and verification process takes in the body information (C OSE_Sign or COSE_Sign1), the signer information (COSE_Signature), and the applic ation data (external source). This signing and verification process takes in the body information (C OSE_Sign or COSE_Sign1), the signer information (COSE_Signature), and the applic ation data (external source).
A Sig_structure is a CBOR array. A Sig_structure is a CBOR array.
The fields of the Sig_structure in order are: The fields of the Sig_structure, in order, are:
</t> </t>
<ol type="1"> <ol type="1">
<li> <li>
<t> <t>
A context text string identifying the context of the signature. T he context text string is: A context text string identifying the context of the signature. T he context text string is:
</t> </t>
<ul empty="true"> <ul empty="true">
<li>"Signature" for signatures using the COSE_Signature structure. </li> <li>"Signature" for signatures using the COSE_Signature structure. </li>
<li>"Signature1" for signatures using the COSE_Sign1 structure.</l i> <li>"Signature1" for signatures using the COSE_Sign1 structure.</l i>
</ul> </ul>
</li> </li>
skipping to change at line 775 skipping to change at line 791
<ol type="1"> <ol type="1">
<li> <li>
<t> <t>
A context text string identifying the context of the signature. T he context text string is: A context text string identifying the context of the signature. T he context text string is:
</t> </t>
<ul empty="true"> <ul empty="true">
<li>"Signature" for signatures using the COSE_Signature structure. </li> <li>"Signature" for signatures using the COSE_Signature structure. </li>
<li>"Signature1" for signatures using the COSE_Sign1 structure.</l i> <li>"Signature1" for signatures using the COSE_Sign1 structure.</l i>
</ul> </ul>
</li> </li>
<li>The protected attributes from the body structure encoded in a bstr <li>The protected attributes from the body structure, encoded in a bst
type. If there are no protected attributes, a zero-length byte string is used. r type. If there are no protected attributes, a zero-length byte string is used
</li> . </li>
<li>The protected attributes from the signer structure encoded in a bs <li>The protected attributes from the signer structure, encoded in a b
tr type. If there are no protected attributes, a zero-length byte string is use str type. If there are no protected attributes, a zero-length byte string is us
d. This field is omitted for the COSE_Sign1 signature structure. </li> ed. This field is omitted for the COSE_Sign1 signature structure. </li>
<li>The externally supplied data from the application encoded in a bst <li>The externally supplied data from the application, encoded in a bs
r type. If this field is not supplied, it defaults to a zero-length byte string tr type. If this field is not supplied, it defaults to a zero-length byte strin
. (See <xref target="Extern_AAD"/> for application guidance on constructing thi g. (See <xref target="Extern_AAD"/> for application guidance on constructing th
s field.) </li> is field.) </li>
<li>The payload to be signed encoded in a bstr type. The payload is p <li>The payload to be signed, encoded in a bstr type. The payload is
laced here independent of how it is transported. </li> placed here, independent of how it is transported. </li>
</ol> </ol>
<t>The CDDL fragment that describes the above text is: </t> <t>The CDDL fragment that describes the above text is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
Sig_structure = [ Sig_structure = [
context : "Signature" / "Signature1", context : "Signature" / "Signature1",
body_protected : empty_or_serialized_map, body_protected : empty_or_serialized_map,
? sign_protected : empty_or_serialized_map, ? sign_protected : empty_or_serialized_map,
external_aad : bstr, external_aad : bstr,
payload : bstr payload : bstr
] ]
]]></sourcecode> ]]></sourcecode>
<t>How to compute a signature: <t>How to compute a signature:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create a Sig_structure and populate it with the appropriate fields . </li> <li>Create a Sig_structure and populate it with the appropriate fields . </li>
<li>Create the value ToBeSigned by encoding the Sig_structure to a byt e string, using the encoding described in <xref target="CBOR-Canonical"/>. </li > <li>Create the value ToBeSigned by encoding the Sig_structure to a byt e string, using the encoding described in <xref target="CBOR-Canonical"/>. </li >
<li>Call the signature creation algorithm passing in K (the key to sig <li>Call the signature creation algorithm, passing in K (the key to si
n with), alg (the algorithm to sign with), and ToBeSigned (the value to sign). gn with), alg (the algorithm to sign with), and ToBeSigned (the value to sign).
</li> </li>
<!--
" 4. Place the resulting signature value in the 'signature' field of
the array."
Although it is clear from the context, one might whish to specify which
array to avoid confusion.
[JLS] It is a bit problematical to say which array it is going into because this
is one of three different arrays. However, it would go into a non-array for Co
unterSignature0. Hmmmmmm.
Need to think about how to adjust the text to deal with all of the different
ways to put the signature someplace.
<li> <li>
Place the resulting signature value in the correct location. Place the resulting signature value in the correct location.
This is the 'signature' field of the COSE_Signature or COSE_Sign1 structure. This is the "signature" field of the COSE_Signature or COSE_Sign1 structure.
</li> </li>
</ol> </ol>
<t>The steps for verifying a signature are: <t>The steps for verifying a signature are:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create a Sig_structure and populate it with the appropriate fields . </li> <li>Create a Sig_structure and populate it with the appropriate fields . </li>
<li>Create the value ToBeSigned by encoding the Sig_structure to a byt e string, using the encoding described in <xref target="CBOR-Canonical"/>. </li > <li>Create the value ToBeSigned by encoding the Sig_structure to a byt e string, using the encoding described in <xref target="CBOR-Canonical"/>. </li >
<li>Call the signature verification algorithm passing in K (the key to verify with), alg (the algorithm used sign with), ToBeSigned (the value to sign ), and sig (the signature to be verified). </li> <li>Call the signature verification algorithm, passing in K (the key t o verify with), alg (the algorithm used to sign with), ToBeSigned (the value to sign), and sig (the signature to be verified). </li>
</ol> </ol>
<t> <t>
In addition to performing the signature verification, the application performs the appropriate checks to ensure that the key is correctly paired with the sign ing identity and that the signing identity is authorized before performing actio ns. In addition to performing the signature verification, the application performs the appropriate checks to ensure that the key is correctly paired with the sign ing identity and that the signing identity is authorized before performing actio ns.
</t> </t>
</section> </section>
</section> </section>
<section anchor="encryption-object"> <section anchor="encryption-object">
<name>Encryption Objects</name> <name>Encryption Objects</name>
<t> <t>
COSE supports two different encryption structures. COSE supports two different encryption structures.
COSE_Encrypt0 is used when a recipient structure is not needed because t he key to be used is known implicitly. COSE_Encrypt0 is used when a recipient structure is not needed because t he key to be used is known implicitly.
COSE_Encrypt is used the rest of the time. COSE_Encrypt is used the rest of the time.
This includes cases where there are multiple recipients or a recipient a lgorithm other than direct (i.e. pre-shared secret) is used. This includes cases where there are multiple recipients or a recipient a lgorithm other than direct (i.e., preshared secret) is used.
</t> </t>
<section anchor="EnvelopedData"> <section anchor="EnvelopedData">
<name>Enveloped COSE Structure</name> <name>Enveloped COSE Structure</name>
<t>The enveloped structure allows for one or more recipients of a messag e. There are provisions for header parameters about the content and header para meters about the recipient information to be carried in the message. The protec ted header parameters associated with the content are authenticated by the conte nt encryption algorithm. The protected header parameters associated with the re cipient are authenticated by the recipient algorithm (when the algorithm support s it). Examples of header parameters about the content are the type of the cont ent and the content encryption algorithm. Examples of header parameters about t he recipient are the recipient's key identifier and the recipient's encryption a lgorithm. </t> <t>The enveloped structure allows for one or more recipients of a messag e. There are provisions for header parameters about the content and header para meters about the recipient information to be carried in the message. The protec ted header parameters associated with the content are authenticated by the conte nt encryption algorithm. The protected header parameters associated with the re cipient are authenticated by the recipient algorithm (when the algorithm support s it). Examples of header parameters about the content are the type of the cont ent and the content encryption algorithm. Examples of header parameters about t he recipient are the recipient's key identifier and the recipient's encryption a lgorithm. </t>
<t> <t>
The same techniques and nearly the same structure are used for encrypt ing both the plaintext and the keys. The same techniques and nearly the same structure are used for encrypt ing both the plaintext and the keys.
This is different from the approach used by both "Cryptographic Messag e Syntax (CMS)" <xref target="RFC5652"/> and "JSON Web Encryption (JWE)" <xref t arget="RFC7516"/> where different structures are used for the content layer and for the recipient layer. This is different from the approach used by both "Cryptographic Messag e Syntax (CMS)" <xref target="RFC5652"/> and "JSON Web Encryption (JWE)" <xref t arget="RFC7516"/>, where different structures are used for the content layer and the recipient layer.
Two structures are defined: COSE_Encrypt to hold the encrypted content and COSE_recipient to hold the encrypted keys for recipients. Two structures are defined: COSE_Encrypt to hold the encrypted content and COSE_recipient to hold the encrypted keys for recipients.
Examples of encrypted messages can be found in <xref target="Enveloped Examples"/>. Examples of encrypted messages can be found in <xref target="Enveloped Examples"/>.
</t> </t>
<t>The COSE_Encrypt structure can be encoded as either tagged or untagge d depending on the context it will be used in. A tagged COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL fragment that represents this is: </ t> <t>The COSE_Encrypt structure can be encoded as either tagged or untagge d, depending on the context it will be used in. A tagged COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL fragment that represents this is: < /t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Encrypt_Tagged = #6.96(COSE_Encrypt) COSE_Encrypt_Tagged = #6.96(COSE_Encrypt)
]]></sourcecode> ]]></sourcecode>
<t>The COSE_Encrypt structure is a CBOR array. The fields of the array in order are: <t>The COSE_Encrypt structure is a CBOR array. The fields of the array, in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>ciphertext:</dt> <dt>ciphertext:</dt>
<dd>This field contains the ciphertext encoded as a bstr. If the ciph ertext is to be transported independently of the control information about the e ncryption process (i.e., detached content), then the field is encoded as a nil v alue. </dd> <dd>This field contains the ciphertext, encoded as a bstr. If the cip hertext is to be transported independently of the control information about the encryption process (i.e., detached content), then the field is encoded as a nil value. </dd>
<dt>recipients:</dt> <dt>recipients:</dt>
<dd>This field contains an array of recipient information structures. The type for the recipient information structure is a COSE_recipient. </dd> <dd>This field contains an array of recipient information structures. The type for the recipient information structure is a COSE_recipient. </dd>
</dl> </dl>
<t>The CDDL fragment that corresponds to the above text is: </t> <t>The CDDL fragment that corresponds to the above text is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Encrypt = [ COSE_Encrypt = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
recipients : [+COSE_recipient] recipients : [+COSE_recipient]
] ]
]]></sourcecode> ]]></sourcecode>
<t>The COSE_recipient structure is a CBOR array. The fields of the arra y in order are: <t>The COSE_recipient structure is a CBOR array. The fields of the arra y, in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>ciphertext:</dt> <dt>ciphertext:</dt>
<dd>This field contains the encrypted key encoded as a bstr. All enco ded keys are symmetric keys; the binary value of the key is the content. If the re is not an encrypted key, then this field is encoded as a nil value. </dd> <dd>This field contains the encrypted key, encoded as a bstr. All enc oded keys are symmetric keys; the binary value of the key is the content. If th ere is not an encrypted key, then this field is encoded as a nil value. </dd>
<dt>recipients:</dt> <dt>recipients:</dt>
<dd>This field contains an array of recipient information structures. The type for the recipient information structure is a COSE_recipient (an exampl e of this can be found in <xref target="three-layer"/>). If there are no recipie nt information structures, this element is absent. </dd> <dd>This field contains an array of recipient information structures. The type for the recipient information structure is a COSE_recipient (an exampl e of this can be found in <xref target="three-layer"/>). If there are no recipie nt information structures, this element is absent. </dd>
</dl> </dl>
<t>The CDDL fragment that corresponds to the above text for COSE_recipie nt is: </t> <t>The CDDL fragment that corresponds to the above text for COSE_recipie nt is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_recipient = [ COSE_recipient = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
? recipients : [+COSE_recipient] ? recipients : [+COSE_recipient]
] ]
skipping to change at line 903 skipping to change at line 907
The details of this encryption depend on which class the recipient a lgorithm falls into. The details of this encryption depend on which class the recipient a lgorithm falls into.
Specific details on each of the classes can be found in <xref target ="key-management-algs"/>. Specific details on each of the classes can be found in <xref target ="key-management-algs"/>.
A short summary of the five content key distribution methods is: A short summary of the five content key distribution methods is:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>direct:</dt> <dt>direct:</dt>
<dd> <dd>
The CEK is the same as the identified previously distributed sym metric key or is derived from a previously distributed secret. The CEK is the same as the identified previously distributed sym metric key or is derived from a previously distributed secret.
No CEK is transported in the message. No CEK is transported in the message.
</dd> </dd>
<dt>symmetric key-encryption keys (KEK):</dt> <dt>symmetric key-encryption keys (KEKs):</dt>
<dd> <dd>
The CEK is encrypted using a previously distributed symmetric KE K. The CEK is encrypted using a previously distributed symmetric KE K.
Also known as key wrap. Also known as key wrap.
</dd> </dd>
<dt>key agreement:</dt> <dt>key agreement:</dt>
<dd> <dd>
The recipient's public key and a sender's private key are used t o generate a pairwise secret, a Key Derivation Function (KDF) is applied to deri ve a key, and then the CEK is either the derived key or encrypted by the derived key. The recipient's public key and a sender's private key are used t o generate a pairwise secret, a Key Derivation Function (KDF) is applied to deri ve a key, and then the CEK is either the derived key or encrypted by the derived key.
</dd> </dd>
<dt>key transport:</dt> <dt>key transport:</dt>
<dd> <dd>
skipping to change at line 928 skipping to change at line 932
The CEK is encrypted in a KEK that is derived from a password. The CEK is encrypted in a KEK that is derived from a password.
As of when this document was published, no password algorithms h ave been defined. As of when this document was published, no password algorithms h ave been defined.
</dd> </dd>
</dl> </dl>
</section> </section>
</section> </section>
<section anchor="EnvelopedData0"> <section anchor="EnvelopedData0">
<name>Single Recipient Encrypted</name> <name>Single Recipient Encrypted</name>
<t>The COSE_Encrypt0 encrypted structure does not have the ability to sp ecify recipients of the message. The structure assumes that the recipient of th e object will already know the identity of the key to be used in order to decryp t the message. If a key needs to be identified to the recipient, the enveloped structure ought to be used. </t> <t>The COSE_Encrypt0 encrypted structure does not have the ability to sp ecify recipients of the message. The structure assumes that the recipient of th e object will already know the identity of the key to be used in order to decryp t the message. If a key needs to be identified to the recipient, the enveloped structure ought to be used. </t>
<t>Examples of encrypted messages can be found in <xref target="Envelope dExamples"/>. </t> <t>Examples of encrypted messages can be found in <xref target="Envelope dExamples"/>. </t>
<t>The COSE_Encrypt0 structure can be encoded as either tagged or untagg ed depending on the context it will be used in. A tagged COSE_Encrypt0 structur e is identified by the CBOR tag 16. The CDDL fragment that represents this is: </t> <t>The COSE_Encrypt0 structure can be encoded as either tagged or untagg ed, depending on the context it will be used in. A tagged COSE_Encrypt0 structu re is identified by the CBOR tag 16. The CDDL fragment that represents this is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0) COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0)
]]></sourcecode> ]]></sourcecode>
<t>The COSE_Encrypt0 structure is a CBOR array. The fields of the array in order are: <t>The COSE_Encrypt0 structure is a CBOR array. The fields of the array , in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>.</dd> <dd>This is as described in <xref target="header-parameters"/>.</dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>.</dd> <dd>This is as described in <xref target="header-parameters"/>.</dd>
<dt>ciphertext:</dt> <dt>ciphertext:</dt>
<dd>This is as described in <xref target="EnvelopedData"/>.</dd> <dd>This is as described in <xref target="EnvelopedData"/>.</dd>
</dl> </dl>
<t>The CDDL fragment for COSE_Encrypt0 that corresponds to the above tex t is: </t> <t>The CDDL fragment for COSE_Encrypt0 that corresponds to the above tex t is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Encrypt0 = [ COSE_Encrypt0 = [
Headers, Headers,
ciphertext : bstr / nil, ciphertext : bstr / nil,
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="encryption-algorithm-for-aead-algorithms"> <section anchor="encryption-algorithm-for-aead-algorithms">
<name>How to Encrypt and Decrypt for AEAD Algorithms</name> <name>How to Encrypt and Decrypt for AEAD Algorithms</name>
<t>The encryption algorithm for AEAD algorithms is fairly simple. The f irst step is to create a consistent byte string for the authenticated data struc ture. For this purpose, we use an Enc_structure. The Enc_structure is a CBOR a rray. The fields of the Enc_structure in order are: <t>The encryption algorithm for AEAD algorithms is fairly simple. The f irst step is to create a consistent byte string for the authenticated data struc ture. For this purpose, we use an Enc_structure. The Enc_structure is a CBOR a rray. The fields of the Enc_structure, in order, are:
</t> </t>
<ol type="1"> <ol type="1">
<li> <li>
<t>A context text string identifying the context of the authenticate d data structure. The context text string is: <t>A context text string identifying the context of the authenticate d data structure. The context text string is:
</t> </t>
<ul empty="true"> <ul empty="true">
<li>"Encrypt0" for the content encryption of a COSE_Encrypt0 data structure.</li> <li>"Encrypt0" for the content encryption of a COSE_Encrypt0 data structure.</li>
<li>"Encrypt" for the first layer of a COSE_Encrypt data structure (i.e., for content encryption).</li> <li>"Encrypt" for the first layer of a COSE_Encrypt data structure (i.e., for content encryption).</li>
<li>"Enc_Recipient" for a recipient encoding to be placed in an CO SE_Encrypt data structure.</li> <li>"Enc_Recipient" for a recipient encoding to be placed in a COS E_Encrypt data structure.</li>
<li>"Mac_Recipient" for a recipient encoding to be placed in a MAC ed message structure.</li> <li>"Mac_Recipient" for a recipient encoding to be placed in a MAC ed message structure.</li>
<li>"Rec_Recipient" for a recipient encoding to be placed in a rec ipient structure.</li> <li>"Rec_Recipient" for a recipient encoding to be placed in a rec ipient structure.</li>
</ul> </ul>
</li> </li>
<li>The protected attributes from the body structure encoded in a bstr type. If there are no protected attributes, a zero-length byte string is used. </li> <li>The protected attributes from the body structure, encoded in a bst r type. If there are no protected attributes, a zero-length byte string is used . </li>
<li>The externally supplied data from the application encoded in a bst r type. If this field is not supplied, it defaults to a zero-length byte string . (See <xref target="Extern_AAD"/> for application guidance on constructing thi s field.) </li> <li>The externally supplied data from the application encoded in a bst r type. If this field is not supplied, it defaults to a zero-length byte string . (See <xref target="Extern_AAD"/> for application guidance on constructing thi s field.) </li>
</ol> </ol>
<t>The CDDL fragment that describes the above text is: </t> <t>The CDDL fragment that describes the above text is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
Enc_structure = [ Enc_structure = [
context : "Encrypt" / "Encrypt0" / "Enc_Recipient" / context : "Encrypt" / "Encrypt0" / "Enc_Recipient" /
"Mac_Recipient" / "Rec_Recipient", "Mac_Recipient" / "Rec_Recipient",
protected : empty_or_serialized_map, protected : empty_or_serialized_map,
external_aad : bstr external_aad : bstr
] ]
skipping to change at line 988 skipping to change at line 992
<t>How to encrypt a message: <t>How to encrypt a message:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create an Enc_structure and populate it with the appropriate field s. </li> <li>Create an Enc_structure and populate it with the appropriate field s. </li>
<li>Encode the Enc_structure to a byte string (Additional Authenticate d Data (AAD)), using the encoding described in <xref target="CBOR-Canonical"/>. </li> <li>Encode the Enc_structure to a byte string (Additional Authenticate d Data (AAD)), using the encoding described in <xref target="CBOR-Canonical"/>. </li>
<li> <li>
<t>Determine the encryption key (K). This step is dependent on the class of recipient algorithm being used. For: <t>Determine the encryption key (K). This step is dependent on the class of recipient algorithm being used. For:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>No Recipients:</dt> <dt>No Recipients:</dt>
<dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), or pre-shared secrets. </dd > <dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), and preshared secrets. </dd >
<dt>Direct Encryption and Direct Key Agreement:</dt> <dt>Direct Encryption and Direct Key Agreement:</dt>
<dd> <dd>
The key is determined by the key and algorithm in the recipient structure. The key is determined by the key and algorithm in the recipient structure.
The encryption algorithm and size of the key to be used are inputs into the KD F used for the recipient. The encryption algorithm and size of the key to be used are inputs into the KD F used for the recipient.
(For direct, the KDF can be thought of as the identity operation.) (For direct, the KDF can be thought of as the identity operation.)
Examples of these algorithms are found in Sections 6.1.2 and 6.3 of <xref targ et="I-D.ietf-cose-rfc8152bis-algs"/>. Examples of these algorithms are found in Sections <xref target="RFC9053" sect ion="6.1.2" sectionFormat="bare"/> and <xref target="RFC9053" section="6.3" sect ionFormat="bare"/> of <xref target="RFC9053"/>.
</dd> </dd>
<dt>Other:</dt> <dt>Other:</dt>
<dd>The key is randomly or pseudo-randomly generated. </dd> <dd>The key is randomly or pseudorandomly generated. </dd>
</dl> </dl>
</li> </li>
<li>Call the encryption algorithm with K (the encryption key), P (the plaintext), and AAD. Place the returned ciphertext into the 'ciphertext' field of the structure. </li> <li>Call the encryption algorithm with K (the encryption key), P (the plaintext), and AAD. Place the returned ciphertext into the "ciphertext" field of the structure. </li>
<li>For recipients of the message, recursively perform the encryption algorithm for that recipient, using K (the encryption key) as the plaintext. </ li> <li>For recipients of the message, recursively perform the encryption algorithm for that recipient, using K (the encryption key) as the plaintext. </ li>
</ol> </ol>
<t>How to decrypt a message: <t>How to decrypt a message:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create an Enc_structure and populate it with the appropriate field s. </li> <li>Create an Enc_structure and populate it with the appropriate field s. </li>
<li>Encode the Enc_structure to a byte string (AAD), using the encodin g described in <xref target="CBOR-Canonical"/>. </li> <li>Encode the Enc_structure to a byte string (AAD), using the encodin g described in <xref target="CBOR-Canonical"/>. </li>
<li> <li>
<t>Determine the decryption key. This step is dependent on the clas s of recipient algorithm being used. For: <t>Determine the decryption key. This step is dependent on the clas s of recipient algorithm being used. For:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>No Recipients:</dt> <dt>No Recipients:</dt>
<dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), or pre-shared secrets. </dd > <dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), and preshared secrets. </dd >
<dt>Direct Encryption and Direct Key Agreement:</dt> <dt>Direct Encryption and Direct Key Agreement:</dt>
<dd> <dd>
The key is determined by the key and algorithm in the recipient structure. The key is determined by the key and algorithm in the recipient structure.
The encryption algorithm and size of the key to be used are inputs into the KD F used for the recipient. The encryption algorithm and size of the key to be used are inputs into the KD F used for the recipient.
(For direct, the KDF can be thought of as the identity operation.) (For direct, the KDF can be thought of as the identity operation.)
</dd> </dd>
<dt>Other:</dt> <dt>Other:</dt>
<dd>The key is determined by decoding and decrypting one of the re cipient structures. </dd> <dd>The key is determined by decoding and decrypting one of the re cipient structures. </dd>
</dl> </dl>
</li> </li>
<li>Call the decryption algorithm with K (the decryption key to use), C (the ciphertext), and AAD. </li> <li>Call the decryption algorithm with K (the decryption key to use), C (the ciphertext), and AAD. </li>
</ol> </ol>
</section> </section>
<section anchor="encryption-algorithm-for-ae-algorithms"> <section anchor="encryption-algorithm-for-ae-algorithms">
<name>How to Encrypt and Decrypt for AE Algorithms</name> <name>How to Encrypt and Decrypt for AE Algorithms</name>
<t>How to encrypt a message: <t>How to encrypt a message:
</t> </t>
<ol type="1"> <ol type="1">
<li>Verify that the 'protected' field is empty. </li> <li>Verify that the "protected" field is empty. </li>
<li>Verify that there was no external additional authenticated data su pplied for this operation. </li> <li>Verify that there was no external additional authenticated data su pplied for this operation. </li>
<li> <li>
<t>Determine the encryption key. This step is dependent on the clas s of recipient algorithm being used. For: <t>Determine the encryption key. This step is dependent on the clas s of recipient algorithm being used. For:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>No Recipients:</dt> <dt>No Recipients:</dt>
<dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), or pre-shared secrets. </dd > <dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), and preshared secrets. </dd >
<dt>Direct Encryption and Direct Key Agreement:</dt> <dt>Direct Encryption and Direct Key Agreement:</dt>
<dd>The key is determined by the key and algorithm in the recipien t structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) <dd>The key is determined by the key and algorithm in the recipien t structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.)
Examples of these algorithms are found in Sections 6.1.2 and 6.3 of <xref target ="I-D.ietf-cose-rfc8152bis-algs"/>. Examples of these algorithms are found in Sections <xref target="RFC9053" sectio n="6.1.2" sectionFormat="bare"/> and <xref target="RFC9053" section="6.3" sectio nFormat="bare"/> of <xref target="RFC9053"/>.
</dd> </dd>
<dt>Other:</dt> <dt>Other:</dt>
<dd>The key is randomly generated. </dd> <dd>The key is randomly generated. </dd>
</dl> </dl>
</li> </li>
<li>Call the encryption algorithm with K (the encryption key to use) a nd P (the plaintext). Place the returned ciphertext into the 'ciphertext' field of the structure. </li> <li>Call the encryption algorithm with K (the encryption key to use) a nd P (the plaintext). Place the returned ciphertext into the "ciphertext" field of the structure. </li>
<li>For recipients of the message, recursively perform the encryption algorithm for that recipient, using K (the encryption key) as the plaintext. </ li> <li>For recipients of the message, recursively perform the encryption algorithm for that recipient, using K (the encryption key) as the plaintext. </ li>
</ol> </ol>
<t>How to decrypt a message: <t>How to decrypt a message:
</t> </t>
<ol type="1"> <ol type="1">
<li>Verify that the 'protected' field is empty. </li> <li>Verify that the "protected" field is empty. </li>
<li>Verify that there was no external additional authenticated data su pplied for this operation. </li> <li>Verify that there was no external additional authenticated data su pplied for this operation. </li>
<li> <li>
<t>Determine the decryption key. This step is dependent on the clas s of recipient algorithm being used. For: <t>Determine the decryption key. This step is dependent on the clas s of recipient algorithm being used. For:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>No Recipients:</dt> <dt>No Recipients:</dt>
<dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), or pre-shared secrets. </dd > <dd>The key to be used is determined by the algorithm and key at t he current layer. Examples are key transport keys (<xref target="KeyTransport"/ >), key wrap keys (<xref target="key_wrap_algs"/>), and preshared secrets. </dd >
<dt>Direct Encryption and Direct Key Agreement:</dt> <dt>Direct Encryption and Direct Key Agreement:</dt>
<dd>The key is determined by the key and algorithm in the recipien t structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.) <dd>The key is determined by the key and algorithm in the recipien t structure. The encryption algorithm and size of the key to be used are inputs into the KDF used for the recipient. (For direct, the KDF can be thought of as the identity operation.)
Examples of these algorithms are found in Sections 6.1.2 and 6.3 of <xref target ="I-D.ietf-cose-rfc8152bis-algs"/>. Examples of these algorithms are found in Sections <xref target="RFC9053" sectio n="6.1.2" sectionFormat="bare"/> and <xref target="RFC9053" section="6.3" sectio nFormat="bare"/> of <xref target="RFC9053"/>.
</dd> </dd>
<dt>Other:</dt> <dt>Other:</dt>
<dd>The key is determined by decoding and decrypting one of the re cipient structures. </dd> <dd>The key is determined by decoding and decrypting one of the re cipient structures. </dd>
</dl> </dl>
</li> </li>
<li>Call the decryption algorithm with K (the decryption key to use) a nd C (the ciphertext). </li> <li>Call the decryption algorithm with K (the decryption key to use) a nd C (the ciphertext). </li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="mac-objects"> <section anchor="mac-objects">
<name>MAC Objects</name> <name>MAC Objects</name>
<t> <t>
COSE supports two different MAC structures. COSE supports two different MAC structures.
COSE_MAC0 is used when a recipient structure is not needed because the k ey to be used is implicitly known. COSE_MAC0 is used when a recipient structure is not needed because the k ey to be used is implicitly known.
<!-- Gregory Guthe "COSE_MAC is used for all other cases. These include
a requirement for multiple recipients, the key being unknown, and a recipient al
gorithm of other than direct." rephrase? sounds like one case requiring three pr
operties instead any case requiring one of the three properties
-->
<!-- Response - change "and a recipient" to "or a recipient" and ask if
OK -->
COSE_MAC is used for all other cases. COSE_MAC is used for all other cases.
These include a requirement for multiple recipients, the key being unkno wn, or a recipient algorithm of other than direct. These include a requirement for multiple recipients, the key being unkno wn, or a recipient algorithm other than direct.
</t> </t>
<t>In this section, we describe the structure and methods to be used when doing MAC authentication in COSE. This document allows for the use of all of th e same classes of recipient algorithms as are allowed for encryption. </t> <t>In this section, we describe the structure and methods to be used when doing MAC authentication in COSE. This document allows for the use of all of th e same classes of recipient algorithms as are allowed for encryption. </t>
<t>When using MAC operations, there are two modes in which they can be use d. The first is just a check that the content has not been changed since the MA C was computed. Any class of recipient algorithm can be used for this purpose. The second mode is to both check that the content has not been changed since th e MAC was computed and to use the recipient algorithm to verify who sent it. Th e classes of recipient algorithms that support this are those that use a pre-sha red secret or do static-static (SS) key agreement (without the key wrap step). In both of these cases, the entity that created and sent the message MAC can be validated. (This knowledge of the sender assumes that there are only two partie s involved and that you did not send the message to yourself.) The origination p roperty can be obtained with both of the MAC message structures. </t> <t>There are two modes in which MAC operations can be used. The first is just a check that the content has not been changed since the MAC was computed. Any class of recipient algorithm can be used for this purpose. The second mode is to both check that the content has not been changed since the MAC was compute d and use the recipient algorithm to verify who sent it. The classes of recipie nt algorithms that support this are those that use a preshared secret or do stat ic-static (SS) key agreement (without the key wrap step). In both of these case s, the entity that created and sent the message MAC can be validated. (This kno wledge of the sender assumes that there are only two parties involved and that y ou did not send the message to yourself.) The origination property can be obtain ed with both of the MAC message structures. </t>
<section anchor="Mac_n"> <section anchor="Mac_n">
<name>MACed Message with Recipients</name> <name>MACed Message with Recipients</name>
<t>The multiple recipient MACed message uses two structures: the COSE_Ma c structure defined in this section for carrying the body and the COSE_recipient structure (<xref target="EnvelopedData"/>) to hold the key used for the MAC com putation. Examples of MACed messages can be found in <xref target="MacExamples" />. </t> <t>A multiple-recipient MACed message uses two structures: the COSE_Mac structure defined in this section for carrying the body and the COSE_recipient s tructure (<xref target="EnvelopedData"/>) to hold the key used for the MAC compu tation. Examples of MACed messages can be found in <xref target="MacExamples"/> . </t>
<t>The MAC structure can be encoded as either tagged or untagged dependi ng on the context it will be used in. A tagged COSE_Mac structure is identified by the CBOR tag 97. The CDDL fragment that represents this is: </t> <t>The MAC structure can be encoded as either tagged or untagged dependi ng on the context it will be used in. A tagged COSE_Mac structure is identified by the CBOR tag 97. The CDDL fragment that represents this is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Mac_Tagged = #6.97(COSE_Mac) COSE_Mac_Tagged = #6.97(COSE_Mac)
]]></sourcecode> ]]></sourcecode>
<t>The COSE_Mac structure is a CBOR array. The fields of the array in o rder are: <t>The COSE_Mac structure is a CBOR array. The fields of the array, in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>. </dd> <dd>This is as described in <xref target="header-parameters"/>. </dd>
<dt>payload:</dt> <dt>payload:</dt>
<dd>This field contains the serialized content to be MACed. If the pa yload is not present in the message, the application is required to supply the p ayload separately. The payload is wrapped in a bstr to ensure that it is transp orted without changes. If the payload is transported separately (i.e., detached content), then a nil CBOR value is placed in this location, and it is the respo nsibility of the application to ensure that it will be transported without chang es. </dd> <dd>This field contains the serialized content to be MACed. If the pa yload is not present in the message, the application is required to supply the p ayload separately. The payload is wrapped in a bstr to ensure that it is transp orted without changes. If the payload is transported separately (i.e., detached content), then a nil CBOR value is placed in this location, and it is the respo nsibility of the application to ensure that it will be transported without chang es. </dd>
<dt>tag:</dt> <dt>tag:</dt>
<dd>This field contains the MAC value. </dd> <dd>This field contains the MAC value. </dd>
skipping to change at line 1122 skipping to change at line 1123
payload : bstr / nil, payload : bstr / nil,
tag : bstr, tag : bstr,
recipients :[+COSE_recipient] recipients :[+COSE_recipient]
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section> <section>
<name>MACed Messages with Implicit Key</name> <name>MACed Messages with Implicit Key</name>
<t>In this section, we describe the structure and methods to be used whe n doing MAC authentication for those cases where the recipient is implicitly kno wn. </t> <t>In this section, we describe the structure and methods to be used whe n doing MAC authentication for those cases where the recipient is implicitly kno wn. </t>
<t>The MACed message uses the COSE_Mac0 structure defined in this sectio n for carrying the body. Examples of MACed messages with an implicit key can be found in <xref target="Mac0Examples"/>. </t> <t>The MACed message uses the COSE_Mac0 structure defined in this sectio n for carrying the body. Examples of MACed messages with an implicit key can be found in <xref target="Mac0Examples"/>. </t>
<t>The MAC structure can be encoded as either tagged or untagged dependi ng on the context it will be used in. A tagged COSE_Mac0 structure is identifie d by the CBOR tag 17. The CDDL fragment that represents this is: </t> <t>The MAC structure can be encoded as either tagged or untagged, depend ing on the context it will be used in. A tagged COSE_Mac0 structure is identifi ed by the CBOR tag 17. The CDDL fragment that represents this is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Mac0_Tagged = #6.17(COSE_Mac0) COSE_Mac0_Tagged = #6.17(COSE_Mac0)
]]></sourcecode> ]]></sourcecode>
<t>The COSE_Mac0 structure is a CBOR array. The fields of the array in order are: <t>The COSE_Mac0 structure is a CBOR array. The fields of the array, in order, are:
</t> </t>
<dl newline="false"> <dl newline="false">
<dt>protected:</dt> <dt>protected:</dt>
<dd>This is as described in <xref target="header-parameters"/>.</dd> <dd>This is as described in <xref target="header-parameters"/>.</dd>
<dt>unprotected:</dt> <dt>unprotected:</dt>
<dd>This is as described in <xref target="header-parameters"/>.</dd> <dd>This is as described in <xref target="header-parameters"/>.</dd>
<dt>payload:</dt> <dt>payload:</dt>
<dd>This is as described in <xref target="Mac_n"/>.</dd> <dd>This is as described in <xref target="Mac_n"/>.</dd>
<dt>tag:</dt> <dt>tag:</dt>
<dd>This field contains the MAC value.</dd> <dd>This field contains the MAC value.</dd>
skipping to change at line 1149 skipping to change at line 1150
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Mac0 = [ COSE_Mac0 = [
Headers, Headers,
payload : bstr / nil, payload : bstr / nil,
tag : bstr, tag : bstr,
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section> <section>
<name>How to Compute and Verify a MAC</name> <name>How to Compute and Verify a MAC</name>
<t>In order to get a consistent encoding of the data to be authenticated , the MAC_structure is used to have a canonical form. The MAC_structure is a CB OR array. The fields of the MAC_structure in order are: <t>In order to get a consistent encoding of the data to be authenticated , the MAC_structure is used to have a canonical form. The MAC_structure is a CB OR array. The fields of the MAC_structure, in order, are:
</t> </t>
<ol type="1"> <ol type="1">
<li>A context text string that identifies the structure that is being encoded. This context text string is "MAC" for the COSE_Mac structure. This co ntext text string is "MAC0" for the COSE_Mac0 structure. </li> <li>A context text string that identifies the structure that is being encoded. This context text string is "MAC" for the COSE_Mac structure. This co ntext text string is "MAC0" for the COSE_Mac0 structure. </li>
<li>The protected attributes from the COSE_MAC structure. If there ar e no protected attributes, a zero-length bstr is used. </li> <li>The protected attributes from the COSE_MAC structure. If there ar e no protected attributes, a zero-length bstr is used. </li>
<li>The externally supplied data from the application encoded as a bst <li>The externally supplied data from the application, encoded as a bs
r type. If this field is not supplied, it defaults to a zero-length byte string tr type. If this field is not supplied, it defaults to a zero-length byte strin
. (See <xref target="Extern_AAD"/> for application guidance on constructing thi g. (See <xref target="Extern_AAD"/> for application guidance on constructing th
s field.) </li> is field.) </li>
<li>The payload to be MACed encoded in a bstr type. The payload is pl <li>The payload to be MACed, encoded in a bstr type. The payload is p
aced here independent of how it is transported. </li> laced here, independent of how it is transported. </li>
</ol> </ol>
<t>The CDDL fragment that corresponds to the above text is: </t> <t>The CDDL fragment that corresponds to the above text is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
MAC_structure = [ MAC_structure = [
context : "MAC" / "MAC0", context : "MAC" / "MAC0",
protected : empty_or_serialized_map, protected : empty_or_serialized_map,
external_aad : bstr, external_aad : bstr,
payload : bstr payload : bstr
] ]
]]></sourcecode> ]]></sourcecode>
<t> <t>
The steps to compute a MAC are: The steps to compute a MAC are:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create a MAC_structure and populate it with the appropriate fields . </li> <li>Create a MAC_structure and populate it with the appropriate fields . </li>
<li>Create the value ToBeMaced by encoding the MAC_structure to a byte string, using the encoding described in <xref target="CBOR-Canonical"/>. </li> <li>Create the value ToBeMaced by encoding the MAC_structure to a byte string, using the encoding described in <xref target="CBOR-Canonical"/>. </li>
<li>Call the MAC creation algorithm passing in K (the key to use), alg <li>Call the MAC creation algorithm, passing in K (the key to use), al
(the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on). g (the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on).
</li> </li>
<li>Place the resulting MAC in the 'tag' field of the COSE_Mac or COSE <li>Place the resulting MAC in the "tag" field of the COSE_Mac or COSE
_Mac0 structure. </li> _Mac0 structure. </li>
<li> <li>
For COSE_Mac structures, encrypt and encode the MAC key for each r ecipient of the message. For COSE_Mac structures, encrypt and encode the MAC key for each r ecipient of the message.
</li> </li>
</ol> </ol>
<t> <t>
The steps to verify a MAC are: The steps to verify a MAC are:
</t> </t>
<ol type="1"> <ol type="1">
<li>Create a MAC_structure and populate it with the appropriate fields . </li> <li>Create a MAC_structure and populate it with the appropriate fields . </li>
<li>Create the value ToBeMaced by encoding the MAC_structure to a byte string, using the encoding described in <xref target="CBOR-Canonical"/>. </li> <li>Create the value ToBeMaced by encoding the MAC_structure to a byte string, using the encoding described in <xref target="CBOR-Canonical"/>. </li>
<li> <li>
For COSE_Mac structures, obtain the cryptographic key from one of the recipients of the message. For COSE_Mac structures, obtain the cryptographic key from one of the recipients of the message.
</li> </li>
<li>Call the MAC creation algorithm passing in K (the key to use), alg <li>Call the MAC creation algorithm, passing in K (the key to use), al
(the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on). g (the algorithm to MAC with), and ToBeMaced (the value to compute the MAC on).
</li> </li>
<li>Compare the MAC value to the 'tag' field of the COSE_Mac or COSE_M <li>Compare the MAC value to the "tag" field of the COSE_Mac or COSE_M
ac0 structure. </li> ac0 structure. </li>
</ol> </ol>
</section> </section>
</section> </section>
<section anchor="key-structure"> <section anchor="key-structure">
<name>Key Objects</name> <name>Key Objects</name>
<t>A COSE Key structure is built on a CBOR map. The set of common paramet <t>A COSE Key structure is built on a CBOR map. The set of common paramet
ers that can appear in a COSE Key can be found in the IANA "COSE Key Common Para ers that can appear in a COSE Key can be found in the IANA "COSE Key Common Para
meters" registry (<xref target="cose-key-map-registry"/>). Additional parameter meters" registry (<xref
s defined for specific key types can be found in the IANA "COSE Key Type Paramet target="cose-key-map-registry"/>).
ers" registry (<xref target="COSE.KeyParameters"/>). </t> <!--[rfced] The text below refers to the IANA "COSE Key Type Parameters" registr
y, but the citation leads to the "COSE Key Common Parameters" registry. We have
updated the reference - please let us know if any corrections are needed.
Original:
Additional parameters defined for specific key types can be found in the IANA
"COSE Key Type Parameters" registry ([COSE.KeyParameters]).
Current:
Additional
parameters defined for specific key types can be found in the IANA
"COSE Key Type Parameters" registry [COSE.KeyTypes].
This update leaves [COSE.KeyParameters] without an in-text citation. Perhaps it
should be referenced in Sections 7, 7.1, and/or 11.2?
Section 7:
The set of common
parameters that can appear in a COSE Key can be found in the IANA
"COSE Key Common Parameters" registry (Section 11.2).
Section 7.1:
This document defines a set of common parameters for a COSE Key
object.
Section 11.2:
The "COSE Key Common Parameters" registry was defined [RFC8152].
-->
Additional parameters defined for specific key types can be found in the IANA "C
OSE Key Type Parameters" registry <xref target="COSE.KeyTypes"/>. </t>
<t>A COSE Key Set uses a CBOR array object as its underlying type. The va lues of the array elements are COSE Keys. A COSE Key Set <bcp14>MUST</bcp14> ha ve at least one element in the array. Examples of COSE Key Sets can be found in <xref target="COSE_KEYS"/>. </t> <t>A COSE Key Set uses a CBOR array object as its underlying type. The va lues of the array elements are COSE Keys. A COSE Key Set <bcp14>MUST</bcp14> ha ve at least one element in the array. Examples of COSE Key Sets can be found in <xref target="COSE_KEYS"/>. </t>
<t>Each element in a COSE Key Set <bcp14>MUST</bcp14> be processed indepen dently. If one element in a COSE Key Set is either malformed or uses a key that is not understood by an application, that key is ignored and the other keys are processed normally. </t> <t>Each element in a COSE Key Set <bcp14>MUST</bcp14> be processed indepen dently. If one element in a COSE Key Set is either malformed or uses a key that is not understood by an application, that key is ignored, and the other keys ar e processed normally. </t>
<t>The element "kty" is a required element in a COSE_Key map. </t> <t>The element "kty" is a required element in a COSE_Key map. </t>
<t>The CDDL grammar describing COSE_Key and COSE_KeySet is: </t> <t>The CDDL grammar describing COSE_Key and COSE_KeySet is: </t>
<sourcecode type="CDDL"><![CDATA[ <sourcecode type="CDDL"><![CDATA[
COSE_Key = { COSE_Key = {
1 => tstr / int, ; kty 1 => tstr / int, ; kty
? 2 => bstr, ; kid ? 2 => bstr, ; kid
? 3 => tstr / int, ; alg ? 3 => tstr / int, ; alg
? 4 => [+ (tstr / int) ], ; key_ops ? 4 => [+ (tstr / int) ], ; key_ops
? 5 => bstr, ; Base IV ? 5 => bstr, ; Base IV
* label => values * label => values
} }
COSE_KeySet = [+COSE_Key] COSE_KeySet = [+COSE_Key]
]]></sourcecode> ]]></sourcecode>
<section anchor="COSE_KEY_KEYS"> <section anchor="COSE_KEY_KEYS">
<name>COSE Key Common Parameters</name> <name>COSE Key Common Parameters</name>
<t>This document defines a set of common parameters for a COSE Key objec t. <xref target="x-table-key-labels"/> provides a summary of the parameters def ined in this section. There are also parameters that are defined for specific k ey types. Key-type-specific parameters can be found in <xref target="I-D.ietf-c ose-rfc8152bis-algs"/>. </t> <t>This document defines a set of common parameters for a COSE Key objec t. <xref target="x-table-key-labels"/> provides a summary of the parameters def ined in this section. There are also parameters that are defined for specific k ey types. Key-type-specific parameters can be found in <xref target="RFC9053"/> . </t>
<table anchor="x-table-key-labels" align="center"> <table anchor="x-table-key-labels" align="center">
<name>Key Map Labels</name> <name>Key Map Labels</name>
<thead> <thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Label</th> <th>Label</th>
<th>CBOR Type</th> <th>CBOR Type</th>
<th>Value Registry</th> <th>Value Registry</th>
<th>Description</th> <th>Description</th>
</tr> </tr>
skipping to change at line 1240 skipping to change at line 1269
<td>1</td> <td>1</td>
<td>tstr / int</td> <td>tstr / int</td>
<td>COSE Key Types</td> <td>COSE Key Types</td>
<td>Identification of the key type</td> <td>Identification of the key type</td>
</tr> </tr>
<tr> <tr>
<td>kid</td> <td>kid</td>
<td>2</td> <td>2</td>
<td>bstr</td> <td>bstr</td>
<td/> <td/>
<td>Key identification value -- match to kid in message</td> <td>Key identification value -- match to "kid" in message</td>
</tr> </tr>
<tr> <tr>
<td>alg</td> <td>alg</td>
<td>3</td> <td>3</td>
<td>tstr / int</td> <td>tstr / int</td>
<td>COSE Algorithms</td> <td>COSE Algorithms</td>
<td>Key usage restriction to this algorithm</td> <td>Key usage restriction to this algorithm</td>
</tr> </tr>
<tr> <tr>
<td>key_ops</td> <td>key_ops</td>
skipping to change at line 1267 skipping to change at line 1296
<td>Base IV</td> <td>Base IV</td>
<td>5</td> <td>5</td>
<td>bstr</td> <td>bstr</td>
<td/> <td/>
<td>Base IV to be xor-ed with Partial IVs</td> <td>Base IV to be xor-ed with Partial IVs</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<dl newline="false"> <dl newline="false">
<dt>kty:</dt> <dt>kty:</dt>
<dd>This parameter is used to identify the family of keys for this str ucture and, thus, the set of key-type-specific parameters to be found. The set of values defined in this document can be found in <xref target="COSE.KeyTypes"/ >. This parameter <bcp14>MUST</bcp14> be present in a key object. Implementati ons <bcp14>MUST</bcp14> verify that the key type is appropriate for the algorith m being processed. The key type <bcp14>MUST</bcp14> be included as part of the trust decision process. </dd> <dd>This parameter is used to identify the family of keys for this str ucture and, thus, the set of key-type-specific parameters to be found. The set of values defined in this document can be found in <xref target="COSE.KeyTypes"/ >. This parameter <bcp14>MUST</bcp14> be present in a key object. Implementati ons <bcp14>MUST</bcp14> verify that the key type is appropriate for the algorith m being processed. The key type <bcp14>MUST</bcp14> be included as part of the trust-decision process. </dd>
<dt>alg:</dt> <dt>alg:</dt>
<dd>This parameter is used to restrict the algorithm that is used with the key. If this parameter is present in the key structure, the application <b cp14>MUST</bcp14> verify that this algorithm matches the algorithm for which the key is being used. If the algorithms do not match, then this key object <bcp14 >MUST NOT</bcp14> be used to perform the cryptographic operation. Note that the same key can be in a different key structure with a different or no algorithm s pecified; however, this is considered to be a poor security practice. </dd> <dd>This parameter is used to restrict the algorithm that is used with the key. If this parameter is present in the key structure, the application <b cp14>MUST</bcp14> verify that this algorithm matches the algorithm for which the key is being used. If the algorithms do not match, then this key object <bcp14 >MUST NOT</bcp14> be used to perform the cryptographic operation. Note that the same key can be in a different key structure with a different or no algorithm s pecified; however, this is considered to be a poor security practice. </dd>
<dt>kid:</dt> <dt>kid:</dt>
<dd>This parameter is used to give an identifier for a key. The ident ifier is not structured and can be anything from a user-provided byte string to a value computed on the public portion of the key. This field is intended for m atching against a 'kid' parameter in a message in order to filter down the set o f keys that need to be checked. <dd>This parameter is used to give an identifier for a key. The ident ifier is not structured and can be anything from a user-provided byte string to a value computed on the public portion of the key. This field is intended for m atching against a "kid" parameter in a message in order to filter down the set o f keys that need to be checked.
The value of the identifier is not a unique value and can occur in oth er key objects, even for different keys. The value of the identifier is not a unique value and can occur in oth er key objects, even for different keys.
</dd> </dd>
<dt>key_ops:</dt> <dt>key_ops:</dt>
<dd>This parameter is defined to restrict the set of operations that a key is to be used for. The value of the field is an array of values from <xref target="x-table-key-ops"/>. Algorithms define the values of key ops that are p ermitted to appear and are required for specific operations. The set of values matches that in <xref target="RFC7517"/> and <xref target="W3C.WebCrypto"/>. </ dd> <dd>This parameter is defined to restrict the set of operations that a key is to be used for. The value of the field is an array of values from <xref target="x-table-key-ops"/>. Algorithms define the values of key ops that are p ermitted to appear and are required for specific operations. The set of values matches that in <xref target="RFC7517"/> and <xref target="W3C.WebCrypto"/>. </ dd>
<dt>Base IV:</dt> <dt>Base IV:</dt>
<dd> <dd>
<t>This parameter is defined to carry the base portion of an IV. It is designed to be used with the Partial IV header parameter defined in <xref ta rget="cose-headers"/>. This field provides the ability to associate a Base IV w ith a key that is then modified on a per message basis with the Partial IV. <t>This parameter is defined to carry the base portion of an IV. It is designed to be used with the Partial IV header parameter defined in <xref ta rget="cose-headers"/>. This field provides the ability to associate a Base IV w ith a key that is then modified on a per-message basis with the Partial IV.
</t> </t>
<t> Extreme care needs to be taken when using a Base IV in an applic ation. Many encryption algorithms lose security if the same IV is used twice. <t> Extreme care needs to be taken when using a Base IV in an applic ation. Many encryption algorithms lose security if the same IV is used twice.
</t> </t>
<t> <t>
If different keys are derived for each sender, starting at the sam e Base IV is likely to satisfy this condition. If different keys are derived for each sender, starting at the sam e Base IV is likely to satisfy this condition.
If the same key is used for multiple senders, then the application needs to provide for a method of dividing the IV space up between the senders. If the same key is used for multiple senders, then the application needs to provide for a method of dividing the IV space up between the senders.
This could be done by providing a different base point to start fr om or a different Partial IV to start with and restricting the number of message s to be sent before rekeying. This could be done by providing a different base point to start fr om or a different Partial IV to start with and restricting the number of message s to be sent before rekeying.
</t> </t>
skipping to change at line 1356 skipping to change at line 1385
<tr> <tr>
<td>MAC verify</td> <td>MAC verify</td>
<td>10</td> <td>10</td>
<td>The key is used for validating MACs.</td> <td>The key is used for validating MACs.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</section> </section>
</section> </section>
<section> <section>
<name>Taxonomy of Algorithms used by COSE</name> <name>Taxonomy of Algorithms Used by COSE</name>
<t> <t>
In this section, a taxonomy of the different algorithm types that can be used in COSE is laid out. In this section, a taxonomy of the different algorithm types that can be used in COSE is laid out.
This taxonomy should not be considered to be exhaustive. This taxonomy should not be considered to be exhaustive.
New algorithms will be created which will not fit into this taxonomy. New algorithms will be created that will not fit into this taxonomy.
</t> </t>
<section anchor="SigAlgs"> <section anchor="SigAlgs">
<name>Signature Algorithms</name> <name>Signature Algorithms</name>
<t> <t>
Signature algorithms provide data origination and data integrity servi ces. Signature algorithms provide data-origination and data-integrity servi ces.
Data origination provides the ability to infer who originated the data based on who signed the data. Data origination provides the ability to infer who originated the data based on who signed the data.
Data integrity provides the ability to verify that the data has not be en modified since it was signed. Data integrity provides the ability to verify that the data has not be en modified since it was signed.
</t> </t>
<t> <t>
There are two general signature algorithm schemes. There are two general signature algorithm schemes.
The first is signature with appendix. The first is signature with appendix.
In this scheme, the message content is processed and a signature is pr oduced; the signature is called the appendix. In this scheme, the message content is processed and a signature is pr oduced; the signature is called the appendix.
This is the scheme used by algorithms such as ECDSA and the RSA Probab ilistic Signature Scheme (RSASSA-PSS). This is the scheme used by algorithms such as ECDSA and the RSA Probab ilistic Signature Scheme (RSASSA-PSS).
(In fact, the SSA in RSASSA-PSS stands for Signature Scheme with Appen dix.) (In fact, the SSA in RSASSA-PSS stands for Signature Scheme with Appen dix.)
</t> </t>
<t> <t>
The signature functions for this scheme are: The signature functions for this scheme are:
</t> </t>
<artwork type=""><![CDATA[
<sourcecode type="">
signature = Sign(message content, key) signature = Sign(message content, key)
valid = Verification(message content, key, signature) valid = Verification(message content, key, signature)
]]></artwork> </sourcecode>
<t> <t>
The second scheme is signature with message recovery (an example of su ch an algorithm is <xref target="PVSig"/>). The second scheme is signature with message recovery; an example of su ch an algorithm is <xref target="PVSig"/>.
In this scheme, the message content is processed, but part of it is in cluded in the signature. In this scheme, the message content is processed, but part of it is in cluded in the signature.
Moving bytes of the message content into the signature allows for smal ler signatures; the signature size is still potentially large, but the message c ontent has shrunk. Moving bytes of the message content into the signature allows for smal ler signatures; the signature size is still potentially large, but the message c ontent has shrunk.
This has implications for systems implementing these algorithms and fo r applications that use them. This has implications for systems implementing these algorithms and ap plications that use them.
The first is that the message content is not fully available until aft er a signature has been validated. The first is that the message content is not fully available until aft er a signature has been validated.
Until that point, the part of the message contained inside of the sign ature is unrecoverable. Until that point, the part of the message contained inside of the sign ature is unrecoverable.
The second is that the security analysis of the strength of the signat ure can be very much dependent on the structure of the message content. The second implication is that the security analysis of the strength o f the signature can be very much dependent on the structure of the message conte nt.
Finally, in the event that multiple signatures are applied to a messag e, all of the signature algorithms are going to be required to consume the same bytes of message content. Finally, in the event that multiple signatures are applied to a messag e, all of the signature algorithms are going to be required to consume the same bytes of message content.
This means that the mixing of the signature with message recovery and signature with appendix schemes in a single message is not supported. This means that the mixing of the signature-with-message-recovery and signature-with-appendix schemes in a single message is not supported.
</t> </t>
<t>The signature functions for this scheme are: </t> <t>The signature functions for this scheme are: </t>
<artwork type=""><![CDATA[ <sourcecode type="">
signature, message sent = Sign(message content, key) signature, message sent = Sign(message content, key)
valid, message content = Verification(message sent, key, signature) valid, message content = Verification(message sent, key, signature)
]]></artwork> </sourcecode>
<t> <t>
No message recovery signature algorithms have been formally defined fo No message recovery signature algorithms have been formally defined fo
r COSE yet, and given the new constraints arising from this schemes, while some r COSE yet. Given the new constraints arising from this scheme, while some of th
of these issues have already been identified there is a high probability that ad ese issues have already been identified, there is a high probability that additi
ditional issues will arise when integrating message recovery signature algorithm onal issues will arise when integrating message recovery signature algorithms.
s. The first algorithm defined is going to need to make decisions about
The first algorithm defined is going to need to make decisions about these issues, and those decisions are likely to be binding on any further algor
these issues and those decisions are likely to be binding on any further algori ithms defined.
thms defined.
</t> </t>
<t> <t>
We use the following terms below: We use the following terms below:
</t> </t>
<dl> <dl>
<dt>message content bytes:</dt> <dt>message content bytes:</dt>
<dd>The byte provided by the application to be signed.</dd> <dd>The byte provided by the application to be signed.</dd>
<dt>to-be-signed bytes:</dt> <dt>to-be-signed bytes:</dt>
<dd>The byte string passed into the signature algorithm.</dd> <dd>The byte string passed into the signature algorithm.</dd>
skipping to change at line 1431 skipping to change at line 1461
</dl> </dl>
<t> <t>
Some of the issues that have already been identified are: Some of the issues that have already been identified are:
</t> </t>
<ul> <ul>
<li> <li>
The to-be-signed bytes are not the same as the message content bytes . The to-be-signed bytes are not the same as the message content bytes .
This is because we build a larger to-be-signed message during the si gnature processing. This is because we build a larger to-be-signed message during the si gnature processing.
The recovered bytes length may exceed the message content length, b ut not the length of the to-be-signed bytes. The length of the recovered bytes may exceed the length of the messa ge content, but not the length of the to-be-signed bytes.
This may lead to privacy considerations if, for example, the externa lly supplied data contains confidential information. This may lead to privacy considerations if, for example, the externa lly supplied data contains confidential information.
</li> </li>
<li> <li>
There may be difficulties in determining where the recovered bytes m atch up with the to-be-signed bytes, because the recovered bytes contains data not in the message content bytes. There may be difficulties in determining where the recovered bytes m atch up with the to-be-signed bytes, because the recovered bytes contain data no t in the message content bytes.
One possible option would be to create a padding scheme to prevent t hat. One possible option would be to create a padding scheme to prevent t hat.
</li> </li>
<li> <li>
Not all message recovery signature algorithms take the recovered by Not all message recovery signature algorithms take the recovered byt
tes from the end of the to-be-signed bytes. es from the end of the to-be-signed bytes.
This is a problem because the message content bytes are at the end o This is a problem, because the message content bytes are at the end
f the to-be-signed bytes. of the to-be-signed bytes.
If the bytes to be recovered are taken from the start of the to-be-s If the bytes to be recovered are taken from the start of the to-be-s
igned bytes then, by default, none of the message content bytes may be included igned bytes, then, by default, none of the message content bytes may be included
in the recovered bytes. in the recovered bytes.
One possible option to deal with this is to reverse the to-be-signed One possible option to deal with this is to reverse the to-be-signed
data in the event that recovered bytes are taken from the start rather than end data in the event that recovered bytes are taken from the start rather than the
of the to-be-signed bytes. end of the to-be-signed bytes.
</li> </li>
</ul> </ul>
<t> <t>
Signature algorithms are used with the COSE_Signature and COSE_Sign1 s tructures. Signature algorithms are used with the COSE_Signature and COSE_Sign1 s tructures.
At the time of this writing, only signatures with appendixes are defin ed for use with COSE; however, considerable interest has been expressed in using a signature with message recovery algorithm due to the effective size reduction that is possible. At the time of this writing, only signatures with appendices are defin ed for use with COSE; however, considerable interest has been expressed in using a signature-with-message-recovery algorithm, due to the effective size reductio n that is possible.
</t> </t>
</section> </section>
<section> <section>
<name>Message Authentication Code (MAC) Algorithms</name> <name>Message Authentication Code (MAC) Algorithms</name>
<t>Message Authentication Codes (MACs) provide data authentication and i ntegrity protection. They provide either no or very limited data origination. A MAC, for example, cannot be used to prove the identity of the sender to a thir d party. </t> <t>Message Authentication Codes (MACs) provide data authentication and i ntegrity protection. They provide either no or very limited data origination. A MAC, for example, cannot be used to prove the identity of the sender to a thir d party. </t>
<t>MACs use the same scheme as signature with appendix algorithms. The message content is processed and an authentication code is produced. The authen tication code is frequently called a tag. </t> <t>MACs use the same scheme as signature-with-appendix algorithms. The message content is processed, and an authentication code is produced. The authe ntication code is frequently called a tag. </t>
<t>The MAC functions are: </t> <t>The MAC functions are: </t>
<artwork type=""><![CDATA[ <sourcecode type="">
tag = MAC_Create(message content, key) tag = MAC_Create(message content, key)
valid = MAC_Verify(message content, key, tag) valid = MAC_Verify(message content, key, tag)
]]></artwork> </sourcecode>
<t> <t>
MAC algorithms can be based on either a block cipher algorithm (i.e., AE S-MAC) or a hash algorithm (i.e., a Hash-based Message Authentication Code (HMAC )). MAC algorithms can be based on either a block cipher algorithm (i.e., AE S-MAC) or a hash algorithm (i.e., a Hash-based Message Authentication Code (HMAC )).
<xref target="I-D.ietf-cose-rfc8152bis-algs"/> defines a MAC algorithm u sing each of these constructions. <xref target="RFC9053"/> defines a MAC algorithm using each of these con structions.
</t> </t>
<t>MAC algorithms are used in the COSE_Mac and COSE_Mac0 structures. </ t> <t>MAC algorithms are used in the COSE_Mac and COSE_Mac0 structures. </ t>
</section> </section>
<section> <section>
<name>Content Encryption Algorithms</name> <name>Content Encryption Algorithms</name>
<t>Content encryption algorithms provide data confidentiality for potent ially large blocks of data using a symmetric key. They provide integrity on the data that was encrypted; however, they provide either no or very limited data o rigination. (One cannot, for example, be used to prove the identity of the send er to a third party.) The ability to provide data origination is linked to how t he CEK is obtained. </t> <t>Content encryption algorithms provide data confidentiality for potent ially large blocks of data using a symmetric key. They provide integrity on the data that was encrypted; however, they provide either no or very limited data o rigination. (One cannot, for example, be used to prove the identity of the send er to a third party.) The ability to provide data origination is linked to how t he CEK is obtained. </t>
<t>COSE restricts the set of legal content encryption algorithms to thos e that support authentication both of the content and additional data. The encr yption process will generate some type of authentication value, but that value m ay be either explicit or implicit in terms of the algorithm definition. For sim plicity's sake, the authentication code will normally be defined as being append ed to the ciphertext stream. The encryption functions are: </t> <t>COSE restricts the set of legal content encryption algorithms to thos e that support authentication both of the content and additional data. The encr yption process will generate some type of authentication value, but that value m ay be either explicit or implicit in terms of the algorithm definition. For sim plicity's sake, the authentication code will normally be defined as being append ed to the ciphertext stream. The encryption functions are: </t>
<artwork type=""><![CDATA[ <sourcecode type="">
ciphertext = Encrypt(message content, key, additional data) ciphertext = Encrypt(message content, key, additional data)
valid, message content = Decrypt(ciphertext, key, additional data) valid, message content = Decrypt(ciphertext, key, additional data)
]]></artwork> </sourcecode>
<t>Most AEAD algorithms are logically defined as returning the message c <t>Most AEAD algorithms are logically defined as returning the message c
ontent only if the decryption is valid. Many but not all implementations will f ontent only if the decryption is valid. Many, but not all, implementations will
ollow this convention. The message content <bcp14>MUST NOT</bcp14> be used if t follow this convention. The message content <bcp14>MUST NOT</bcp14> be used if
he decryption does not validate. </t> the decryption does not validate. </t>
<t>These algorithms are used in COSE_Encrypt and COSE_Encrypt0. </t> <t>These algorithms are used in COSE_Encrypt and COSE_Encrypt0. </t>
</section> </section>
<section> <section>
<name>Key Derivation Functions (KDFs)</name> <name>Key Derivation Functions (KDFs)</name>
<t>KDFs are used to take some secret value and generate a different one. The secret value comes in three flavors: <t>KDFs are used to take some secret value and generate a different one. The secret value comes in three flavors:
</t> </t>
<ul> <ul>
<li>Secrets that are uniformly random: This is the type of secret tha <li>Secrets that are uniformly random. This is the type of secret tha
t is created by a good random number generator.</li> t is created by a good random number generator.</li>
<li>Secrets that are not uniformly random: This is type of secret that <li>Secrets that are not uniformly random. This is the type of secret
is created by operations like key agreement.</li> that is created by operations like key agreement.</li>
<li>Secrets that are not random: This is the type of secret that peopl <li>Secrets that are not random. This is the type of secret that peopl
e generate for things like passwords.</li> e generate for things like passwords.</li>
</ul> </ul>
<t> <t>
General KDFs work well with the first type of secret, can do reasonably well w General KDFs work well with the first type of secret, can do reasonably well w
ith the second type of secret, and generally do poorly with the last type of sec ith the second type of secret, and generally do poorly with the last type of sec
ret. ret. Functions like Argon2 <xref target="I-D.irtf-cfrg-argon2"/> need to be used
<!-- None of the KDFs in this section are designed to deal with the type of se for nonrandom secrets.
crets that are used for passwords. -->
Functions like Argon2 <xref target="I-D.irtf-cfrg-argon2"/> need to be used fo
r non-random secrets.
</t> </t>
<t> <t>
The same KDF can be set up to deal with the first two types of secrets in a di The same KDF can be set up to deal with the first two types of secrets in diff
fferent way. erent ways.
The KDF defined in section 5.1 of <xref target="I-D.ietf-cose-rfc8152bis-algs" The KDF defined in <xref target="RFC9053" sectionFormat="of" section="5.1"/> i
/> is such a function. s such a function.
This is reflected in the set of algorithms defined around the HMAC-based Extra ct-and-Expand Key Derivation Function (HKDF). This is reflected in the set of algorithms defined around the HMAC-based Extra ct-and-Expand Key Derivation Function (HKDF).
</t> </t>
<t>When using KDFs, one component that is included is context informatio n. Context information is used to allow for different keying information to be derived from the same secret. The use of context-based keying material is consi dered to be a good security practice. </t> <t>When using KDFs, one component that is included is context informatio n. Context information is used to allow for different keying information to be derived from the same secret. The use of context-based keying material is consi dered to be a good security practice. </t>
</section> </section>
<section anchor="key-management-algs"> <section anchor="key-management-algs">
<name>Content Key Distribution Methods</name> <name>Content Key Distribution Methods</name>
<t> <t>
Content key distribution methods (recipient algorithms) can be defined i nto a number of different classes. Content key distribution methods (recipient algorithms) can be defined i nto a number of different classes.
COSE has the ability to support many classes of recipient algorithms. COSE has the ability to support many classes of recipient algorithms.
In this section, a number of classes are listed. In this section, a number of classes are listed.
<!--[rfced] We note that one of the recipient algorithm classes listed in Sectio
n 8.5 does not appear in the cited RFC - specifically, key transport. Please rev
iew the accuracy of the statement below.
Original:
In this section, a number of classes are listed. The names of the recipient
algorithm
classes used here are the same as those defined in [RFC7516].
The classes listed in the section are:
Direct Encryption
Key Wrap
Key Transport ("also called key-encryption mode")
Direct Key Agreement
Key Agreement with Key Wrap
-->
The names of the recipient algorithm classes used here are the same as t hose defined in <xref target="RFC7516"/>. The names of the recipient algorithm classes used here are the same as t hose defined in <xref target="RFC7516"/>.
Other specifications use different terms for the recipient algorithm cla sses or do not support some of the recipient algorithm classes. Other specifications use different terms for the recipient algorithm cla sses or do not support some of the recipient algorithm classes.
</t> </t>
<section> <section>
<name>Direct Encryption</name> <name>Direct Encryption</name>
<t>The direct encryption class algorithms share a secret between the s ender and the recipient that is used either directly or after manipulation as th e CEK. When direct encryption mode is used, it <bcp14>MUST</bcp14> be the only mode used on the message. </t> <t>The Direct Encryption class of algorithms share a secret between th e sender and the recipient that is used either directly or after manipulation as the CEK. When direct-encryption mode is used, it <bcp14>MUST</bcp14> be the on ly mode used on the message. </t>
<t>The COSE_Recipient structure for the recipient is organized as foll ows: </t> <t>The COSE_Recipient structure for the recipient is organized as foll ows: </t>
<ul> <ul>
<li>The 'protected' field <bcp14>MUST</bcp14> be a zero-length byt <li>The "protected" field <bcp14>MUST</bcp14> be a zero-length byt
e string unless it is used in the computation of the content key. </li> e string unless it is used in the computation of the content key. </li>
<li>The 'alg' header parameter <bcp14>MUST</bcp14> be present. </ <li>The "alg" header parameter <bcp14>MUST</bcp14> be present. </
li> li>
<li>A header parameter identifying the shared secret <bcp14>SHOULD </bcp14> be present. </li> <li>A header parameter identifying the shared secret <bcp14>SHOULD </bcp14> be present. </li>
<li>The 'ciphertext' field <bcp14>MUST</bcp14> be a zero-length by <li>The "ciphertext" field <bcp14>MUST</bcp14> be a zero-length by
te string. </li> te string. </li>
<li>The 'recipients' field <bcp14>MUST</bcp14> be absent. </li> <li>The "recipients" field <bcp14>MUST</bcp14> be absent. </li>
</ul> </ul>
</section> </section>
<section anchor="key_wrap_algs"> <section anchor="key_wrap_algs">
<name>Key Wrap</name> <name>Key Wrap</name>
<t>In key wrap mode, the CEK is randomly generated and that key is the n encrypted by a shared secret between the sender and the recipient. All of the currently defined key wrap algorithms for COSE are AE algorithms. Key wrap mod e is considered to be superior to direct encryption if the system has any capabi lity for doing random key generation. This is because the shared key is used to wrap random data rather than data that has some degree of organization and may in fact be repeating the same content. The use of key wrap loses the weak data origination that is provided by the direct encryption algorithms. </t> <t>In key wrap mode, the CEK is randomly generated, and that key is th en encrypted by a shared secret between the sender and the recipient. All of th e currently defined key wrap algorithms for COSE are AE algorithms. Key wrap mo de is considered to be superior to Direct Encryption if the system has any capab ility for doing random-key generation. This is because the shared key is used t o wrap random data rather than data that has some degree of organization and may in fact be repeating the same content. The use of key wrap loses the weak data origination that is provided by the direct-encryption algorithms. </t>
<t>The COSE_Recipient structure for the recipient is organized as foll ows: </t> <t>The COSE_Recipient structure for the recipient is organized as foll ows: </t>
<ul> <ul>
<li>The 'protected' field <bcp14>MUST</bcp14> be absent if the key wrap algorithm is an AE algorithm. </li> <li>The "protected" field <bcp14>MUST</bcp14> be absent if the key wrap algorithm is an AE algorithm. </li>
<li> <li>
The 'recipients' field is normally absent, but can be used. The "recipients" field is normally absent but can be used.
Applications <bcp14>MUST</bcp14> deal with a recipient field being present that has an unsupported algorithm. Applications <bcp14>MUST</bcp14> deal with a recipient field being present that has an unsupported algorithm.
Failing to decrypt that specific recipient is an acceptable way of dealing with it. Failing to decrypt that specific recipient is an acceptable way of dealing with it.
Failing to process the message is not an acceptable way of dealing with it. Failing to process the message is not an acceptable way of dealing with it.
</li> </li>
<li>The plaintext to be encrypted is the key from next layer down (usually the content layer). <li>The plaintext to be encrypted is the key from the next layer d own (usually the content layer).
</li> </li>
<li>At a minimum, the 'unprotected' field <bcp14>MUST</bcp14> cont ain the 'alg' header parameter and <bcp14>SHOULD</bcp14> contain a header parame ter identifying the shared secret. </li> <li>At a minimum, the "unprotected" field <bcp14>MUST</bcp14> cont ain the "alg" header parameter and <bcp14>SHOULD</bcp14> contain a header parame ter identifying the shared secret. </li>
</ul> </ul>
</section> </section>
<section anchor="KeyTransport"> <section anchor="KeyTransport">
<name>Key Transport</name> <name>Key Transport</name>
<t>Key transport mode is also called key encryption mode in some stand ards. Key transport mode differs from key wrap mode in that it uses an asymmetr ic encryption algorithm rather than a symmetric encryption algorithm to protect the key. <t>Key transport mode is also called key encryption mode in some stand ards. Key transport mode differs from key wrap mode in that it uses an asymmetr ic encryption algorithm rather than a symmetric encryption algorithm to protect the key.
A set of key transport algorithms are defined in <xref target="RFC8230"/ >. A set of key transport algorithms is defined in <xref target="RFC8230"/> .
</t> </t>
<t>When using a key transport algorithm, the COSE_Recipient structure for the recipient is organized as follows: <t>When using a key transport algorithm, the COSE_Recipient structure for the recipient is organized as follows:
</t> </t>
<ul> <ul>
<li>The 'protected' field <bcp14>MUST</bcp14> be absent. </li> <li>The "protected" field <bcp14>MUST</bcp14> be absent. </li>
<li>The plaintext to be encrypted is the key from the next layer d own (usually the content layer). </li> <li>The plaintext to be encrypted is the key from the next layer d own (usually the content layer). </li>
<li>At a minimum, the 'unprotected' field <bcp14>MUST</bcp14> cont ain the 'alg' header parameter and <bcp14>SHOULD</bcp14> contain a parameter ide ntifying the asymmetric key. </li> <li>At a minimum, the "unprotected" field <bcp14>MUST</bcp14> cont ain the "alg" header parameter and <bcp14>SHOULD</bcp14> contain a parameter ide ntifying the asymmetric key. </li>
</ul> </ul>
</section> </section>
<section> <section>
<name>Direct Key Agreement</name> <name>Direct Key Agreement</name>
<t>The 'direct key agreement' class of recipient algorithms uses a key <t>The Direct Key Agreement class of recipient algorithms uses a key a
agreement method to create a shared secret. A KDF is then applied to the share greement method to create a shared secret. A KDF is then applied to the shared
d secret to derive a key to be used in protecting the data. This key is normall secret to derive a key to be used in protecting the data. This key is normally
y used as a CEK or MAC key, but could be used for other purposes if more than tw used as a CEK or MAC key but could be used for other purposes if more than two l
o layers are in use (see <xref target="three-layer"/>). </t> ayers are in use (see <xref target="three-layer"/>). </t>
<t>The most commonly used key agreement algorithm is Diffie-Hellman, b <t>The most commonly used key agreement algorithm is Diffie-Hellman, b
ut other variants exist. Since COSE is designed for a store and forward environ ut other variants exist. Since COSE is designed for a store-and-forward environ
ment rather than an online environment, many of the DH variants cannot be used a ment rather than an online environment, many of the DH variants cannot be used,
s the receiver of the message cannot provide any dynamic key material. One side as the receiver of the message cannot provide any dynamic key material. One sid
effect of this is that forward secrecy (see <xref target="RFC4949"/>) is not ac e effect of this is that forward secrecy (see <xref target="RFC4949"/>) is not a
hievable. A static key will always be used for the receiver of the COSE object. chievable. A static key will always be used for the receiver of the COSE object
</t> . </t>
<t> <t>
Two variants of DH that are supported are: Two variants of DH that are supported are:
</t> </t>
<ul empty="true"> <dl>
<li>Ephemeral-Static (ES) DH: where the sender of the message crea <dt>Ephemeral-Static (ES) DH:</dt><dd>The sender of the message create
tes a one-time DH key and uses a static key for the recipient. The use of the e s a one-time DH key and uses a static key for the recipient. The use of the eph
phemeral sender key means that no additional random input is needed as this is r emeral sender key means that no additional random input is needed, as this is ra
andomly generated for each message. </li> ndomly generated for each message.</dd>
<li> <dt>Static-Static (SS) DH:</dt><dd>A static key is used for both t
Static-Static (SS) DH: where a static key is used for both the sen he sender and the recipient. The use of static keys allows for the recipient to
der and the recipient. The use of static keys allows for the recipient to get a get a weak version of data origination for the message. When static-static key
weak version of data origination for the message. When static-static key agree agreement is used, then some piece of unique data for the KDF is required to en
ment is used, then some piece of unique data for the KDF is required to ensure t sure that a different key is created for each message.</dd>
hat a different key is created for each message. </dl>
</li>
</ul>
<t>When direct key agreement mode is used, there <bcp14>MUST</bcp14> b e only one recipient in the message. This method creates the key directly, and that makes it difficult to mix with additional recipients. If multiple recipien ts are needed, then the version with key wrap needs to be used. </t> <t>When direct key agreement mode is used, there <bcp14>MUST</bcp14> b e only one recipient in the message. This method creates the key directly, and that makes it difficult to mix with additional recipients. If multiple recipien ts are needed, then the version with key wrap needs to be used. </t>
<t>The COSE_Recipient structure for the recipient is organized as foll ows: </t> <t>The COSE_Recipient structure for the recipient is organized as foll ows: </t>
<ul> <ul>
<li>At a minimum, headers <bcp14>MUST</bcp14> contain the 'alg' h eader parameter and <bcp14>SHOULD</bcp14> contain a header parameter identifying the recipient's asymmetric key. </li> <li>At a minimum, headers <bcp14>MUST</bcp14> contain the "alg" h eader parameter and <bcp14>SHOULD</bcp14> contain a header parameter identifying the recipient's asymmetric key. </li>
<li>The headers <bcp14>SHOULD</bcp14> identify the sender's key fo r the static-static versions and <bcp14>MUST</bcp14> contain the sender's epheme ral key for the ephemeral-static versions. </li> <li>The headers <bcp14>SHOULD</bcp14> identify the sender's key fo r the static-static versions and <bcp14>MUST</bcp14> contain the sender's epheme ral key for the ephemeral-static versions. </li>
</ul> </ul>
</section> </section>
<section anchor="ECDH-Direct"> <section anchor="ECDH-Direct">
<name>Key Agreement with Key Wrap</name> <name>Key Agreement with Key Wrap</name>
<t>Key Agreement with Key Wrap uses a randomly generated CEK. The CEK is then encrypted using a key wrap algorithm and a key derived from the shared secret computed by the key agreement algorithm. The function for this would be: </t> <t>Key Agreement with Key Wrap uses a randomly generated CEK. The CEK is then encrypted using a key wrap algorithm and a key derived from the shared secret computed by the key agreement algorithm. The function for this would be: </t>
<artwork type=""><![CDATA[ <sourcecode type="">
encryptedKey = KeyWrap(KDF(DH-Shared, context), CEK) encryptedKey = KeyWrap(KDF(DH-Shared, context), CEK)
]]></artwork> </sourcecode>
<t>The COSE_Recipient structure for the recipient is organized as foll ows: </t> <t>The COSE_Recipient structure for the recipient is organized as foll ows: </t>
<ul> <ul>
<li>The 'protected' field is fed into the KDF context structure. </li> <li>The "protected" field is fed into the KDF context structure. </li>
<li>The plaintext to be encrypted is the key from the next layer d own (usually the content layer). </li> <li>The plaintext to be encrypted is the key from the next layer d own (usually the content layer). </li>
<li>The 'alg' header parameter <bcp14>MUST</bcp14> be present in t he layer. </li> <li>The "alg" header parameter <bcp14>MUST</bcp14> be present in t he layer. </li>
<li>A header parameter identifying the recipient's key <bcp14>SHOU LD</bcp14> be present. A header parameter identifying the sender's key <bcp14>S HOULD</bcp14> be present. </li> <li>A header parameter identifying the recipient's key <bcp14>SHOU LD</bcp14> be present. A header parameter identifying the sender's key <bcp14>S HOULD</bcp14> be present. </li>
</ul> </ul>
</section> </section>
</section> </section>
</section> </section>
<section anchor="CBOR-Canonical"> <section anchor="CBOR-Canonical">
<name>CBOR Encoding Restrictions</name> <name>CBOR Encoding Restrictions</name>
<t> <t>
This document limits the restrictions it imposes on how the CBOR Encoder needs to work. This document limits the restrictions it imposes on how the CBOR encoder needs to work.
It has been narrowed down to the following restrictions: It has been narrowed down to the following restrictions:
<!-- RFC EDITOR: <!-- [rfced] The following note was included in the XML file:
If the CBOR bis document manages to get there at about the same tim
e I want to add a sentence here.
Sentence to the effect that this matches the deterministic encoding RFC EDITOR:
in STD XXX> If the CBOR bis document manages to get there at about the same tim
e I want to add a sentence here. Sentence to the effect that this matches the de
terministic encoding in STD XXX
Does "CBOR bis document" refer to RFC 8949 (Concise Binary Object Representation
(CBOR))? If yes, please provide text (as needed) to address this comment.
--> -->
</t> </t>
<ul> <ul>
<li> <li>
The restriction applies to the encoding of the Sig_structure, the Enc_ <!--[rfced] FYI, we edited the list item below per Erratum 5066 for RFC 8152.
structure, and the MAC_structure.
Original:
This document limits the restrictions it imposes on how the CBOR
Encoder needs to work. It has been narrowed down to the following
restrictions:
* The restriction applies to the encoding of the Sig_structure, the Enc_structur
e, and the MAC_structure.
Changed to:
...
* The restriction applies to the encoding of the COSE_KDF_Context, the Sig_struc
ture, the Enc_structure, and the MAC_structure.
-->
The restriction applies to the encoding of the COSE_KDF_Context, the S
ig_structure, the Enc_structure, and the MAC_structure.
</li> </li>
<li> <li>
Encoding <bcp14>MUST</bcp14> be done using definite lengths and the va lue's length <bcp14>MUST</bcp14> be the minimum possible length. Encoding <bcp14>MUST</bcp14> be done using definite lengths, and the v alue's length <bcp14>MUST</bcp14> be the minimum possible length.
This means that the integer 1 is encoded as "0x01" and not "0x1801". This means that the integer 1 is encoded as "0x01" and not "0x1801".
</li> </li>
<li> <li>
Applications <bcp14>MUST NOT</bcp14> generate messages with the same l abel used twice as a key in a single map. Applications <bcp14>MUST NOT</bcp14> generate messages with the same l abel used twice as a key in a single map.
Applications <bcp14>MUST NOT</bcp14> parse and process messages with t he same label used twice as a key in a single map. Applications <bcp14>MUST NOT</bcp14> parse and process messages with t he same label used twice as a key in a single map.
Applications can enforce the parse and process requirement by using pa rsers that will fail the parse step or by using parsers that will pass all keys to the application, and the application can perform the check for duplicate keys . Applications can enforce the parse and process requirement by using pa rsers that will fail the parse step or by using parsers that will pass all keys to the application, and the application can perform the check for duplicate keys .
</li> </li>
</ul> </ul>
</section> </section>
<section anchor="app-considerations"> <section anchor="app-considerations">
<name>Application Profiling Considerations</name> <name>Application Profiling Considerations</name>
<t>This document is designed to provide a set of security services, but no t impose algorithm implementation requirements for specific usage. The interope rability requirements are provided for how each of the individual services are u sed and how the algorithms are to be used for interoperability. The requirement s about which algorithms and which services are needed are deferred to each appl ication. </t> <t>This document is designed to provide a set of security services but not impose algorithm implementation requirements for specific usage. The interoper ability requirements are provided for how each of the individual services are us ed and how the algorithms are to be used for interoperability. The requirements about which algorithms and which services are needed are deferred to each appli cation. </t>
<t> <t>
An example of a profile can be found in <xref target="RFC8613"/> where o ne was developed for carrying content in combination with CoAP headers. An example of a profile can be found in <xref target="RFC8613"/>, where one was developed for carrying content in combination with CoAP headers.
</t> </t>
<t>It is intended that a profile of this document be created that defines the interoperability requirements for that specific application. This section p rovides a set of guidelines and topics that need to be considered when profiling this document. <t>It is intended that a profile of this document be created that defines the interoperability requirements for that specific application. This section p rovides a set of guidelines and topics that need to be considered when profiling this document.
</t> </t>
<ul> <ul>
<li>Applications need to determine the set of messages defined in this d ocument that they will be using. The set of messages corresponds fairly directl y to the set of security services that are needed and to the security levels nee ded. </li> <li>Applications need to determine the set of messages defined in this d ocument that they will be using. The set of messages corresponds fairly directl y to the needed set of security services security levels.</li>
<li> <li>
Applications may define new header parameters for a specific purpose. Applications may define new header parameters for a specific purpose.
Applications will often times select specific header parameters to use o r not to use. Applications will oftentimes select specific header parameters to use or not to use.
For example, an application would normally state a preference for using either the IV or the Partial IV header parameter. For example, an application would normally state a preference for using either the IV or the Partial IV header parameter.
If the Partial IV header parameter is specified, then the application al so needs to define how the fixed portion of the IV is determined. If the Partial IV header parameter is specified, then the application al so needs to define how the fixed portion of the IV is determined.
</li> </li>
<li>When applications use externally defined authenticated data, they ne ed to define how that data is encoded. This document assumes that the data will be provided as a byte string. More information can be found in <xref target="E xtern_AAD"/>. </li> <li>When applications use externally defined authenticated data, they ne ed to define how that data is encoded. This document assumes that the data will be provided as a byte string. More information can be found in <xref target="E xtern_AAD"/>. </li>
<li>Applications need to determine the set of security algorithms that a <li>Applications need to determine the set of security algorithms that i
re to be used. When selecting the algorithms to be used as the mandatory-to-imp s to be used. When selecting the algorithms to be used as the mandatory-to-impl
lement set, consideration should be given to choosing different types of algorit ement set, consideration should be given to choosing different types of algorith
hms when two are chosen for a specific purpose. ms when two are chosen for a specific purpose.
An example of this would be choosing HMAC-SHA512 and AES-CMAC as differe An example of this would be choosing HMAC-SHA512 and AES-CMAC (Cipher-Ba
nt MAC algorithms; the construction is vastly different between these two algori sed Message Authentication Code) as different MAC algorithms; the construction i
thms. This means that a weakening of one algorithm would be unlikely to lead to s vastly different between these two algorithms. This means that a weakening of
a weakening of the other algorithms. Of course, these algorithms do not provid one algorithm would be unlikely to lead to a weakening of the other algorithms.
e the same level of security and thus may not be comparable for the desired secu Of course, these algorithms do not provide the same level of security and thus
rity functionality. may not be comparable for the desired security functionality.
Additional guidance can be found in <xref target="BCP201"/>. Additional guidance can be found in <xref target="BCP201"/>.
</li> </li>
<li> <li>
<t>Applications may need to provide some type of negotiation or discov ery method if multiple algorithms or message structures are permitted. The meth od can be as simple as requiring pre-configuration of the set of algorithms to p roviding a discovery method built into the protocol. S/MIME provided a number o f different ways to approach the problem that applications could follow: <t>Applications may need to provide some type of negotiation or discov ery method if multiple algorithms or message structures are permitted. The meth od can be as simple as requiring preconfiguration of the set of algorithms to pr oviding a discovery method built into the protocol. S/MIME provided a number of different ways to approach the problem that applications could follow:
</t> </t>
<ul> <ul>
<li>Advertising in the message (S/MIME capabilities) <xref target= "RFC5751"/>.</li> <li>Advertising in the message (S/MIME capabilities) <xref target= "RFC8551"/>.</li>
<li>Advertising in the certificate (capabilities extension) <xref target="RFC4262"/>.</li> <li>Advertising in the certificate (capabilities extension) <xref target="RFC4262"/>.</li>
<li>Minimum requirements for the S/MIME, which have been updated o ver time <xref target="RFC2633"/> <xref target="RFC5751"/> (note that <xref targ et="RFC2633"/> has been obsoleted by <xref target="RFC5751"/>).</li> <li>Minimum requirements for the S/MIME, which have been updated o ver time <xref target="RFC2633"/> <xref target="RFC5751"/> <xref target="RFC8551 "/>. (Note that <xref target="RFC2633"/> was obsoleted by <xref target="RFC3851" />, which was obsoleted by <xref target="RFC5751"/>, which was obsoleted by <xre f target="RFC8551"/>.)</li>
</ul> </ul>
</li> </li>
</ul> </ul>
</section> </section>
<section anchor="iana-considerations"> <section anchor="iana-considerations">
<name>IANA Considerations</name> <name>IANA Considerations</name>
<t> <t>
The registries and registrations listed below were created during proces sing of RFC 8152 <xref target="RFC8152"/>. The registries and registrations listed below were defined by RFC 8152 < xref target="RFC8152"/>.
The majority of the following actions are to update the references to po int to this document. The majority of the following actions are to update the references to po int to this document.
</t> </t>
<t> <t>
Note that while <xref target="I-D.ietf-cose-rfc8152bis-algs"/> also upda
tes the registries and registrations originally established by <xref target="RFC Note that while <xref target="RFC9053"/> also updates the registries and
8152"/>, the requested updates are mutually exclusive. The updates requested in registrations originally established by <xref target="RFC8152"/>, the requested
this document do not conflict or overlap with the updates requested in <xref ta updates are mutually exclusive. The updates requested in this document do not
rget="I-D.ietf-cose-rfc8152bis-algs"/>, and vice versa. conflict or overlap with the updates requested in <xref target="RFC9053"/>, and
vice versa.
</t> </t>
<section anchor="cose-header-key-table"> <section anchor="cose-header-key-table">
<name>COSE Header Parameters Registry</name> <name>COSE Header Parameters Registry</name>
<t> <t>
IANA created a registry titled "COSE Header Parameters" as part of pro The "COSE Header Parameters" registry was defined by <xref target="RFC
cessing <xref target="RFC8152"/>. 8152"/>.
IANA is requested to update the reference for this registry from <xref IANA has updated the reference for this registry to point to this docu
target="RFC8152"/> to this document. IANA is also requested to update the refe ment instead of <xref target="RFC8152"/>. IANA has also updated all entries that
rence for all entries, except "counter signature" and "CounterSignature0", in th referenced <xref target="RFC8152"/>, except "counter signature" and "CounterSig
e table from <xref target="RFC8152"/> to this document. The reference for "coun nature0", to refer to this document. The references for "counter signature" and
ter signature" and "CounterSignature0" are to be left as-is. "CounterSignature0" continue to reference <xref target="RFC8152"/>.
</t> </t>
</section> </section>
<section anchor="cose-key-map-registry"> <section anchor="cose-key-map-registry">
<name>COSE Key Common Parameters Registry</name> <name>COSE Key Common Parameters Registry</name>
<t> <t>
IANA created a registry titled "COSE Key Common Parameters" as part of The "COSE Key Common Parameters" registry was defined <xref target="RF
the processing of <xref target="RFC8152"/>. C8152"/>.
IANA is requested to update the reference for this registry from <xref IANA has updated the reference for this registry to point to this docu
target="RFC8152"/> to this document. IANA is also requested to update the refe ment instead of <xref target="RFC8152"/>. IANA has also updated the entries tha
rence for entries in the table from <xref target="RFC8152"/> to this document. t referenced <xref target="RFC8152"/> to refer to this document.
</t> </t>
</section> </section>
<section> <section>
<name>Media Type Registrations</name> <name>Media Type Registrations</name>
<section> <section>
<name>COSE Security Message</name> <name>COSE Security Message</name>
<t>This section registers the 'application/cose' media type in the "Me <t>IANA has registered the "application/cose" media type in the "Media
dia Types" registry. These media types are used to indicate that the content is Types" registry. These media types are used to indicate that the content is a
a COSE message. </t> COSE message. </t>
<ul empty="true"> <dl>
<li>Type name: application</li> <dt>Type name:</dt><dd>application</dd>
<li>Subtype name: cose</li> <dt>Subtype name:</dt><dd>cose</dd>
<li>Required parameters: N/A</li> <dt>Required parameters:</dt><dd>N/A</dd>
<li>Optional parameters: cose-type</li> <dt>Optional parameters:</dt><dd>cose-type</dd>
<li>Encoding considerations: binary</li> <dt>Encoding considerations:</dt><dd>binary</dd>
<li>Security considerations: See the Security Considerations secti <dt>Security considerations:</dt><dd>See the Security Consideratio
on of [[This Document]].</li> ns section of RFC 9052.</dd>
<li>Interoperability considerations: N/A</li> <dt>Interoperability considerations:</dt><dd>N/A</dd>
<li>Published specification: [[this document]]</li> <dt>Published specification:</dt><dd>RFC 9052</dd>
<li>Applications that use this media type: IoT applications sendin <dt>Applications that use this media type:</dt><dd>IoT application
g security content over HTTP(S) transports.</li> s sending security content over HTTP(S) transports.</dd>
<li>Fragment identifier considerations: N/A</li> <dt>Fragment identifier considerations:</dt><dd>N/A</dd>
<li> <dt>Additional information:</dt><dd>
<t>Additional information:
</t>
<ul> <ul>
<li>Deprecated alias names for this type: N/A</li> <li>Deprecated alias names for this type: N/A</li>
<li>Magic number(s): N/A</li> <li>Magic number(s): N/A</li>
<li>File extension(s): cbor</li> <li>File extension(s): cbor</li>
<li>Macintosh file type code(s): N/A</li> <li>Macintosh file type code(s): N/A</li>
</ul> </ul>
</li> </dd>
<li>Person &amp; email address to contact for further information:
iesg@ietf.org</li> <dt>Person &amp; email address to contact for further information:
<li>Intended usage: COMMON</li> </dt><dd>iesg@ietf.org</dd>
<li>Restrictions on usage: N/A</li> <dt>Intended usage:</dt><dd>COMMON</dd>
<li>Author: Jim Schaad, ietf@augustcellars.com</li> <dt>Restrictions on usage:</dt><dd>N/A</dd>
<li>Change Controller: IESG</li> <!-- [rfced] Please confirm that Jim, along with his email address, should conti
<li>Provisional registration? No</li> nue to be listed as author in the three media type registrtions.
</ul>
Author: Jim Schaad, ietf@augustcellars.com
-->
<dt>Author:</dt><dd>Jim Schaad, ietf@augustcellars.com</dd>
<dt>Change Controller:</dt><dd>IESG</dd>
<dt>Provisional registration?</dt><dd>No</dd>
</dl>
</section> </section>
<section> <section>
<name>COSE Key Media Type</name> <name>COSE Key Media Type</name>
<t>This section registers the 'application/cose-key' and 'application/ <t>IANA has registered the "application/cose-key" and "application/cos
cose-key-set' media types in the "Media Types" registry. These media types are e-key-set" media types in the "Media Types" registry. These media types are use
used to indicate, respectively, that content is a COSE_Key or COSE_KeySet object d to indicate, respectively, that content is a COSE_Key or COSE_KeySet object.
. </t> </t>
<t>The template for registering 'application/cose-key' is: <t>The template for "application/cose-key" is as follows:
</t> </t>
<ul empty="true"> <dl>
<li>Type name: application</li> <dt>Type name:</dt><dd>application</dd>
<li>Subtype name: cose-key</li> <dt>Subtype name:</dt><dd>cose-key</dd>
<li>Required parameters: N/A</li> <dt>Required parameters:</dt><dd>N/A</dd>
<li>Optional parameters: N/A</li> <dt>Optional parameters:</dt><dd>N/A</dd>
<li>Encoding considerations: binary</li> <dt>Encoding considerations:</dt><dd>binary</dd>
<li>Security considerations: See the Security Considerations secti <dt>Security considerations:</dt><dd>See the Security Consideratio
on of [[This Document]].</li> ns section of RFC 9052.</dd>
<li>Interoperability considerations: N/A</li> <dt>Interoperability considerations:</dt><dd>N/A</dd>
<li>Published specification: [[this document]]</li> <dt>Published specification:</dt><dd>RFC 9052</dd>
<li>Applications that use this media type: Distribution of COSE ba <dt>Applications that use this media type:</dt><dd>Distribution of
sed keys for IoT applications.</li> COSE-based keys for IoT applications.</dd>
<li>Fragment identifier considerations: N/A</li> <dt>Fragment identifier considerations:</dt><dd>N/A</dd>
<li> <dt>Additional information:</dt><dd>
<t>Additional information:
</t>
<ul> <ul>
<li>Deprecated alias names for this type: N/A</li> <li>Deprecated alias names for this type: N/A</li>
<li>Magic number(s): N/A</li> <li>Magic number(s): N/A</li>
<li>File extension(s): cbor</li> <li>File extension(s): cbor</li>
<li>Macintosh file type code(s): N/A</li> <li>Macintosh file type code(s): N/A</li>
</ul> </ul>
</li> </dd>
<li>Person &amp; email address to contact for further information: <dt>Person &amp; email address to contact for further information:
iesg@ietf.org</li> </dt><dd>iesg@ietf.org</dd>
<li>Intended usage: COMMON</li> <dt>Intended usage:</dt><dd>COMMON</dd>
<li>Restrictions on usage: N/A</li> <dt>Restrictions on usage:</dt><dd>N/A</dd>
<li>Author: Jim Schaad, ietf@augustcellars.com</li> <dt>Author:</dt><dd>Jim Schaad, ietf@augustcellars.com</dd>
<li>Change Controller: IESG</li> <dt>Change Controller:</dt><dd>IESG</dd>
<li>Provisional registration? No</li> <dt>Provisional registration?</dt><dd>No</dd>
</ul> </dl>
<t>The template for registering 'application/cose-key-set' is: <t>The template for registering "application/cose-key-set" is:
</t> </t>
<ul empty="true"> <dl>
<li>Type name: application</li> <dt>Type name:</dt><dd>application</dd>
<li>Subtype name: cose-key-set</li> <dt>Subtype name:</dt><dd>cose-key-set</dd>
<li>Required parameters: N/A</li> <dt>Required parameters:</dt><dd>N/A</dd>
<li>Optional parameters: N/A</li> <dt>Optional parameters:</dt><dd>N/A</dd>
<li>Encoding considerations: binary</li> <dt>Encoding considerations:</dt><dd>binary</dd>
<li>Security considerations: See the Security Considerations secti <dt>Security considerations:</dt><dd>See the Security Consideratio
on of [[This Document]].</li> ns section of RFC 9052.</dd>
<li>Interoperability considerations: N/A</li> <dt>Interoperability considerations:</dt><dd>N/A</dd>
<li>Published specification: [[this document]]</li> <dt>Published specification:</dt><dd>RFC 9052</dd>
<li>Applications that use this media type: Distribution of COSE ba <dt>Applications that use this media type:</dt><dd>Distribution of
sed keys for IoT applications.</li> COSE-based keys for IoT applications.</dd>
<li>Fragment identifier considerations: N/A</li> <dt>Fragment identifier considerations:</dt><dd>N/A</dd>
<li> <dt>Additional information:</dt><dd>
<t>Additional information:
</t>
<ul> <ul>
<li>Deprecated alias names for this type: N/A</li> <li>Deprecated alias names for this type: N/A</li>
<li>Magic number(s): N/A</li> <li>Magic number(s): N/A</li>
<li>File extension(s): cbor</li> <li>File extension(s): cbor</li>
<li>Macintosh file type code(s): N/A</li> <li>Macintosh file type code(s): N/A</li>
</ul> </ul>
</li> </dd>
<li>Person &amp; email address to contact for further information: <dt>Person &amp; email address to contact for further information:
iesg@ietf.org</li> </dt><dd>iesg@ietf.org</dd>
<li>Intended usage: COMMON</li> <dt>Intended usage:</dt><dd>COMMON</dd>
<li>Restrictions on usage: N/A</li> <dt>Restrictions on usage:</dt><dd>N/A</dd>
<li>Author: Jim Schaad, ietf@augustcellars.com</li> <dt>Author:</dt><dd>Jim Schaad, ietf@augustcellars.com</dd>
<li>Change Controller: IESG</li> <dt>Change Controller:</dt><dd>IESG</dd>
<li>Provisional registration? No</li> <dt>Provisional registration?</dt><dd>No</dd>
</ul> </dl>
</section> </section>
</section> </section>
<section> <section>
<name>CoAP Content-Formats Registry</name> <name>CoAP Content-Formats Registry</name>
<t> <t>
IANA added entries to the "CoAP Content-Formats" registry while proce IANA added entries to the "CoAP Content-Formats" registry as defined i
ssing <xref target="RFC8152"/>. n <xref target="RFC8152"/>. IANA has updated the reference to point to this doc
IANA is requested to update the reference value from <xref target="RFC ument instead of <xref target="RFC8152"/>.
8152"/> to [[This Document]].
</t> </t>
</section> </section>
<section> <section>
<name>CBOR Tags Registry</name> <name>CBOR Tags Registry</name>
<t> <t>
IANA is requested to update the references from <xref target="RFC8152" /> to [[This Document]]. IANA has updated the references to point to this document instead of <xref target="RFC8152"/>.
</t> </t>
</section> </section>
<section title="Expert Review Instructions" anchor="review" > <section title="Expert Review Instructions" anchor="review" >
<!-- [rfced] We note that many of the registration procedures defined in RFC 812
6 are mentioned, but the RFC is not referenced. Please consider adding an in-te
xt citation somewhere. One option might be to add a general sentence to Section
11. Another option would be to add it where registration procedures are mentio
ned.
-->
<t> <t>
All of the IANA registries established by <xref target="RFC8152"/> are , at least in part, defined as expert review. This section gives some general g uidelines for what the experts should be looking for, but they are being designa ted as experts for a reason, so they should be given substantial latitude. All of the IANA registries established by <xref target="RFC8152"/> are , at least in part, defined as expert review. This section gives some general g uidelines for what the experts should be looking for, but they are being designa ted as experts for a reason, so they should be given substantial latitude.
</t> </t>
<t>Expert reviewers should take into consideration the following points: </t> <t>Expert reviewers should take the following into consideration:</t>
<ul> <ul>
<li>Point squatting should be discouraged. Reviewers are encouraged to get suff icient information for registration requests to ensure that the usage is not goi ng to duplicate an existing registration and that the code point is likely to be used in deployments. The zones tagged as private use are intended for testing purposes and closed environments; code points in other ranges should not be assi gned for testing. </li>
<li>Point squatting should be discouraged. Reviewers are encouraged to get suff icient information for registration requests to ensure that the usage is not goi ng to duplicate one that is already registered, and that the point is likely to be used in deployments. The zones tagged as private use are intended for testin g purposes and closed environments; code points in other ranges should not be as signed for testing. </li> <!-- [rfced] RFC 8126 indicates that Standards Track or BCP RFCs are required to register something via Standards Action. Using "specifications" to refer to St andards Track documents could be confusing. For clarity, we suggest an update. Also, we suggest updating "before a specification is available" to "before an R FC is available".
<li>Specifications are required for the standards track range of point assignmen Original:
t. Specifications should exist for specification required ranges, but early ass * Specifications are required for the standards track range of point
ignment before a specification is available is considered to be permissible. Sp assignment. Specifications should exist for specification
ecifications are needed for the first-come, first-serve range if they are expect required ranges, but early assignment before a specification is
ed to be used outside of closed environments in an interoperable way. When spec available is considered to be permissible. Specifications are
ifications are not provided, the description provided needs to have sufficient i needed for the first-come, first-serve range if they are expected
nformation to identify what the point is being used for. </li> to be used outside of closed environments in an interoperable way.
When specifications are not provided, the description provided
needs to have sufficient information to identify what the point is
being used for.
<li>Experts should take into account the expected usage of fields when approving Perhaps:
point assignment. The fact that there is a range for standards track documents * Standards Track or BCP RFCs are required to register a code point in the S
does not mean that a standards track document cannot have points assigned outsi tandards Action range. Specifications should exist for specification-
de of that range. The length of the encoded value should be weighed against how required ranges, but early assignment before an RFC is
many code points of that length are left, the size of device it will be used on available is permissible. Specifications are
, and the number of code points left that encode to that size. </li> needed for the first-come, first-serve range if the points are
expected to be used outside of closed environments in an
interoperable way. When specifications are not provided, the
description provided needs to have sufficient information to
identify what the point is being used for.
-->
<li>When algorithms are registered, vanity registrations should be discouraged. <li>Specifications are required for the Standards Track range of code point assi
One way to do this is to require registrations to provide additional documentat gnment. Specifications should exist for specification required ranges, but earl
ion on security analysis of the algorithm. Another thing that should be conside y assignment before a specification is available is considered to be permissible
red is requesting an opinion on the algorithm from the Crypto Forum Research Gro . Specifications are needed for the first-come, first-serve range if the points
up (CFRG). Algorithms that do not meet the security requirements of the communi are expected to be used outside of closed environments in an interoperable way.
ty and the messages structures should not be registered. </li> When specifications are not provided, the description provided needs to have s
ufficient information to identify what the point is being used for. </li>
<li>Experts should take into account the expected usage of fields when approving
code point assignment.
<!-- [rfced] Should "range for standards track documents" be "Standards Action r
ange"?
Original:
The fact that there is a range for
standards track documents does not mean that a standards track
document cannot have points assigned outside of that range.
-->
The fact that there is a range for Standards Track documents does not mean that
a Standards Track document cannot have code points assigned outside of that rang
e. The length of the encoded value should be weighed against how many code poin
ts of that length are left, the size of device it will be used on, and the numbe
r of code points left that encode to that size. </li>
<li>When algorithms are registered, vanity registrations should be discouraged.
One way to do this is to require registrations to provide additional documentat
ion on security analysis of the algorithm. Another thing that should be conside
red is requesting an opinion on the algorithm from the Crypto Forum Research Gro
up (CFRG).
<!-- [rfced] What does "community and the message structures" refer to?
Original:
Algorithms that do not meet the security requirements of
the community and the messages structures should not be
registered.
-->
Algorithms that do not meet the security requirements of
the community and the message structures should not be registered. </li>
</ul> </ul>
</section> </section>
</section> </section>
<section anchor="security-considerations"> <section anchor="security-considerations">
<name>Security Considerations</name> <name>Security Considerations</name>
<t> <t>
There are a number of security considerations that need to be taken into account by implementers of this specification. There are a number of security considerations that need to be taken into account by implementers of this specification.
While some considerations have been highlighted here, additional conside rations may be found in the documents listed in the references. While some considerations have been highlighted here, additional conside rations may be found in the documents listed in the references.
</t> </t>
<t>Implementations need to protect the private key material for any indivi duals. There are some cases that need to be highlighted on this issue. <t>Implementations need to protect the private key material for all indivi duals. There are some cases that need to be highlighted on this issue.
</t> </t>
<ul> <ul>
<li>Using the same key for two different algorithms can leak information <li>Use of the same key for two different algorithms can leak informatio
about the key. It is therefore recommended that keys be restricted to a single n about the key. It is therefore recommended that keys be restricted to a singl
algorithm. </li> e algorithm. </li>
<li>Use of 'direct' as a recipient algorithm combined with a second reci <li>Use of "direct" as a recipient algorithm combined with a second reci
pient algorithm exposes the direct key to the second recipient. </li> pient algorithm exposes the direct key to the second recipient. </li>
<li>Several of the algorithms in <xref target="I-D.ietf-cose-rfc8152bis- <li>Several of the algorithms in <xref target="RFC9053"/> have limits on
algs"/> have limits on the number of times that a key can be used without leakin the number of times that a key can be used without leaking information about th
g information about the key.</li> e key.</li>
</ul> </ul>
<t>The use of ECDH and direct plus KDF (with no key wrap) will not directl y lead to the private key being leaked; the one way function of the KDF will pre vent that. There is, however, a different issue that needs to be addressed. Ha ving two recipients requires that the CEK be shared between two recipients. The second recipient therefore has a CEK that was derived from material that can be used for the weak proof of origin. The second recipient could create a message using the same CEK and send it to the first recipient; the first recipient woul d, for either static-static ECDH or direct plus KDF, make an assumption that the CEK could be used for proof of origin even though it is from the wrong entity. If the key wrap step is added, then no proof of origin is implied and this is n ot an issue. </t> <t>The use of Elliptic Curve Diffie-Hellman (ECDH) and direct plus KDF (wi th no key wrap) will not directly lead to the private key being leaked; the one- way function of the KDF will prevent that. There is, however, a different issue that needs to be addressed. Having two recipients requires that the CEK be sha red between two recipients. The second recipient therefore has a CEK that was d erived from material that can be used for the weak proof of origin. The second recipient could create a message using the same CEK and send it to the first rec ipient; the first recipient would, for either static-static ECDH or direct plus KDF, make an assumption that the CEK could be used for proof of origin, even tho ugh it is from the wrong entity. If the key wrap step is added, then no proof o f origin is implied and this is not an issue. </t>
<t> <t>
<!-- Although it has been mentioned before, the use of a single key for multi
p. 55 "the use of a single key for multiple algorithms has been demo ple algorithms has been demonstrated in some cases to leak information about tha
nstrated in some cases to leak information about a key ..." Maybe "a key" to "th t key, providing the opportunity for attackers to forge integrity tags or gain i
e key" if we're talking about that specific key. It'd be good to have links to nformation about encrypted content.
references going over the cases too. – changed ‘a’ to ‘that’.
[JLS] Are you looking for links to each of those three instances or
something else? It may be that this should be removed from the document as the
“mentioned before” is no longer relevant in the structure document only in the a
lgorithm document –
ALL: Should this just be killed?
-->
Although it has been mentioned before, the use of a single key for multi
ple algorithms has been demonstrated in some cases to leak information about tha
t key, provide the opportunity for attackers to forge integrity tags, or gain in
formation about encrypted content.
Binding a key to a single algorithm prevents these problems. Binding a key to a single algorithm prevents these problems.
Key creators and key consumers are strongly encouraged not only to creat e new keys for each different algorithm, but to include that selection of algori thm in any distribution of key material and strictly enforce the matching of alg orithms in the key structure to algorithms in the message structure. Key creators and key consumers are strongly encouraged not only to creat e new keys for each different algorithm, but to include that selection of algori thm in any distribution of key material and strictly enforce the matching of alg orithms in the key structure to algorithms in the message structure.
In addition to checking that algorithms are correct, the key form needs to be checked as well. In addition to checking that algorithms are correct, the key form needs to be checked as well.
Do not use an 'EC2' key where an 'OKP' key is expected. <!--[rfced] Would it be helpful to include expansions for EC2 and OKP?
RFC 8152 included the following in the body of the docment:
- (2 coordinate elliptic curve)
- (Octet Key Pair)
Original:
Do not use an 'EC2' key where an 'OKP' key is expected.
-->
Do not use an "EC2" key where an "OKP" key is expected.
</t> </t>
<t>Before using a key for transmission, or before acting on information re ceived, a trust decision on a key needs to be made. Is the data or action somet hing that the entity associated with the key has a right to see or a right to re quest? A number of factors are associated with this trust decision. Some of the ones that are highlighted here are: <t>Before using a key for transmission, or before acting on information re ceived, a trust decision on a key needs to be made. Is the data or action somet hing that the entity associated with the key has a right to see or a right to re quest? A number of factors are associated with this trust decision. Some of the ones that are highlighted here are:
</t> </t>
<ul> <ul>
<li>What are the permissions associated with the key owner?</li> <li>What are the permissions associated with the key owner?</li>
<li>Is the cryptographic algorithm acceptable in the current context?</l i> <li>Is the cryptographic algorithm acceptable in the current context?</l i>
<li>Have the restrictions associated with the key, such as algorithm or freshness, been checked and are they correct?</li> <li>Have the restrictions associated with the key, such as algorithm or freshness, been checked, and are they correct?</li>
<li>Is the request something that is reasonable, given the current state of the application?</li> <li>Is the request something that is reasonable, given the current state of the application?</li>
<li>Have any security considerations that are part of the message been e nforced (as specified by the application or 'crit' header parameter)?</li> <li>Have any security considerations that are part of the message been e nforced (as specified by the application or "crit" header parameter)?</li>
</ul> </ul>
<t>One area that has been getting exposure is traffic analysis of encrypte <t>One area that has been getting exposure is traffic analysis of encrypte
d messages based on the length of the message. This specification does not prov d messages based on the length of the message. This specification does not prov
ide for a uniform method of providing padding as part of the message structure. ide for a uniform method of providing padding as part of the message structure.
An observer can distinguish between two different messages (for example, 'YES' An observer can distinguish between two different messages (for example, "YES"
and 'NO') based on the length for all of the content encryption algorithms that and "NO") based on the length for all of the content encryption algorithms that
are defined in <xref target="I-D.ietf-cose-rfc8152bis-algs"/> document. This me are defined in <xref target="RFC9053"/>. This means that it is up to the applic
ans that it is up to the applications to document how content padding is to be d ations to document how content padding is to be done in order to prevent or disc
one in order to prevent or discourage such analysis. (For example, the text str ourage such analysis. (For example, the text strings could be defined as "YES"
ings could be defined as 'YES' and 'NO '.) </t> and "NO".) </t>
</section>
<section removeInRFC="true">
<name>Implementation Status</name>
<!-- RFC Editor - Please remove this section and reference RFC7942 prior
to publication -->
<t>
This section records the status of known implementations of the
protocol defined by this specification at the time of posting of
this Internet-Draft, and is based on a proposal described in <xref targe
t="RFC7942"/>. The description of implementations in this section is
intended to assist the IETF in its decision processes in
progressing drafts to RFCs. Please note that the listing of any
individual implementation here does not imply endorsement by the
IETF. Furthermore, no effort has been spent to verify the
information presented here that was supplied by IETF contributors.
This is not intended as, and must not be construed to be, a
catalog of available implementations or their features. Readers
are advised to note that other implementations may exist.
</t>
<t>
According to <xref target="RFC7942"/>, "this will allow reviewers and wo
rking
groups to assign due consideration to documents that have the
benefit of running code, which may serve as evidence of valuable
experimentation and feedback that have made the implemented
protocols more mature. It is up to the individual working groups
to use this information as they see fit".
</t>
<section>
<name>Author's Versions</name>
<t>
There are three different implementations that have been created by th
e author of the document both to create the examples that are included in the do
cument and to validate the structures and methodology used in the design of COSE
.
</t>
<ul>
<li>Implementation Location: https://github.com/cose-wg</li>
<li>Primary Maintainer: Jim Schaad</li>
<li>
Languages:
There are three different languages that are currently supported:
Java, C# and C.
</li>
<li>
Cryptography: The Java and C# libraries use Bouncy Castle to provi
de the required cryptography.
The C version uses OPENSSL Version 1.1 for the cryptography.
</li>
<li>
Coverage:
All versions have support to allow for implicit algorithm support
as they allow for the application to set attributes that are not to be sent in t
he message.
</li>
<li>
Testing:
All of the examples in the example library are generated by the C#
library and then validated using the Java and C libraries.
All three libraries have tests to allow for the creating of the sa
me messages that are in the example library followed by validating them.
These are not compared against the example library.
The Java and C# libraries have unit testing included.
Not all of the <bcp14>MUST</bcp14> statements in the document have
been implemented as part of the libraries.
One such statement is the requirement that unique labels be presen
t.
</li>
<li>Licensing: Revised BSD License </li>
</ul>
</section>
<section>
<name>JavaScript Version</name>
<ul>
<li>Implementation Location: https://github.com/erdtman/cose-js</li>
<li>Primary Maintainer: Samuel Erdtman</li>
<li>Languages: JavaScript</li>
<li>Cryptography: TBD</li>
<li>Coverage: Full Encrypt, Signature and MAC objects are supported.</
li>
<li>Testing: Basic testing against the common example library.</li>
<li>Licensing: Apache License 2.0</li>
</ul>
</section>
<section>
<name>Python Version</name>
<ul>
<li>Implementation Location: https://github.com/TimothyClaeys/COSE-PYT
HON</li>
<li>Primary Maintainer: Timothy Claeys</li>
<li>Languages: Python</li>
<li>Cryptography: pyecdsak, crypto python libraries</li>
<li>Coverage: TBD</li>
<li>Testing: Basic testing plus running against the common example lib
rary.</li>
<li>Licensing: BSD 3-Clause License</li>
</ul>
</section>
<section>
<name>COSE Testing Library</name>
<ul>
<li>Implementation Location: https://github.com/cose-wg/Examples</li>
<li>Primary Maintainer: Jim Schaad</li>
<li>
Description: A set of tests for the COSE library is provided as pa
rt of the implementation effort.
Both success and fail tests have been provided.
All of the examples in this document are part of this example set.
</li>
<li>
Coverage: An attempt has been made to have test cases for every m
essage type and algorithm in the document.
Currently examples dealing with ECDH with Goldilocks are missing.
</li>
<li>Licensing: Public Domain</li>
</ul>
</section>
</section> </section>
</middle> </middle>
<back> <back>
<references xml:base="https://xml2rfc.ietf.org/public/rfc/"> <displayreference target="I-D.ietf-core-groupcomm-bis" to="CORE-GROUPCOMM"/>
<displayreference target="I-D.irtf-cfrg-argon2" to="CFRG-ARGON2"/>
<displayreference target="I-D.ietf-cose-countersign" to="COSE-COUNTERSIGN"/>
<references>
<name>References</name> <name>References</name>
<references> <references>
<name>Normative References</name> <name>Normative References</name>
<xi:include href="bibxml/reference.RFC.2119.xml"/>
<xi:include href="bibxml3/reference.I-D.ietf-cbor-7049bis.xml"/> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.
<xi:include href="bibxml/reference.RFC.8174.xml"/> xml"/>
<xi:include href="bibxml3/reference.I-D.ietf-cose-rfc8152bis-algs.xml"/> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8949.
</references> xml"/>
<references> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.
<name>Informative References</name> xml"/>
<xi:include href="bibxml/reference.RFC.8152.xml"/>
<xi:include href="bibxml/reference.RFC.8610.xml"/> <!-- [I-D.ietf-cose-rfc8152bis-algs] RFC 9053 -->
<xi:include href="bibxml/reference.RFC.2633.xml"/> <reference anchor='RFC9053' target="https://www.rfc-editor.org/info/rfc9053">
<xi:include href="bibxml/reference.RFC.4262.xml"/> <front>
<xi:include href="bibxml/reference.RFC.4949.xml"/> <title>CBOR Object Signing and Encryption (COSE): Initial Algorithms</title>
<xi:include href="bibxml/reference.RFC.5116.xml"/>
<xi:include href="bibxml/reference.RFC.5652.xml"/> <author initials='J' surname='Schaad' fullname='Jim Schaad'>
<xi:include href="bibxml/reference.RFC.5751.xml"/> <organization />
<xi:include href="bibxml/reference.RFC.5752.xml"/>
<xi:include href="bibxml/reference.RFC.5990.xml"/>
<xi:include href="bibxml/reference.RFC.6838.xml"/>
<!-- <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml9/
reference.STD.0090.xml"/> -->
<referencegroup anchor="STD90" target="https://www.rfc-editor.org/info/std90">
<!-- reference.RFC.8259.xml -->
<reference anchor="RFC8259" target="https://www.rfc-editor.org/info/rfc8259">
<front>
<title>
The JavaScript Object Notation (JSON) Data Interchange Format
</title>
<author initials="T." surname="Bray" fullname="T. Bray" role="editor">
<organization/>
</author> </author>
<date year="2017" month="December"/>
<abstract> <date month='July' year='2021' />
<t>
JavaScript Object Notation (JSON) is a lightweight, text-based, language-indepen
dent data interchange format. It was derived from the ECMAScript Programming Lan
guage Standard. JSON defines a small set of formatting rules for the portable re
presentation of structured data.
</t>
<t>
This document removes inconsistencies with other specifications of JSON, repairs
specification errors, and offers experience-based interoperability guidance.
</t>
</abstract>
</front> </front>
<seriesInfo name="STD" value="90"/> <seriesInfo name="RFC" value="9053"/>
<seriesInfo name="RFC" value="8259"/> <seriesInfo name="DOI" value="10.17487/RFC9053"/>
<seriesInfo name="DOI" value="10.17487/RFC8259"/>
</reference> </reference>
</referencegroup>
<!-- <xi:include href="https://xml2rfc.tools.ietf.org/public/rfc/bibxml9/referen </references>
ce.BCP.0201.xml"/> --> <references>
<name>Informative References</name>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.8152.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.8610.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.2633.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.3851.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.8551.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.4262.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.4949.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.5116.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.5652.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.5751.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.5752.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.5990.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.6838.xml"/>
<reference anchor="STD90" target="https://www.rfc-editor.org/info/std90">
<front>
<title>The JavaScript Object Notation (JSON) Data Interchange Format</tit
le>
<author initials="T." surname="Bray" fullname="T. Bray" role="editor">
<organization />
</author>
<date month="December" year="2017" />
</front>
<seriesInfo name="STD" value="90" />
<seriesInfo name="RFC" value="8259" />
</reference>
<reference anchor="BCP201" target="https://www.rfc-editor.org/info/bcp201">
<front>
<title>Guidelines for Cryptographic Algorithm Agility and Selecting Manda
tory-to-Implement Algorithms</title>
<author initials="R." surname="Housley" fullname="Russ Housley">
<organization />
</author>
<date month="November" year="2015" />
</front>
<seriesInfo name="BCP" value="201" />
<seriesInfo name="RFC" value="7696"/>
</reference>
<!--
<referencegroup anchor="BCP201" target="https://www.rfc-editor.org/info/bcp201"> <referencegroup anchor="BCP201" target="https://www.rfc-editor.org/info/bcp201">
<!-- reference.RFC.7696.xml --> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.769
<reference anchor="RFC7696" target="https://www.rfc-editor.org/info/rfc7696"> 6.xml"/>
<front>
<title>
Guidelines for Cryptographic Algorithm Agility and Selecting Mandatory-to-Implem
ent Algorithms
</title>
<author initials="R." surname="Housley" fullname="R. Housley">
<organization/>
</author>
<date year="2015" month="November"/>
<abstract>
<t>
Many IETF protocols use cryptographic algorithms to provide confidentiality, int
egrity, authentication, or digital signature. Communicating peers must support a
common set of cryptographic algorithms for these mechanisms to work properly. T
his memo provides guidelines to ensure that protocols have the ability to migrat
e from one mandatory-to-implement algorithm suite to another over time.
</t>
</abstract>
</front>
<seriesInfo name="BCP" value="201"/>
<seriesInfo name="RFC" value="7696"/>
<seriesInfo name="DOI" value="10.17487/RFC7696"/>
</reference>
</referencegroup> </referencegroup>
<xi:include href="bibxml/reference.RFC.7252.xml"/> -->
<xi:include href="bibxml/reference.RFC.7515.xml"/> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
<xi:include href="bibxml/reference.RFC.7516.xml"/> FC.7252.xml"/>
<xi:include href="bibxml/reference.RFC.7517.xml"/> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
<xi:include href="bibxml/reference.RFC.7518.xml"/> FC.7515.xml"/>
<xi:include href="bibxml/reference.RFC.8032.xml"/> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
<reference anchor="DSS" target="http://nvlpubs.nist.gov/nistpubs/FIPS/NI FC.7516.xml"/>
ST.FIPS.186-4.pdf"> <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.7517.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.7518.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.8032.xml"/>
<reference anchor="DSS" target="https://nvlpubs.nist.gov/nistpubs/FIPS/N
IST.FIPS.186-4.pdf">
<front> <front>
<title>Digital Signature Standard (DSS)</title> <title>Digital Signature Standard (DSS)</title>
<seriesInfo name="DOI" value="10.6028/NIST.FIPS.186-4"/>
<seriesInfo name="FIPS PUB" value="186-4"/>
<author> <author>
<organization>National Institute of Standards and Technology</orga nization> <organization>National Institute of Standards and Technology</orga nization>
</author> </author>
<date year="2013" month="July"/> <date year="2013" month="July"/>
</front> </front>
<seriesInfo name="FIPS" value="186-4"/>
<seriesInfo name="DOI" value="10.6028/NIST.FIPS.186-4"/>
</reference> </reference>
<reference anchor="PVSig">
<!-- RFC Editor: alternative non-paywall https://www.certicom.com/con <reference anchor="PVSig" target="https://www.certicom.com/content/dam/c
tent/dam/certicom/images/pdfs/CerticomWP-PVSigSec_login.pdf --> erticom/images/pdfs/CerticomWP-PVSigSec_login.pdf">
<front> <front>
<title>Formal Security Proofs for a Signature Scheme with Partial Me ssage Recovery</title> <title>Formal Security Proofs for a Signature Scheme with Partial Me ssage Recovery</title>
<seriesInfo name="LNCS" value="Volume 2020"/> <author initials="D.R.L." surname="Brown"/>
<seriesInfo name="DOI" value="10.1007/3-540-45353-9_11"/> <author initials="D.B." surname="Johnson"/>
<author initials="D." surname="Brown"/>
<author initials="D." surname="Johnson"/>
<date year="2000" month="June"/> <date year="2000" month="June"/>
</front> </front>
<seriesInfo name="DOI" value="10.1007/3-540-45353-9_11"/>
<refcontent>LNCS Volume 2020</refcontent>
</reference> </reference>
<reference anchor="W3C.WebCrypto" target="https://www.w3.org/TR/WebCrypt oAPI/"> <reference anchor="W3C.WebCrypto" target="https://www.w3.org/TR/WebCrypt oAPI/">
<front> <front>
<title>Web Cryptography API</title> <title>Web Cryptography API</title>
<seriesInfo name="W3C" value="Recommendation"/> <author initials="M." surname="Watson" role="editor"/>
<author initials="M." surname="Watson"/> <date year="2017" month="January" day="26"/>
<date year="2017" month="January"/>
</front>
</reference>
<xi:include href="bibxml/reference.RFC.8230.xml"/>
<xi:include href="bibxml/reference.RFC.7942.xml"/>
<xi:include href="bibxml/reference.RFC.3394.xml"/>
<xi:include href="bibxml3/reference.I-D.ietf-cose-hash-algs.xml"/>
<xi:include href="bibxml3/reference.I-D.ietf-core-groupcomm-bis.xml"/>
<xi:include href="bibxml/reference.RFC.8613.xml"/>
<xi:include href="bibxml3/reference.I-D.irtf-cfrg-argon2.xml"/>
<reference anchor="COAP.Formats" target="https://www.iana.org/assignment
s/core-parameters/core-parameters.xhtml#content-formats">
<front>
<title>CoAP Content-Formats</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.Algorithms" target="https://www.iana.org/assignm
ents/cose/cose.xhtml#algorithms">
<front>
<title>COSE Algorithms</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.KeyParameters" target="https://www.iana.org/assi
gnments/cose/cose.xhtml#key-common-parameters">
<front>
<title>COSE Key Parameters</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.KeyTypes" target="https://www.iana.org/assignmen
ts/cose/cose.xhtml#key-type">
<front>
<title>COSE Key Types</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<!-- <xi:include href="bibxml3/reference.I-D.ietf-cose-countersig
n.xml"/> -->
<reference anchor="I-D.ietf-cose-countersign">
<front>
<title>CBOR Object Signing&nbsp;and&nbsp;Encryption&nbsp;(COSE): Cou
ntersignatures</title>
<author initials="J." surname="Schaad" fullname="Jim Schaad"/>
<date/>
</front> </front>
<refcontent>W3C Recommendation</refcontent>
</reference> </reference>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.8230.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.R
FC.3394.xml"/>
<!-- [I-D.ietf-cose-hash-algs] RFC 9054 -->
<reference anchor='RFC9054' target="https://www.rfc-editor.org/info/rfc9054">
<front>
<title>CBOR Object Signing and Encryption (COSE): Hash Algorithms</title>
<author initials='J' surname='Schaad' fullname='Jim Schaad'>
<organization />
</author>
<date month='July' year='2021' />
</front>
<seriesInfo name="RFC" value="9054"/>
<seriesInfo name="DOI" value="10.17487/RFC9054"/>
</reference>
<!-- [I-D.ietf-core-groupcomm-bis] IESG state I-D Exists -->
<xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-co
re-groupcomm-bis.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8613.
xml"/>
<!-- [I-D.irtf-cfrg-argon2] IESG state I-D Exists -->
<xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.irtf-cf
rg-argon2.xml"/>
<reference anchor="COAP.Formats" target="https://www.iana.org/assignments/core-p
arameters/">
<front>
<title>CoAP Content-Formats</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.Algorithms" target="https://www.iana.org/assignments/cos
e/">
<front>
<title>COSE Algorithms</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.KeyParameters" target="https://www.iana.org/assignments/
cose/">
<front>
<title>COSE Key Common Parameters</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<reference anchor="COSE.KeyTypes" target="https://www.iana.org/assignments/cose/
">
<front>
<title>COSE Key Types</title>
<author>
<organization>IANA</organization>
</author>
<date/>
</front>
</reference>
<!-- [I-D.ietf-cose-countersign] IESG state I-D Exists -->
<xi:include href="https://datatracker.ietf.org/doc/bibxml3/reference.I-D.ietf-co
se-countersign.xml"/>
</references> </references>
</references> </references>
<section> <section>
<name>Guidelines for External Data Authentication of Algorithms</name> <name>Guidelines for External Data Authentication of Algorithms</name>
<t> <t>
During development of COSE, the requirement that the algorithm identifier be located in the protected attributes was relaxed from a must to a should. During development of COSE, the requirement that the algorithm identifier be located in the protected attributes was relaxed from a must to a should.
There were two basic reasons that have been advanced to support this positio n. Two basic reasons have been advanced to support this position.
First, the resulting message will be smaller if the algorithm identifier is omitted from the most common messages in a CoAP environment. First, the resulting message will be smaller if the algorithm identifier is omitted from the most common messages in a CoAP environment.
Second, there is a potential bug that will arise if full checking is not don e correctly between the different places that an algorithm identifier could be p laced (the message itself, an application statement, the key structure that the sender possesses, and the key structure the recipient possesses). Second, there is a potential bug that will arise if full checking is not don e correctly between the different places that an algorithm identifier could be p laced (the message itself, an application statement, the key structure that the sender possesses, and the key structure the recipient possesses).
</t> </t>
<t> <t>
This appendix lays out how such a change can be made and the details that an application needs to specify in order to use this option. This appendix lays out how such a change can be made and the details that an application needs to specify in order to use this option.
Two different sets of details are specified: those needed to omit an algorit hm identifier and those needed to use the variant on the countersignature attrib ute that contains no attributes about itself. Two different sets of details are specified: those needed to omit an algorit hm identifier and those needed to use the variant on the countersignature attrib ute that contains no attributes about itself.
</t> </t>
<t>Three sets of recommendations are laid out. The first set of recommend ations applies to having an implicit algorithm identified for a single layer of a COSE object. The second set of recommendations applies to having multiple imp licit algorithms identified for multiple layers of a COSE object. The third set of recommendations applies to having implicit algorithms for multiple COSE obje ct constructs. </t> <t>Three sets of recommendations are laid out. The first set of recommend ations applies to having an implicit algorithm identified for a single layer of a COSE object. The second set of recommendations applies to having multiple imp licit algorithms identified for multiple layers of a COSE object. The third set of recommendations applies to having implicit algorithms for multiple COSE obje ct constructs. </t>
<t>The key words from <xref target="RFC2119"/> are deliberately not used h ere. This specification can provide recommendations, but it cannot enforce them . </t> <t>The key words from <xref target="RFC2119"/> are deliberately not used h ere. This specification can provide recommendations, but it cannot enforce them . </t>
<t>This set of recommendations applies to the case where an application is distributing a fixed algorithm along with the key information for use in a sing le COSE object. This normally applies to the smallest of the COSE objects, spec ifically COSE_Sign1, COSE_Mac0, and COSE_Encrypt0, but could apply to the other structures as well. </t> <t>This set of recommendations applies to the case where an application is distributing a fixed algorithm along with the key information for use in a sing le COSE object. This normally applies to the smallest of the COSE objects -- sp ecifically, COSE_Sign1, COSE_Mac0, and COSE_Encrypt0 -- but could apply to the o ther structures as well. </t>
<t>The following items should be taken into account: <t>The following items should be taken into account:
</t> </t>
<ul> <ul>
<li>Applications need to list the set of COSE structures that implicit a lgorithms are to be used in. Applications need to require that the receipt of a n explicit algorithm identifier in one of these structures will lead to the mess age being rejected. This requirement is stated so that there will never be a ca se where there is any ambiguity about the question of which algorithm should be used, the implicit or the explicit one. This applies even if the transported al gorithm identifier is a protected attribute. This applies even if the transport ed algorithm is the same as the implicit algorithm. </li> <li>Applications need to list the set of COSE structures that implicit a lgorithms are to be used in. Applications need to require that the receipt of a n explicit algorithm identifier in one of these structures will lead to the mess age being rejected. This requirement is stated so that there will never be a ca se where there is any ambiguity about the question of which algorithm should be used, the implicit or the explicit one. This applies even if the transported al gorithm identifier is a protected attribute. This applies even if the transport ed algorithm is the same as the implicit algorithm. </li>
<li>Applications need to define the set of information that is to be con <li>Applications need to define the set of information that is to be con
sidered to be part of a context when omitting algorithm identifiers. At a minim sidered to be part of a context when omitting algorithm identifiers. At a minim
um, this would be the key identifier (if needed), the key, the algorithm, and th um, this would be the key identifier (if needed), the key, the algorithm, and th
e COSE structure it is used with. Applications should restrict the use of a sin e COSE structure it is used with. Applications should restrict the use of a sin
gle key to a single algorithm. As noted for some of the algorithms in <xref tar gle key to a single algorithm. As noted for some of the algorithms in <xref tar
get="I-D.ietf-cose-rfc8152bis-algs"/>, the use of the same key in different rela get="RFC9053"/>, the use of the same key in different, related algorithms can le
ted algorithms can lead to leakage of information about the key, leakage about t ad to leakage of information about the key, leakage about the data, or the abili
he data or the ability to perform forgeries. </li> ty to perform forgeries. </li>
<li>In many cases, applications that make the algorithm identifier impli <li>In many cases, applications that make the algorithm identifier impli
cit will also want to make the context identifier implicit for the same reason. cit will also want to make the context identifier implicit for the same reason.
That is, omitting the context identifier will decrease the message size (potent That is, omitting the context identifier will decrease the message size (potent
ially significantly depending on the length of the identifier). Applications th ially significantly, depending on the length of the identifier). Applications t
at do this will need to describe the circumstances where the context identifier hat do this will need to describe the circumstances where the context identifier
is to be omitted and how the context identifier is to be inferred in these cases is to be omitted and how the context identifier is to be inferred in these case
. (An exhaustive search over all of the keys would normally not be considered t s. (An exhaustive search over all of the keys would normally not be considered
o be acceptable.) An example of how this can be done is to tie the context to a to be acceptable.) An example of how this can be done is to tie the context to a
transaction identifier. Both would be sent on the original message, but only th transaction identifier. Both would be sent on the original message, but only t
e transaction identifier would need to be sent after that point as the context i he transaction identifier would need to be sent after that point, as the context
s tied into the transaction identifier. Another way would be to associate a con is tied into the transaction identifier. Another way would be to associate a c
text with a network address. All messages coming from a single network address ontext with a network address. All messages coming from a single network addres
can be assumed to be associated with a specific context. (In this case, the add s can be assumed to be associated with a specific context. (In this case, the a
ress would normally be distributed as part of the context.) </li> ddress would normally be distributed as part of the context.) </li>
<li>Applications cannot rely on key identifiers being unique unless they take significant efforts to ensure that they are computed in such a way as to c reate this guarantee. Even when an application does this, the uniqueness might be violated if the application is run in different contexts (i.e., with a differ ent context provider) or if the system combines the security contexts from diffe rent applications together into a single store. </li> <li>Applications cannot rely on key identifiers being unique unless they take significant efforts to ensure that they are computed in such a way as to c reate this guarantee. Even when an application does this, the uniqueness might be violated if the application is run in different contexts (i.e., with a differ ent context provider) or if the system combines the security contexts from diffe rent applications together into a single store. </li>
<li>Applications should continue the practice of protecting the algorith m identifier. Since this is not done by placing it in the protected attributes field, applications should define an application-specific external data structur e that includes this value. This external data field can be used as such for co ntent encryption, MAC, and signature algorithms. It can be used in the SuppPriv Info field for those algorithms that use a KDF to derive a key value. Applicati ons may also want to protect other information that is part of the context struc ture as well. It should be noted that those fields, such as the key or a Base I V, are protected by virtue of being used in the cryptographic computation and do not need to be included in the external data field. </li> <li>Applications should continue the practice of protecting the algorith m identifier. Since this is not done by placing it in the protected attributes field, applications should define an application-specific external data structur e that includes this value. This external data field can be used as such for co ntent encryption, MAC, and signature algorithms. It can be used in the SuppPriv Info field for those algorithms that use a KDF to derive a key value. Applicati ons may also want to protect other information that is part of the context struc ture as well. It should be noted that those fields, such as the key or a Base I V, are protected by virtue of being used in the cryptographic computation and do not need to be included in the external data field. </li>
</ul> </ul>
<t>The second case is having multiple implicit algorithm identifiers speci fied for a multiple layer COSE object. An example of how this would work is the encryption context that an application specifies, which contains a content encr yption algorithm, a key wrap algorithm, a key identifier, and a shared secret. The sender omits sending the algorithm identifier for both the content layer and the recipient layer leaving only the key identifier. The receiver then uses th e key identifier to get the implicit algorithm identifiers. </t> <t>The second case is having multiple implicit algorithm identifiers speci fied for a multiple-layer COSE object. An example of how this would work is the encryption context that an application specifies, which contains a content encr yption algorithm, a key wrap algorithm, a key identifier, and a shared secret. The sender omits sending the algorithm identifier for both the content layer and the recipient layer, leaving only the key identifier. The receiver then uses t he key identifier to get the implicit algorithm identifiers. </t>
<t>The following additional items need to be taken into consideration: <t>The following additional items need to be taken into consideration:
</t> </t>
<ul> <ul>
<li>Applications that want to support this will need to define a structu re that allows for, and clearly identifies, both the COSE structure to be used w ith a given key and the structure and algorithm to be used for the secondary lay er. The key for the secondary layer is computed as normal from the recipient lay er. </li> <li>Applications that want to support this will need to define a structu re that allows for, and clearly identifies, both the COSE structure to be used w ith a given key and the structure and algorithm to be used for the secondary lay er. The key for the secondary layer is computed as normal from the recipient lay er. </li>
</ul> </ul>
<t>The third case is having multiple implicit algorithm identifiers, but t argeted at potentially unrelated layers or different COSE objects. There are a number of different scenarios where this might be applicable. Some of these sce narios are: <t>The third case is having multiple implicit algorithm identifiers, but t argeted at potentially unrelated layers or different COSE objects. There are a number of different scenarios where this might be applicable. Some of these sce narios are:
</t> </t>
<ul> <ul>
<li>Two contexts are distributed as a pair. Each of the contexts is for use with a COSE_Encrypt message. Each context will consist of distinct secret keys and IVs and potentially even different algorithms. One context is for send ing messages from party A to party B, and the second context is for sending mess ages from party B to party A. This means that there is no chance for a reflecti on attack to occur as each party uses different secret keys to send its messages ; a message that is reflected back to it would fail to decrypt. </li> <li>Two contexts are distributed as a pair. Each of the contexts is for use with a COSE_Encrypt message. Each context will consist of distinct secret keys and IVs and potentially even different algorithms. One context is for send ing messages from party A to party B, and the second context is for sending mess ages from party B to party A. This means that there is no chance for a reflecti on attack to occur, as each party uses different secret keys to send its message s; a message that is reflected back to it would fail to decrypt. </li>
<li>Two contexts are distributed as a pair. The first context is used f or encryption of the message, and the second context is used to place a counters ignature on the message. The intention is that the second context can be distri buted to other entities independently of the first context. This allows these e ntities to validate that the message came from an individual without being able to decrypt the message and see the content. </li> <li>Two contexts are distributed as a pair. The first context is used f or encryption of the message, and the second context is used to place a counters ignature on the message. The intention is that the second context can be distri buted to other entities independently of the first context. This allows these e ntities to validate that the message came from an individual without being able to decrypt the message and see the content. </li>
<li> <li>
Two contexts are distributed as a pair. Two contexts are distributed as a pair.
The first context contains a key for dealing with MACed messages, and the second context contains a different key for dealing with encrypted messages. The first context contains a key for dealing with MACed messages, and the second context contains a different key for dealing with encrypted messages.
This allows for a unified distribution of keys to participants for dif ferent types of messages that have different keys, but where the keys may be use d in a coordinated manner. This allows for a unified distribution of keys to participants for dif ferent types of messages that have different keys, but where the keys may be use d in a coordinated manner.
</li> </li>
</ul> </ul>
<t>For these cases, the following additional items need to be considered: <t>For these cases, the following additional items need to be considered:
</t> </t>
<ul> <ul>
<li>Applications need to ensure that the multiple contexts stay associat ed. If one of the contexts is invalidated for any reason, all of the contexts a ssociated with it should also be invalidated. </li> <li>Applications need to ensure that the multiple contexts stay associat ed. If one of the contexts is invalidated for any reason, all of the contexts a ssociated with it should also be invalidated. </li>
</ul> </ul>
</section> </section>
<section anchor="three-layer"> <section anchor="three-layer">
<name>Two Layers of Recipient Information</name> <name>Two Layers of Recipient Information</name>
<t> <t>
All of the currently defined recipient algorithm classes only use two laye rs of the COSE structure. All of the currently defined recipient algorithm classes only use two laye rs of the COSE structure.
The first layer (COSE_Encrypt) is the message content, and the second laye r (COSE_Recipint) is the content key encryption. The first layer (COSE_Encrypt) is the message content, and the second laye r (COSE_Recipient) is the content key encryption.
However, if one uses a recipient algorithm such as the RSA Key Encapsulati on Mechanism (RSA-KEM) (see Appendix A of RSA-KEM <xref target="RFC5990"/>), the n it makes sense to have two layers of the COSE_Recipient structure. However, if one uses a recipient algorithm such as the RSA Key Encapsulati on Mechanism (RSA-KEM) (see Appendix A of RSA-KEM <xref target="RFC5990"/>), the n it makes sense to have two layers of the COSE_Recipient structure.
</t> </t>
<t>These layers would be: <t>These layers would be:
</t> </t>
<ul> <ul>
<li>Layer 0: The content encryption layer. This layer contains the payl oad of the message. </li> <li>Layer 0: The content encryption layer. This layer contains the payl oad of the message. </li>
<li>Layer 1: The encryption of the CEK by a KEK. </li> <li>Layer 1: The encryption of the CEK by a KEK. </li>
<li>Layer 2: The encryption of a long random secret using an RSA key and a key derivation function to convert that secret into the KEK. </li> <li>Layer 2: The encryption of a long random secret using an RSA key and a key derivation function to convert that secret into the KEK. </li>
</ul> </ul>
<t>This is an example of what a triple layer message would look like. The message has the following layers: <t>This is an example of what a triple-layer message would look like. The message has the following layers:
</t> </t>
<ul> <ul>
<li>Layer 0: Has a content encrypted with AES-GCM using a 128-bit key. </li> <li>Layer 0: Has content encrypted with AES-GCM using a 128-bit key. </ li>
<li>Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key. </li> <li>Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key. </li>
<li>Layer 2: Uses ECDH Ephemeral-Static direct to generate the layer 1 k ey. </li> <li>Layer 2: Uses ECDH Ephemeral-Static direct to generate the Layer 1 k ey. </li>
</ul> </ul>
<t> In effect, this example is a decomposed version of using the ECDHES+A 128KW algorithm. </t> <t> In effect, this example is a decomposed version of using the ECDH-ES+A 128KW algorithm. </t>
<t>Size of binary file is 183 bytes</t> <t>Size of binary file is 183 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
96( 96(
[ / COSE_Encrypt / [ / COSE_Encrypt /
/ protected h'a10101' / << { / protected h'a10101' / << {
/ alg / 1:1 / AES-GCM 128 / / alg / 1:1 / AES-GCM 128 /
} >>, } >>,
/ unprotected / { / unprotected / {
/ iv / 5:h'02d1f7e6f26c43d4868d87ce' / iv / 5:h'02d1f7e6f26c43d4868d87ce'
}, },
/ ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0
811139868826e89218a75715b', 811139868826e89218a75715b',
skipping to change at line 2227 skipping to change at line 2263
] ]
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="examples"> <section anchor="examples">
<name>Examples</name> <name>Examples</name>
<t>This appendix includes a set of examples that show the different featur es and message types that have been defined in this document. To make the examp les easier to read, they are presented using the extended CBOR diagnostic notati on (defined in <xref target="RFC8610"/>) rather than as a binary dump. </t> <t>This appendix includes a set of examples that show the different featur es and message types that have been defined in this document. To make the examp les easier to read, they are presented using the extended CBOR diagnostic notati on (defined in <xref target="RFC8610"/>) rather than as a binary dump. </t>
<t> <t>
A GitHub project has been created at &lt;https://github.com/cose-wg/Exam ples&gt; that contains not only the examples presented in this document, but a m ore complete set of testing examples as well. A GitHub project has been created at &lt;https://github.com/cose-wg/Exam ples&gt; that contains not only the examples presented in this document, but a m ore complete set of testing examples as well.
Each example is found in a JSON file that contains the inputs used to cr Each example is found in a JSON file that contains the inputs used to cr
eate the example, some of the intermediate values that can be used in debugging eate the example, some of the intermediate values that can be used in debugging
the example and the output of the example presented both as a hex dump and in CB the example, and the output of the example presented both as a hex dump and in C
OR diagnostic notation format. BOR diagnostic notation format.
Some of the examples at the site are designed failure testing cases; the Some of the examples at the site are designed failure-testing cases; the
se are clearly marked as such in the JSON file. se are clearly marked as such in the JSON file.
If errors in the examples in this document are found, the examples on Gi tHub will be updated, and a note to that effect will be placed in the JSON file. If errors in the examples in this document are found, the examples on Gi tHub will be updated, and a note to that effect will be placed in the JSON file.
</t> </t>
<t>As noted, the examples are presented using the CBOR's diagnostic notati on. A Ruby-based tool exists that can convert between the diagnostic notation a nd binary. This tool can be installed with the command line: </t> <t>As noted, the examples are presented using CBOR's diagnostic notation. A Ruby-based tool exists that can convert between the diagnostic notation and b inary. This tool can be installed with the command line: </t>
<sourcecode type=""><![CDATA[gem install cbor-diag]]></sourcecode> <sourcecode type=""><![CDATA[gem install cbor-diag]]></sourcecode>
<t>The diagnostic notation can be converted into binary files using the fo llowing command line: </t> <t>The diagnostic notation can be converted into binary files using the fo llowing command line: </t>
<sourcecode type=""><![CDATA[diag2cbor.rb < inputfile > outputfile <sourcecode type=""><![CDATA[diag2cbor.rb < inputfile > outputfile
]]></sourcecode> ]]></sourcecode>
<t>The examples can be extracted from the XML version of this document via <!-- [rfced] These questions are related to <sourcecode> types.
an XPath expression as all of the sourcecode is tagged with the attribute type=
'CBORdiag'. (Depending on the XPath evaluator one is using, it may be necessary a) Based on discussion with the XML Schema and Style Guide Committee and Carsten
to deal with &amp;gt; as an entity.) </t> Bormann, we have updated instances of <sourcecode type="CBORdiag"> to be <sourc
ecode type="cbor-diag">. This impacted the following text, which has also been
updated as shown below. Please let us know any concerns.
Original:
The examples can be extracted from the XML version of this document
via an XPath expression as all of the sourcecode is tagged with the
attribute type='CBORdiag'.
Current
The examples can be extracted from the XML version of this document
via an XPath expression, as all of the source code is tagged with the
attribute type='cbor-diag'.
b) In general, please review the "type" attribute of each sourcecode element
in the XML file to ensure correctness. If the current list of preferred
values for "type" (https://www.rfc-editor.org/materials/sourcecode-types.txt)
does not contain an applicable type, then feel free to let us know.
-->
<t>The examples can be extracted from the XML version of this document via
an XPath expression, as all of the source code is tagged with the attribute typ
e='cbor-diag'. (Depending on the XPath evaluator one is using, it may be necess
ary to deal with &amp;gt; as an entity.) </t>
<sourcecode type="XPATH"><![CDATA[//sourcecode[@type='CDDL']/text()]]></so urcecode> <sourcecode type="XPATH"><![CDATA[//sourcecode[@type='CDDL']/text()]]></so urcecode>
<section anchor="SignedExamples"> <section anchor="SignedExamples">
<name>Examples of Signed Messages</name> <name>Examples of Signed Messages</name>
<section anchor="Appendix_B_1_1"> <section anchor="Appendix_B_1_1">
<name>Single Signature</name> <name>Single Signature</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li> <li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li>
</ul> </ul>
<t>Size of binary file is 103 bytes</t> <t>Size of binary file is 103 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
98( 98(
[ [
/ protected / h'', / protected / h'',
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ signatures / [ / signatures / [
[ [
/ protected h'a10126' / << { / protected h'a10126' / << {
/ alg / 1:-7 / ECDSA 256 / / alg / 1:-7 / ECDSA 256 /
} >>, } >>,
skipping to change at line 2281 skipping to change at line 2337
<section anchor="Appendix_B_1_2"> <section anchor="Appendix_B_1_2">
<name>Multiple Signers</name> <name>Multiple Signers</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li> <li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li>
<li>Signature Algorithm: ECDSA w/ SHA-512, Curve P-521</li> <li>Signature Algorithm: ECDSA w/ SHA-512, Curve P-521</li>
</ul> </ul>
<t>Size of binary file is 277 bytes</t> <t>Size of binary file is 277 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
98( 98(
[ [
/ protected / h'', / protected / h'',
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ signatures / [ / signatures / [
[ [
/ protected h'a10126' / << { / protected h'a10126' / << {
/ alg / 1:-7 / ECDSA 256 / / alg / 1:-7 / ECDSA 256 /
} >>, } >>,
skipping to change at line 2323 skipping to change at line 2379
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Appendix_B_1_4"> <section anchor="Appendix_B_1_4">
<name>Signature with Criticality</name> <name>Signature with Criticality</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li> <li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li>
<li>There is a criticality marker on the "reserved" header paramet er</li> <li>There is a criticality marker on the "reserved" header paramet er.</li>
</ul> </ul>
<t>Size of binary file is 125 bytes</t> <t>Size of binary file is 125 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
98( 98(
[ [
/ protected h'a2687265736572766564f40281687265736572766564' / / protected h'a2687265736572766564f40281687265736572766564' /
<< { << {
"reserved":false, "reserved":false,
/ crit / 2:[ / crit / 2:[
"reserved" "reserved"
] ]
} >>, } >>,
/ unprotected / {}, / unprotected / {},
skipping to change at line 2366 skipping to change at line 2422
<section anchor="Sign1_Examples"> <section anchor="Sign1_Examples">
<name>Single Signer Examples</name> <name>Single Signer Examples</name>
<section> <section>
<name>Single ECDSA Signature</name> <name>Single ECDSA Signature</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li> <li>Signature Algorithm: ECDSA w/ SHA-256, Curve P-256</li>
</ul> </ul>
<t>Size of binary file is 98 bytes</t> <t>Size of binary file is 98 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
18( 18(
[ [
/ protected h'a10126' / << { / protected h'a10126' / << {
/ alg / 1:-7 / ECDSA 256 / / alg / 1:-7 / ECDSA 256 /
} >>, } >>,
/ unprotected / { / unprotected / {
/ kid / 4:'11' / kid / 4:'11'
}, },
/ payload / 'This is the content.', / payload / 'This is the content.',
/ signature / h'8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4 / signature / h'8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4
skipping to change at line 2395 skipping to change at line 2451
<name>Examples of Enveloped Messages</name> <name>Examples of Enveloped Messages</name>
<section anchor="Appendix_B_3_1"> <section anchor="Appendix_B_3_1">
<name>Direct ECDH</name> <name>Direct ECDH</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>CEK: AES-GCM w/ 128-bit key</li> <li>CEK: AES-GCM w/ 128-bit key</li>
<li>Recipient class: ECDH Ephemeral-Static, Curve P-256</li> <li>Recipient class: ECDH Ephemeral-Static, Curve P-256</li>
</ul> </ul>
<t>Size of binary file is 151 bytes</t> <t>Size of binary file is 151 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
96( 96(
[ [
/ protected h'a10101' / << { / protected h'a10101' / << {
/ alg / 1:1 / AES-GCM 128 / / alg / 1:1 / AES-GCM 128 /
} >>, } >>,
/ unprotected / { / unprotected / {
/ iv / 5:h'c9cf4df2fe6c632bf7886413' / iv / 5:h'c9cf4df2fe6c632bf7886413'
}, },
/ ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0
c52a357da7a644b8070a151b0', c52a357da7a644b8070a151b0',
skipping to change at line 2446 skipping to change at line 2502
</t> </t>
<ul> <ul>
<li>salt: "aabbccddeeffgghh"</li> <li>salt: "aabbccddeeffgghh"</li>
<li>PartyU identity: "lighting-client"</li> <li>PartyU identity: "lighting-client"</li>
<li>PartyV identity: "lighting-server"</li> <li>PartyV identity: "lighting-server"</li>
<li>Supplementary Public Other: "Encryption Example 02"</l i> <li>Supplementary Public Other: "Encryption Example 02"</l i>
</ul> </ul>
</li> </li>
</ul> </ul>
<t>Size of binary file is 91 bytes</t> <t>Size of binary file is 91 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
96( 96(
[ [
/ protected h'a1010a' / << { / protected h'a1010a' / << {
/ alg / 1:10 / AES-CCM-16-64-128 / / alg / 1:10 / AES-CCM-16-64-128 /
} >>, } >>,
/ unprotected / { / unprotected / {
/ iv / 5:h'89f52f65a1c580933b5261a76c' / iv / 5:h'89f52f65a1c580933b5261a76c'
}, },
/ ciphertext / h'753548a19b1307084ca7b2056924ed95f2e3b17006dfe93 / ciphertext / h'753548a19b1307084ca7b2056924ed95f2e3b17006dfe93
1b687b847', 1b687b847',
skipping to change at line 2479 skipping to change at line 2535
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Appendix_B_3_4"> <section anchor="Appendix_B_3_4">
<name>Encrypted Content with External Data</name> <name>Encrypted Content with External Data</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>CEK: AES-GCM w/ 128-bit key</li> <li>CEK: AES-GCM w/ 128-bit key</li>
<!-- [rfced] This document mostly uses "static-static" (there is one instance of
"static-Static"); "Ephemeral-Static" is consistently capped. In addition, RFC-
to-be 9053 mostly uses "Ephemeral-Static" (there is one instance of ephemeral-st
atic); "static-static" is consistent.
Please review and let us know how/if these may be made consistent.
-->
<li>Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap</li> <li>Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap</li>
<li>Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077'</li> <li>Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077'</li>
</ul> </ul>
<t>Size of binary file is 173 bytes</t> <t>Size of binary file is 173 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
96( 96(
[ [
/ protected h'a10101' / << { / protected h'a10101' / << {
/ alg / 1:1 / AES-GCM 128 / / alg / 1:1 / AES-GCM 128 /
} >> , } >> ,
/ unprotected / { / unprotected / {
/ iv / 5:h'02d1f7e6f26c43d4868d87ce' / iv / 5:h'02d1f7e6f26c43d4868d87ce'
}, },
/ ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e28529d8f5335 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e28529d8f5335
e5f0165eee976b4a5f6c6f09d', e5f0165eee976b4a5f6c6f09d',
skipping to change at line 2523 skipping to change at line 2584
<section anchor="EncryptExamples"> <section anchor="EncryptExamples">
<name>Examples of Encrypted Messages</name> <name>Examples of Encrypted Messages</name>
<section anchor="Appendix_B_4_1"> <section anchor="Appendix_B_4_1">
<name>Simple Encrypted Message</name> <name>Simple Encrypted Message</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>CEK: AES-CCM w/ 128-bit key and a 64-bit tag</li> <li>CEK: AES-CCM w/ 128-bit key and a 64-bit tag</li>
</ul> </ul>
<t>Size of binary file is 52 bytes</t> <t>Size of binary file is 52 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
16( 16(
[ [
/ protected h'a1010a' / << { / protected h'a1010a' / << {
/ alg / 1:10 / AES-CCM-16-64-128 / / alg / 1:10 / AES-CCM-16-64-128 /
} >> , } >> ,
/ unprotected / { / unprotected / {
/ iv / 5:h'89f52f65a1c580933b5261a78c' / iv / 5:h'89f52f65a1c580933b5261a78c'
}, },
/ ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce / ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce
460ffb569' 460ffb569'
skipping to change at line 2547 skipping to change at line 2608
</section> </section>
<section anchor="Appendix_B_4_2"> <section anchor="Appendix_B_4_2">
<name>Encrypted Message with a Partial IV</name> <name>Encrypted Message with a Partial IV</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>CEK: AES-CCM w/ 128-bit key and a 64-bit tag</li> <li>CEK: AES-CCM w/ 128-bit key and a 64-bit tag</li>
<li>Prefix for IV is 89F52F65A1C580933B52</li> <li>Prefix for IV is 89F52F65A1C580933B52</li>
</ul> </ul>
<t>Size of binary file is 41 bytes</t> <t>Size of binary file is 41 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
16( 16(
[ [
/ protected h'a1010a' / << { / protected h'a1010a' / << {
/ alg / 1:10 / AES-CCM-16-64-128 / / alg / 1:10 / AES-CCM-16-64-128 /
} >> , } >> ,
/ unprotected / { / unprotected / {
/ partial iv / 6:h'61a7' / partial iv / 6:h'61a7'
}, },
/ ciphertext / h'252a8911d465c125b6764739700f0141ed09192de139e05 / ciphertext / h'252a8911d465c125b6764739700f0141ed09192de139e05
3bd09abca' 3bd09abca'
skipping to change at line 2574 skipping to change at line 2635
<name>Examples of MACed Messages</name> <name>Examples of MACed Messages</name>
<section anchor="Appendix_B_5_1"> <section anchor="Appendix_B_5_1">
<name>Shared Secret Direct MAC</name> <name>Shared Secret Direct MAC</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>MAC: AES-CMAC, 256-bit key, truncated to 64 bits</li> <li>MAC: AES-CMAC, 256-bit key, truncated to 64 bits</li>
<li>Recipient class: direct shared secret</li> <li>Recipient class: direct shared secret</li>
</ul> </ul>
<t>Size of binary file is 57 bytes</t> <t>Size of binary file is 57 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
97( 97(
[ [
/ protected h'a1010f' / << { / protected h'a1010f' / << {
/ alg / 1:15 / AES-CBC-MAC-256//64 / / alg / 1:15 / AES-CBC-MAC-256//64 /
} >> , } >> ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'9e1226ba1f81b848', / tag / h'9e1226ba1f81b848',
/ recipients / [ / recipients / [
[ [
skipping to change at line 2603 skipping to change at line 2664
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Appendix_B_5_2"> <section anchor="Appendix_B_5_2">
<name>ECDH Direct MAC</name> <name>ECDH Direct MAC</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>MAC: HMAC w/SHA-256, 256-bit key</li> <li>MAC: HMAC w/SHA-256, 256-bit key</li>
<li>Recipient class: ECDH key agreement, two static keys, HKDF w/ context structure</li> <li>Recipient class: ECDH key agreement, two static keys, HKDF w/c ontext structure</li>
</ul> </ul>
<t>Size of binary file is 214 bytes</t> <t>Size of binary file is 214 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
97( 97(
[ [
/ protected h'a10105' / << { / protected h'a10105' / << {
/ alg / 1:5 / HMAC 256//256 / / alg / 1:5 / HMAC 256//256 /
} >> , } >> ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'81a03448acd3d305376eaa11fb3fe416a955be2cbe7ec96f012c99 / tag / h'81a03448acd3d305376eaa11fb3fe416a955be2cbe7ec96f012c99
4bc3f16a41', 4bc3f16a41',
/ recipients / [ / recipients / [
skipping to change at line 2641 skipping to change at line 2702
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Appendix_B_5_3"> <section anchor="Appendix_B_5_3">
<name>Wrapped MAC</name> <name>Wrapped MAC</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>MAC: AES-MAC, 128-bit key, truncated to 64 bits</li> <li>MAC: AES-MAC, 128-bit key, truncated to 64 bits</li>
<li>Recipient class: AES Key Wrap w/ a pre-shared 256-bit key</li> <li>Recipient class: AES Key Wrap w/ a preshared 256-bit key</li>
</ul> </ul>
<t>Size of binary file is 109 bytes</t> <t>Size of binary file is 109 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
97( 97(
[ [
/ protected h'a1010e' / << { / protected h'a1010e' / << {
/ alg / 1:14 / AES-CBC-MAC-128//64 / / alg / 1:14 / AES-CBC-MAC-128//64 /
} >> , } >> ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'36f5afaf0bab5d43', / tag / h'36f5afaf0bab5d43',
/ recipients / [ / recipients / [
[ [
skipping to change at line 2675 skipping to change at line 2736
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
<section anchor="Appendix_B_5_4"> <section anchor="Appendix_B_5_4">
<name>Multi-Recipient MACed Message</name> <name>Multi-Recipient MACed Message</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>MAC: HMAC w/ SHA-256, 128-bit key</li> <li>MAC: HMAC w/ SHA-256, 128-bit key</li>
<li> <li>
<t>Recipient class: Uses three different methods <t>Recipient class: Uses three different methods.
</t> </t>
<ol type="1"> <ol type="1">
<li>ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 12 8-bit key</li> <li>ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 12 8-bit key</li>
<li>AES Key Wrap w/ 256-bit key</li> <li>AES Key Wrap w/ 256-bit key</li>
</ol> </ol>
</li> </li>
</ul> </ul>
<t>Size of binary file is 309 bytes</t> <t>Size of binary file is 309 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
97( 97(
[ [
/ protected h'a10105' / << { / protected h'a10105' / << {
/ alg / 1:5 / HMAC 256//256 / / alg / 1:5 / HMAC 256//256 /
} >> , } >> ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'bf48235e809b5c42e995f2b7d5fa13620e7ed834e337f6aa43df16 / tag / h'bf48235e809b5c42e995f2b7d5fa13620e7ed834e337f6aa43df16
1e49e9323e', 1e49e9323e',
/ recipients / [ / recipients / [
skipping to change at line 2731 skipping to change at line 2792
] ]
] ]
] ]
) )
]]></sourcecode> ]]></sourcecode>
</section> </section>
</section> </section>
<section anchor="Mac0Examples"> <section anchor="Mac0Examples">
<name>Examples of MAC0 Messages</name> <name>Examples of MAC0 Messages</name>
<section anchor="Appendix_B_6_1"> <section anchor="Appendix_B_6_1">
<name>Shared Secret Direct MAC</name> <name>Shared-Secret Direct MAC</name>
<t>This example uses the following: <t>This example uses the following:
</t> </t>
<ul> <ul>
<li>MAC: AES-CMAC, 256-bit key, truncated to 64 bits</li> <li>MAC: AES-CMAC, 256-bit key, truncated to 64 bits</li>
<li>Recipient class: direct shared secret</li> <li>Recipient class: direct shared secret</li>
</ul> </ul>
<t>Size of binary file is 37 bytes</t> <t>Size of binary file is 37 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
17( 17(
[ [
/ protected h'a1010f' / << { / protected h'a1010f' / << {
/ alg / 1:15 / AES-CBC-MAC-256//64 / / alg / 1:15 / AES-CBC-MAC-256//64 /
} >> , } >> ,
/ unprotected / {}, / unprotected / {},
/ payload / 'This is the content.', / payload / 'This is the content.',
/ tag / h'726043745027214f' / tag / h'726043745027214f'
] ]
) )
]]></sourcecode> ]]></sourcecode>
<t>Note that this example uses the same inputs as <xref target="Append ix_B_5_1"/>. </t> <t>Note that this example uses the same inputs as <xref target="Append ix_B_5_1"/>. </t>
</section> </section>
</section> </section>
<section anchor="COSE_KEYS"> <section anchor="COSE_KEYS">
<name>COSE Keys</name> <name>COSE Keys</name>
<section> <section>
<name>Public Keys</name> <name>Public Keys</name>
<t>This is an example of a COSE Key Set. This example includes the pu blic keys for all of the previous examples. </t> <t>This is an example of a COSE Key Set. This example includes the pu blic keys for all of the previous examples. </t>
<t>In order the keys are: <!-- [rfced] Note that the order of the keys has been udpated based on erratum 6
487 <https://www.rfc-editor.org/errata_search.php?eid=6487> and per mail from Be
n Kaduk.
Current:
In order, the keys are:
* An EC key with a kid of "meriadoc.brandybuck@buckland.example"
* An EC key with a kid of "11"
* An EC key with a kid of "bilbo.baggins@hobbiton.example"
* An EC key with a kid of "peregrin.took@tuckborough.example"
-->
<t>In order, the keys are:
</t> </t>
<ul> <ul>
<li>An EC key with a kid of "meriadoc.brandybuck@buckland.example" </li> <li>An EC key with a kid of "meriadoc.brandybuck@buckland.example" </li>
<li>An EC key with a kid of "peregrin.took@tuckborough.example"</l
i>
<li>An EC key with a kid of "bilbo.baggins@hobbiton.example"</li>
<li>An EC key with a kid of "11"</li> <li>An EC key with a kid of "11"</li>
<li>An EC key with a kid of "bilbo.baggins@hobbiton.example"</li>
<li>An EC key with a kid of "peregrin.took@tuckborough.example"</l
i>
</ul> </ul>
<t>Size of binary file is 481 bytes</t> <t>Size of binary file is 481 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
[ [
{ {
-1:1, -1:1,
-2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0
8551d', 8551d',
-3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008
4d19c', 4d19c',
1:2, 1:2,
2:'meriadoc.brandybuck@buckland.example' 2:'meriadoc.brandybuck@buckland.example'
}, },
skipping to change at line 2825 skipping to change at line 2899
</t> </t>
<ul> <ul>
<li>An EC key with a kid of "meriadoc.brandybuck@buckland.example" </li> <li>An EC key with a kid of "meriadoc.brandybuck@buckland.example" </li>
<li>A shared-secret key with a kid of "our-secret"</li> <li>A shared-secret key with a kid of "our-secret"</li>
<li>An EC key with a kid of "peregrin.took@tuckborough.example"</l i> <li>An EC key with a kid of "peregrin.took@tuckborough.example"</l i>
<li>A shared-secret key with a kid of "018c0ae5-4d9b-471b-bfd6-eef 314bc7037"</li> <li>A shared-secret key with a kid of "018c0ae5-4d9b-471b-bfd6-eef 314bc7037"</li>
<li>An EC key with a kid of "bilbo.baggins@hobbiton.example"</li> <li>An EC key with a kid of "bilbo.baggins@hobbiton.example"</li>
<li>An EC key with a kid of "11"</li> <li>An EC key with a kid of "11"</li>
</ul> </ul>
<t>Size of binary file is 816 bytes</t> <t>Size of binary file is 816 bytes</t>
<sourcecode type="CBORdiag"><![CDATA[ <sourcecode type="cbor-diag"><![CDATA[
[ [
{ {
1:2, 1:2,
2:'meriadoc.brandybuck@buckland.example', 2:'meriadoc.brandybuck@buckland.example',
-1:1, -1:1,
-2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0
8551d', 8551d',
-3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008
4d19c', 4d19c',
-4:h'aff907c99f9ad3aae6c4cdf21122bce2bd68b5283e6907154ad911840fa -4:h'aff907c99f9ad3aae6c4cdf21122bce2bd68b5283e6907154ad911840fa
skipping to change at line 2898 skipping to change at line 2972
-1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4 -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4
27188' 27188'
} }
] ]
]]></sourcecode> ]]></sourcecode>
</section> </section>
</section> </section>
</section> </section>
<section numbered="false"> <section numbered="false">
<name>Acknowledgments</name> <name>Acknowledgments</name>
<t>This document is a product of the COSE working group of the IETF. </t> <t>This document is a product of the COSE Working Group of the IETF. </t>
<t>The following individuals are to blame for getting me started on this p <t>The following individuals are to blame for getting me started on this p
roject in the first place: Richard Barnes, Matt Miller, and Martin Thomson. </t roject in the first place: <contact fullname="Richard Barnes"/>, <contact fullna
> me="Matt Miller"/>, and <contact fullname="Martin Thomson"/>.</t>
<t>The initial version of the specification was based to some degree on th <t>The initial draft version of the specification was based to some degree
e outputs of the JOSE and S/MIME working groups. </t> on the outputs of the JOSE and S/MIME Working Groups. </t>
<t> <t>
The following individuals provided input into the final form of the docu ment: Carsten Bormann, John Bradley, Brain Campbell, Michael B. Jones, Ilari Liu svaara, Francesca Palombini, Ludwig Seitz, and Göran Selander. The following individuals provided input into the final form of the docu ment: <contact fullname="Carsten Bormann"/>, <contact fullname="John Bradley"/>, <contact fullname="Brian Campbell"/>, <contact fullname="Michael B. Jones"/>, < contact fullname="Ilari Liusvaara"/>, <contact fullname="Francesca Palombini"/>, <contact fullname="Ludwig Seitz"/>, and <contact fullname="Göran Selander"/>.
</t> </t>
</section> </section>
<!-- [rfced] Erratum 6597 <https://www.rfc-editor.org/errata/eid6597> was submit
ed in Jun 2021. It does not appear as though any updates are needed; please con
firm.
-->
<!-- [rfced] Throughout the text, the following terminology appears to be used
inconsistently. Please review these occurrences and let us know if/how they
may be made consistent.
- Note that one is singular and the other is plural; should these be updated for
consistency?
protected-header-parameter bucket vs unprotected-header-parameters bucket
-->
<!-- [rfced] Please review the "Inclusive Language" portion of the online
Style Guide <https://www.rfc-editor.org/styleguide/part2/#inclusive_language>
and let us know if any changes are needed. For example, should "whitespace" be
updated?
-->
</back> </back>
</rfc> </rfc>
 End of changes. 281 change blocks. 
1022 lines changed or deleted 1133 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/