idnits 2.17.1 draft-schaad-cose-rfc8152bis-struct-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There is 1 instance of too long lines in the document, the longest one being 1 character in excess of 72. ** The abstract seems to contain references ([I-D.schaad-cose-RFC8152bis-algs]), which it shouldn't. Please replace those with straight textual mentions of the documents in question. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (August 22, 2018) is 2073 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Unused Reference: 'AES-GCM' is defined on line 2551, but no explicit reference was found in the text == Unused Reference: 'MAC' is defined on line 2573, but no explicit reference was found in the text == Unused Reference: 'RFC2104' is defined on line 2578, but no explicit reference was found in the text == Unused Reference: 'RFC3394' is defined on line 2588, but no explicit reference was found in the text == Unused Reference: 'RFC3610' is defined on line 2592, but no explicit reference was found in the text == Unused Reference: 'RFC5869' is defined on line 2596, but no explicit reference was found in the text == Unused Reference: 'RFC6090' is defined on line 2601, but no explicit reference was found in the text == Unused Reference: 'RFC6979' is defined on line 2606, but no explicit reference was found in the text == Unused Reference: 'RFC7539' is defined on line 2615, but no explicit reference was found in the text == Unused Reference: 'RFC7748' is defined on line 2619, but no explicit reference was found in the text == Unused Reference: 'SEC1' is defined on line 2632, but no explicit reference was found in the text == Unused Reference: 'RFC4231' is defined on line 2655, but no explicit reference was found in the text == Unused Reference: 'RFC4493' is defined on line 2665, but no explicit reference was found in the text == Unused Reference: 'RFC5480' is defined on line 2677, but no explicit reference was found in the text == Unused Reference: 'RFC6151' is defined on line 2702, but no explicit reference was found in the text == Unused Reference: 'RFC8017' is defined on line 2737, but no explicit reference was found in the text == Unused Reference: 'SP800-56A' is defined on line 2756, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'AES-GCM' -- Possible downref: Non-RFC (?) normative reference: ref. 'DSS' -- Possible downref: Normative reference to a draft: ref. 'I-D.schaad-cose-rfc8152bis-algs' -- Possible downref: Non-RFC (?) normative reference: ref. 'MAC' ** Downref: Normative reference to an Informational RFC: RFC 2104 ** Downref: Normative reference to an Informational RFC: RFC 3394 ** Downref: Normative reference to an Informational RFC: RFC 3610 ** Downref: Normative reference to an Informational RFC: RFC 5869 ** Downref: Normative reference to an Informational RFC: RFC 6090 ** Downref: Normative reference to an Informational RFC: RFC 6979 ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) ** Obsolete normative reference: RFC 7539 (Obsoleted by RFC 8439) ** Downref: Normative reference to an Informational RFC: RFC 7748 ** Downref: Normative reference to an Informational RFC: RFC 8032 -- Possible downref: Non-RFC (?) normative reference: ref. 'SEC1' == Outdated reference: A later version (-11) exists of draft-greevenbosch-appsawg-cbor-cddl-09 == Outdated reference: A later version (-16) exists of draft-ietf-core-object-security-03 -- Obsolete informational reference (is this intentional?): RFC 2633 (Obsoleted by RFC 3851) -- Obsolete informational reference (is this intentional?): RFC 5751 (Obsoleted by RFC 8551) -- Obsolete informational reference (is this intentional?): RFC 7159 (Obsoleted by RFC 8259) -- Obsolete informational reference (is this intentional?): RFC 8152 (Obsoleted by RFC 9052, RFC 9053) Summary: 12 errors (**), 0 flaws (~~), 20 warnings (==), 10 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 COSE Working Group J. Schaad 3 Internet-Draft August Cellars 4 Obsoletes: 8152 (if approved) August 22, 2018 5 Intended status: Standards Track 6 Expires: February 23, 2019 8 CBOR Object Signing and Encryption (COSE) - Structures and Process 9 draft-schaad-cose-rfc8152bis-struct-00 11 Abstract 13 Concise Binary Object Representation (CBOR) is a data format designed 14 for small code size and small message size. There is a need for the 15 ability to have basic security services defined for this data format. 16 This document defines the CBOR Object Signing and Encryption (COSE) 17 protocol. This specification describes how to create and process 18 signatures, message authentication codes, and encryption using CBOR 19 for serialization. This specification additionally describes how to 20 represent cryptographic keys using CBOR. 22 This document along with [I-D.schaad-cose-rfc8152bis-algs] obsoletes 23 RFC8152. 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at https://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on February 23, 2019. 42 Copyright Notice 44 Copyright (c) 2018 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (https://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 60 1.1. Design Changes from JOSE . . . . . . . . . . . . . . . . 4 61 1.2. Requirements Terminology . . . . . . . . . . . . . . . . 5 62 1.3. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 5 63 1.4. CBOR-Related Terminology . . . . . . . . . . . . . . . . 6 64 1.5. Document Terminology . . . . . . . . . . . . . . . . . . 7 65 2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 7 66 3. Header Parameters . . . . . . . . . . . . . . . . . . . . . . 9 67 3.1. Common COSE Headers Parameters . . . . . . . . . . . . . 11 68 4. Signing Objects . . . . . . . . . . . . . . . . . . . . . . . 15 69 4.1. Signing with One or More Signers . . . . . . . . . . . . 15 70 4.2. Signing with One Signer . . . . . . . . . . . . . . . . . 17 71 4.3. Externally Supplied Data . . . . . . . . . . . . . . . . 18 72 4.4. Signing and Verification Process . . . . . . . . . . . . 19 73 4.5. Computing Counter Signatures . . . . . . . . . . . . . . 20 74 5. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 21 75 5.1. Enveloped COSE Structure . . . . . . . . . . . . . . . . 21 76 5.1.1. Content Key Distribution Methods . . . . . . . . . . 23 77 5.2. Single Recipient Encrypted . . . . . . . . . . . . . . . 24 78 5.3. How to Encrypt and Decrypt for AEAD Algorithms . . . . . 24 79 5.4. How to Encrypt and Decrypt for AE Algorithms . . . . . . 27 80 6. MAC Objects . . . . . . . . . . . . . . . . . . . . . . . . . 28 81 6.1. MACed Message with Recipients . . . . . . . . . . . . . . 29 82 6.2. MACed Messages with Implicit Key . . . . . . . . . . . . 30 83 6.3. How to Compute and Verify a MAC . . . . . . . . . . . . . 30 84 7. Key Objects . . . . . . . . . . . . . . . . . . . . . . . . . 32 85 7.1. COSE Key Common Parameters . . . . . . . . . . . . . . . 32 86 8. Signature Algorithms . . . . . . . . . . . . . . . . . . . . 35 87 9. Message Authentication Code (MAC) Algorithms . . . . . . . . 36 88 10. Content Encryption Algorithms . . . . . . . . . . . . . . . . 37 89 11. Key Derivation Functions (KDFs) . . . . . . . . . . . . . . . 37 90 12. Content Key Distribution Methods . . . . . . . . . . . . . . 38 91 12.1. Direct Encryption . . . . . . . . . . . . . . . . . . . 38 92 12.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . . . 39 93 12.3. Key Transport . . . . . . . . . . . . . . . . . . . . . 39 94 12.4. Direct Key Agreement . . . . . . . . . . . . . . . . . . 40 95 12.5. Key Agreement with Key Wrap . . . . . . . . . . . . . . 41 96 13. CBOR Encoder Restrictions . . . . . . . . . . . . . . . . . . 41 97 14. Application Profiling Considerations . . . . . . . . . . . . 42 98 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 43 99 15.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 43 100 15.2. COSE Header Parameters Registry . . . . . . . . . . . . 43 101 15.3. COSE Header Algorithm Parameters Registry . . . . . . . 44 102 15.4. COSE Algorithms Registry . . . . . . . . . . . . . . . . 45 103 15.5. COSE Key Common Parameters Registry . . . . . . . . . . 46 104 15.6. COSE Key Type Parameters Registry . . . . . . . . . . . 46 105 15.7. COSE Key Types Registry . . . . . . . . . . . . . . . . 47 106 15.8. COSE Elliptic Curves Registry . . . . . . . . . . . . . 47 107 15.9. Media Type Registrations . . . . . . . . . . . . . . . . 48 108 15.9.1. COSE Security Message . . . . . . . . . . . . . . . 48 109 15.9.2. COSE Key Media Type . . . . . . . . . . . . . . . . 49 110 15.10. CoAP Content-Formats Registry . . . . . . . . . . . . . 51 111 15.11. Expert Review Instructions . . . . . . . . . . . . . . . 52 112 16. Security Considerations . . . . . . . . . . . . . . . . . . . 53 113 17. References . . . . . . . . . . . . . . . . . . . . . . . . . 55 114 17.1. Normative References . . . . . . . . . . . . . . . . . . 55 115 17.2. Informative References . . . . . . . . . . . . . . . . . 57 116 Appendix A. Guidelines for External Data Authentication of 117 Algorithms . . . . . . . . . . . . . . . . . . . . . 60 118 A.1. Algorithm Identification . . . . . . . . . . . . . . . . 60 119 A.2. Counter Signature without Headers . . . . . . . . . . . . 63 120 Appendix B. Two Layers of Recipient Information . . . . . . . . 64 121 Appendix C. Examples . . . . . . . . . . . . . . . . . . . . . . 65 122 C.1. Examples of Signed Messages . . . . . . . . . . . . . . . 66 123 C.1.1. Single Signature . . . . . . . . . . . . . . . . . . 66 124 C.1.2. Multiple Signers . . . . . . . . . . . . . . . . . . 67 125 C.1.3. Counter Signature . . . . . . . . . . . . . . . . . . 68 126 C.1.4. Signature with Criticality . . . . . . . . . . . . . 69 127 C.2. Single Signer Examples . . . . . . . . . . . . . . . . . 70 128 C.2.1. Single ECDSA Signature . . . . . . . . . . . . . . . 70 129 C.3. Examples of Enveloped Messages . . . . . . . . . . . . . 71 130 C.3.1. Direct ECDH . . . . . . . . . . . . . . . . . . . . . 71 131 C.3.2. Direct Plus Key Derivation . . . . . . . . . . . . . 72 132 C.3.3. Counter Signature on Encrypted Content . . . . . . . 73 133 C.3.4. Encrypted Content with External Data . . . . . . . . 75 134 C.4. Examples of Encrypted Messages . . . . . . . . . . . . . 75 135 C.4.1. Simple Encrypted Message . . . . . . . . . . . . . . 75 136 C.4.2. Encrypted Message with a Partial IV . . . . . . . . . 76 137 C.5. Examples of MACed Messages . . . . . . . . . . . . . . . 76 138 C.5.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 76 139 C.5.2. ECDH Direct MAC . . . . . . . . . . . . . . . . . . . 77 140 C.5.3. Wrapped MAC . . . . . . . . . . . . . . . . . . . . . 78 141 C.5.4. Multi-Recipient MACed Message . . . . . . . . . . . . 79 142 C.6. Examples of MAC0 Messages . . . . . . . . . . . . . . . . 80 143 C.6.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 80 144 C.7. COSE Keys . . . . . . . . . . . . . . . . . . . . . . . . 81 145 C.7.1. Public Keys . . . . . . . . . . . . . . . . . . . . . 81 146 C.7.2. Private Keys . . . . . . . . . . . . . . . . . . . . 82 147 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 84 148 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 85 150 1. Introduction 152 There has been an increased focus on small, constrained devices that 153 make up the Internet of Things (IoT). One of the standards that has 154 come out of this process is "Concise Binary Object Representation 155 (CBOR)" [RFC7049]. CBOR extended the data model of the JavaScript 156 Object Notation (JSON) [RFC7159] by allowing for binary data, among 157 other changes. CBOR is being adopted by several of the IETF working 158 groups dealing with the IoT world as their encoding of data 159 structures. CBOR was designed specifically to be both small in terms 160 of messages transport and implementation size and be a schema-free 161 decoder. A need exists to provide message security services for IoT, 162 and using CBOR as the message-encoding format makes sense. 164 The JOSE working group produced a set of documents [RFC7515] 165 [RFC7516] [RFC7517] [RFC7518] using JSON that specified how to 166 process encryption, signatures, and Message Authentication Code (MAC) 167 operations and how to encode keys using JSON. This document defines 168 the CBOR Object Signing and Encryption (COSE) standard, which does 169 the same thing for the CBOR encoding format. While there is a strong 170 attempt to keep the flavor of the original JSON Object Signing and 171 Encryption (JOSE) documents, two considerations are taken into 172 account: 174 o CBOR has capabilities that are not present in JSON and are 175 appropriate to use. One example of this is the fact that CBOR has 176 a method of encoding binary directly without first converting it 177 into a base64-encoded string. 179 o COSE is not a direct copy of the JOSE specification. In the 180 process of creating COSE, decisions that were made for JOSE were 181 re-examined. In many cases, different results were decided on as 182 the criteria were not always the same. 184 1.1. Design Changes from JOSE 186 o Define a single top message structure so that encrypted, signed, 187 and MACed messages can easily be identified and still have a 188 consistent view. 190 o Signed messages distinguish between the protected and unprotected 191 parameters that relate to the content from those that relate to 192 the signature. 194 o MACed messages are separated from signed messages. 196 o MACed messages have the ability to use the same set of recipient 197 algorithms as enveloped messages for obtaining the MAC 198 authentication key. 200 o Use binary encodings for binary data rather than base64url 201 encodings. 203 o Combine the authentication tag for encryption algorithms with the 204 ciphertext. 206 o The set of cryptographic algorithms has been expanded in some 207 directions and trimmed in others. 209 1.2. Requirements Terminology 211 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 212 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 213 "OPTIONAL" in this document are to be interpreted as described in BCP 214 14 [RFC2119] [RFC8174] when, and only when, they appear in all 215 capitals, as shown here. 217 When the words appear in lowercase, this interpretation does not 218 apply. 220 1.3. CBOR Grammar 222 There is currently no standard CBOR grammar available for use by 223 specifications. The CBOR structures are therefore described in 224 prose. 226 The document was developed by first working on the grammar and then 227 developing the prose to go with it. An artifact of this is that the 228 prose was written using the primitive type strings defined by CBOR 229 Data Definition Language (CDDL) [CDDL]. In this specification, the 230 following primitive types are used: 232 any -- non-specific value that permits all CBOR values to be 233 placed here. 235 bool -- a boolean value (true: major type 7, value 21; false: 236 major type 7, value 20). 238 bstr -- byte string (major type 2). 240 int -- an unsigned integer or a negative integer. 242 nil -- a null value (major type 7, value 22). 244 nint -- a negative integer (major type 1). 246 tstr -- a UTF-8 text string (major type 3). 248 uint -- an unsigned integer (major type 0). 250 Two syntaxes from CDDL appear in this document as shorthand. These 251 are: 253 FOO / BAR -- indicates that either FOO or BAR can appear here. 255 [+ FOO] -- indicates that the type FOO appears one or more times 256 in an array. 258 As well as the prose description, a version of a CBOR grammar is 259 presented in CDDL. Since CDDL has not been published in an RFC, this 260 grammar may not work with the final version of CDDL. The CDDL 261 grammar is informational; the prose description is normative. 263 The collected CDDL can be extracted from the XML version of this 264 document via the following XPath expression below. (Depending on the 265 XPath evaluator one is using, it may be necessary to deal with > 266 as an entity.) 268 //artwork[@type='CDDL']/text() 270 CDDL expects the initial non-terminal symbol to be the first symbol 271 in the file. For this reason, the first fragment of CDDL is 272 presented here. 274 start = COSE_Messages / COSE_Key / COSE_KeySet / Internal_Types 276 ; This is defined to make the tool quieter: 277 Internal_Types = Sig_structure / Enc_structure / MAC_structure / 278 COSE_KDF_Context 280 The non-terminal Internal_Types is defined for dealing with the 281 automated validation tools used during the writing of this document. 282 It references those non-terminals that are used for security 283 computations but are not emitted for transport. 285 1.4. CBOR-Related Terminology 287 In JSON, maps are called objects and only have one kind of map key: a 288 string. In COSE, we use strings, negative integers, and unsigned 289 integers as map keys. The integers are used for compactness of 290 encoding and easy comparison. The inclusion of strings allows for an 291 additional range of short encoded values to be used as well. Since 292 the word "key" is mainly used in its other meaning, as a 293 cryptographic key, we use the term "label" for this usage as a map 294 key. 296 The presence of a label in a COSE map that is not a string or an 297 integer is an error. Applications can either fail processing or 298 process messages with incorrect labels; however, they MUST NOT create 299 messages with incorrect labels. 301 A CDDL grammar fragment defines the non-terminal 'label', as in the 302 previous paragraph, and 'values', which permits any value to be used. 304 label = int / tstr 305 values = any 307 1.5. Document Terminology 309 In this document, we use the following terminology: 311 Byte is a synonym for octet. 313 Constrained Application Protocol (CoAP) is a specialized web transfer 314 protocol for use in constrained systems. It is defined in [RFC7252]. 316 Authenticated Encryption (AE) [RFC5116] algorithms are those 317 encryption algorithms that provide an authentication check of the 318 contents algorithm with the encryption service. 320 Authenticated Encryption with Authenticated Data (AEAD) [RFC5116] 321 algorithms provide the same content authentication service as AE 322 algorithms, but they additionally provide for authentication of non- 323 encrypted data as well. 325 2. Basic COSE Structure 327 The COSE object structure is designed so that there can be a large 328 amount of common code when parsing and processing the different types 329 of security messages. All of the message structures are built on the 330 CBOR array type. The first three elements of the array always 331 contain the same information: 333 1. The set of protected header parameters wrapped in a bstr. 335 2. The set of unprotected header parameters as a map. 337 3. The content of the message. The content is either the plaintext 338 or the ciphertext as appropriate. The content may be detached, 339 but the location is still used. The content is wrapped in a bstr 340 when present and is a nil value when detached. 342 Elements after this point are dependent on the specific message type. 344 COSE messages are also built using the concept of layers to separate 345 different types of cryptographic concepts. As an example of how this 346 works, consider the COSE_Encrypt message (Section 5.1). This message 347 type is broken into two layers: the content layer and the recipient 348 layer. In the content layer, the plaintext is encrypted and 349 information about the encrypted message is placed. In the recipient 350 layer, the content encryption key (CEK) is encrypted and information 351 about how it is encrypted for each recipient is placed. A single 352 layer version of the encryption message COSE_Encrypt0 (Section 5.2) 353 is provided for cases where the CEK is pre-shared. 355 Identification of which type of message has been presented is done by 356 the following methods: 358 1. The specific message type is known from the context. This may be 359 defined by a marker in the containing structure or by 360 restrictions specified by the application protocol. 362 2. The message type is identified by a CBOR tag. Messages with a 363 CBOR tag are known in this specification as tagged messages, 364 while those without the CBOR tag are known as untagged messages. 365 This document defines a CBOR tag for each of the message 366 structures. These tags can be found in Table 1. 368 3. When a COSE object is carried in a media type of 'application/ 369 cose', the optional parameter 'cose-type' can be used to identify 370 the embedded object. The parameter is OPTIONAL if the tagged 371 version of the structure is used. The parameter is REQUIRED if 372 the untagged version of the structure is used. The value to use 373 with the parameter for each of the structures can be found in 374 Table 1. 376 4. When a COSE object is carried as a CoAP payload, the CoAP 377 Content-Format Option can be used to identify the message 378 content. The CoAP Content-Format values can be found in Table 5. 379 The CBOR tag for the message structure is not required as each 380 security message is uniquely identified. 382 +-------+---------------+---------------+---------------------------+ 383 | CBOR | cose-type | Data Item | Semantics | 384 | Tag | | | | 385 +-------+---------------+---------------+---------------------------+ 386 | 98 | cose-sign | COSE_Sign | COSE Signed Data Object | 387 | 18 | cose-sign1 | COSE_Sign1 | COSE Single Signer Data | 388 | | | | Object | 389 | 96 | cose-encrypt | COSE_Encrypt | COSE Encrypted Data | 390 | | | | Object | 391 | 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single Recipient | 392 | | | | Encrypted Data Object | 393 | 97 | cose-mac | COSE_Mac | COSE MACed Data Object | 394 | 17 | cose-mac0 | COSE_Mac0 | COSE Mac w/o Recipients | 395 | | | | Object | 396 +-------+---------------+---------------+---------------------------+ 398 Table 1: COSE Message Identification 400 The following CDDL fragment identifies all of the top messages 401 defined in this document. Separate non-terminals are defined for the 402 tagged and the untagged versions of the messages. 404 COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message 406 COSE_Untagged_Message = COSE_Sign / COSE_Sign1 / 407 COSE_Encrypt / COSE_Encrypt0 / 408 COSE_Mac / COSE_Mac0 410 COSE_Tagged_Message = COSE_Sign_Tagged / COSE_Sign1_Tagged / 411 COSE_Encrypt_Tagged / COSE_Encrypt0_Tagged / 412 COSE_Mac_Tagged / COSE_Mac0_Tagged 414 3. Header Parameters 416 The structure of COSE has been designed to have two buckets of 417 information that are not considered to be part of the payload itself, 418 but are used for holding information about content, algorithms, keys, 419 or evaluation hints for the processing of the layer. These two 420 buckets are available for use in all of the structures except for 421 keys. While these buckets are present, they may not all be usable in 422 all instances. For example, while the protected bucket is defined as 423 part of the recipient structure, some of the algorithms used for 424 recipient structures do not provide for authenticated data. If this 425 is the case, the protected bucket is left empty. 427 Both buckets are implemented as CBOR maps. The map key is a 'label' 428 (Section 1.4). The value portion is dependent on the definition for 429 the label. Both maps use the same set of label/value pairs. The 430 integer and string values for labels have been divided into several 431 sections including a standard range, a private range, and a range 432 that is dependent on the algorithm selected. The defined labels can 433 be found in the "COSE Header Parameters" IANA registry 434 (Section 15.2). 436 Two buckets are provided for each layer: 438 protected: Contains parameters about the current layer that are to 439 be cryptographically protected. This bucket MUST be empty if it 440 is not going to be included in a cryptographic computation. This 441 bucket is encoded in the message as a binary object. This value 442 is obtained by CBOR encoding the protected map and wrapping it in 443 a bstr object. Senders SHOULD encode a zero-length map as a zero- 444 length string rather than as a zero-length map (encoded as h'a0'). 445 The zero-length binary encoding is preferred because it is both 446 shorter and the version used in the serialization structures for 447 cryptographic computation. After encoding the map, the value is 448 wrapped in the binary object. Recipients MUST accept both a zero- 449 length binary value and a zero-length map encoded in the binary 450 value. The wrapping allows for the encoding of the protected map 451 to be transported with a greater chance that it will not be 452 altered in transit. (Badly behaved intermediates could decode and 453 re-encode, but this will result in a failure to verify unless the 454 re-encoded byte string is identical to the decoded byte string.) 455 This avoids the problem of all parties needing to be able to do a 456 common canonical encoding. 458 unprotected: Contains parameters about the current layer that are 459 not cryptographically protected. 461 Only parameters that deal with the current layer are to be placed at 462 that layer. As an example of this, the parameter 'content type' 463 describes the content of the message being carried in the message. 464 As such, this parameter is placed only in the content layer and is 465 not placed in the recipient or signature layers. In principle, one 466 should be able to process any given layer without reference to any 467 other layer. With the exception of the COSE_Sign structure, the only 468 data that needs to cross layers is the cryptographic key. 470 The buckets are present in all of the security objects defined in 471 this document. The fields in order are the 'protected' bucket (as a 472 CBOR 'bstr' type) and then the 'unprotected' bucket (as a CBOR 'map' 473 type). The presence of both buckets is required. The parameters 474 that go into the buckets come from the IANA "COSE Header Parameters" 475 registry (Section 15.2). Some common parameters are defined in the 476 next section, but a number of parameters are defined throughout this 477 document. 479 Labels in each of the maps MUST be unique. When processing messages, 480 if a label appears multiple times, the message MUST be rejected as 481 malformed. Applications SHOULD verify that the same label does not 482 occur in both the protected and unprotected headers. If the message 483 is not rejected as malformed, attributes MUST be obtained from the 484 protected bucket before they are obtained from the unprotected 485 bucket. 487 The following CDDL fragment represents the two header buckets. A 488 group "Headers" is defined in CDDL that represents the two buckets in 489 which attributes are placed. This group is used to provide these two 490 fields consistently in all locations. A type is also defined that 491 represents the map of common headers. 493 Headers = ( 494 protected : empty_or_serialized_map, 495 unprotected : header_map 496 ) 498 header_map = { 499 Generic_Headers, 500 * label => values 501 } 503 empty_or_serialized_map = bstr .cbor header_map / bstr .size 0 505 3.1. Common COSE Headers Parameters 507 This section defines a set of common header parameters. A summary of 508 these parameters can be found in Table 2. This table should be 509 consulted to determine the value of label and the type of the value. 511 The set of header parameters defined in this section are: 513 alg: This parameter is used to indicate the algorithm used for the 514 security processing. This parameter MUST be authenticated where 515 the ability to do so exists. This support is provided by AEAD 516 algorithms or construction (COSE_Sign, COSE_Sign0, COSE_Mac, and 517 COSE_Mac0). This authentication can be done either by placing the 518 header in the protected header bucket or as part of the externally 519 supplied data. The value is taken from the "COSE Algorithms" 520 registry (see Section 15.4). 522 crit: The parameter is used to indicate which protected header 523 labels an application that is processing a message is required to 524 understand. Parameters defined in this document do not need to be 525 included as they should be understood by all implementations. 527 When present, this parameter MUST be placed in the protected 528 header bucket. The array MUST have at least one value in it. 529 Not all labels need to be included in the 'crit' parameter. The 530 rules for deciding which header labels are placed in the array 531 are: 533 * Integer labels in the range of 0 to 8 SHOULD be omitted. 535 * Integer labels in the range -1 to -128 can be omitted as they 536 are algorithm dependent. If an application can correctly 537 process an algorithm, it can be assumed that it will correctly 538 process all of the common parameters associated with that 539 algorithm. Integer labels in the range -129 to -65536 SHOULD 540 be included as these would be less common parameters that might 541 not be generally supported. 543 * Labels for parameters required for an application MAY be 544 omitted. Applications should have a statement if the label can 545 be omitted. 547 The header parameter values indicated by 'crit' can be processed 548 by either the security library code or an application using a 549 security library; the only requirement is that the parameter is 550 processed. If the 'crit' value list includes a value for which 551 the parameter is not in the protected bucket, this is a fatal 552 error in processing the message. 554 content type: This parameter is used to indicate the content type of 555 the data in the payload or ciphertext fields. Integers are from 556 the "CoAP Content-Formats" IANA registry table [COAP.Formats]. 557 Text values following the syntax of "/" 558 where and are defined in Section 4.2 of 559 [RFC6838]. Leading and trailing whitespace is also omitted. 560 Textual content values along with parameters and subparameters can 561 be located using the IANA "Media Types" registry. Applications 562 SHOULD provide this parameter if the content structure is 563 potentially ambiguous. 565 kid: This parameter identifies one piece of data that can be used as 566 input to find the needed cryptographic key. The value of this 567 parameter can be matched against the 'kid' member in a COSE_Key 568 structure. Other methods of key distribution can define an 569 equivalent field to be matched. Applications MUST NOT assume that 570 'kid' values are unique. There may be more than one key with the 571 same 'kid' value, so all of the keys associated with this 'kid' 572 may need to be checked. The internal structure of 'kid' values is 573 not defined and cannot be relied on by applications. Key 574 identifier values are hints about which key to use. This is not a 575 security-critical field. For this reason, it can be placed in the 576 unprotected headers bucket. 578 IV: This parameter holds the Initialization Vector (IV) value. For 579 some symmetric encryption algorithms, this may be referred to as a 580 nonce. The IV can be placed in the unprotected header as 581 modifying the IV will cause the decryption to yield plaintext that 582 is readily detectable as garbled. 584 Partial IV: This parameter holds a part of the IV value. When using 585 the COSE_Encrypt0 structure, a portion of the IV can be part of 586 the context associated with the key. This field is used to carry 587 a value that causes the IV to be changed for each message. The IV 588 can be placed in the unprotected header as modifying the IV will 589 cause the decryption to yield plaintext that is readily detectable 590 as garbled. The 'Initialization Vector' and 'Partial 591 Initialization Vector' parameters MUST NOT both be present in the 592 same security layer. 594 The message IV is generated by the following steps: 596 1. Left-pad the Partial IV with zeros to the length of IV. 598 2. XOR the padded Partial IV with the context IV. 600 counter signature: This parameter holds one or more counter 601 signature values. Counter signatures provide a method of having a 602 second party sign some data. The counter signature parameter can 603 occur as an unprotected attribute in any of the following 604 structures: COSE_Sign1, COSE_Signature, COSE_Encrypt, 605 COSE_recipient, COSE_Encrypt0, COSE_Mac, and COSE_Mac0. These 606 structures all have the same beginning elements, so that a 607 consistent calculation of the counter signature can be computed. 608 Details on computing counter signatures are found in Section 4.5. 610 +-----------+-------+----------------+-------------+----------------+ 611 | Name | Label | Value Type | Value | Description | 612 | | | | Registry | | 613 +-----------+-------+----------------+-------------+----------------+ 614 | alg | 1 | int / tstr | COSE | Cryptographic | 615 | | | | Algorithms | algorithm to | 616 | | | | registry | use | 617 | crit | 2 | [+ label] | COSE Header | Critical | 618 | | | | Parameters | headers to be | 619 | | | | registry | understood | 620 | content | 3 | tstr / uint | CoAP | Content type | 621 | type | | | Content- | of the payload | 622 | | | | Formats or | | 623 | | | | Media Types | | 624 | | | | registries | | 625 | kid | 4 | bstr | | Key identifier | 626 | IV | 5 | bstr | | Full | 627 | | | | | Initialization | 628 | | | | | Vector | 629 | Partial | 6 | bstr | | Partial | 630 | IV | | | | Initialization | 631 | | | | | Vector | 632 | counter | 7 | COSE_Signature | | CBOR-encoded | 633 | signature | | / [+ | | signature | 634 | | | COSE_Signature | | structure | 635 | | | ] | | | 636 +-----------+-------+----------------+-------------+----------------+ 638 Table 2: Common Header Parameters 640 The CDDL fragment that represents the set of headers defined in this 641 section is given below. Each of the headers is tagged as optional 642 because they do not need to be in every map; headers required in 643 specific maps are discussed above. 645 Generic_Headers = ( 646 ? 1 => int / tstr, ; algorithm identifier 647 ? 2 => [+label], ; criticality 648 ? 3 => tstr / int, ; content type 649 ? 4 => bstr, ; key identifier 650 ? 5 => bstr, ; IV 651 ? 6 => bstr, ; Partial IV 652 ? 7 => COSE_Signature / [+COSE_Signature] ; Counter signature 653 ) 655 4. Signing Objects 657 COSE supports two different signature structures. COSE_Sign allows 658 for one or more signatures to be applied to the same content. 659 COSE_Sign1 is restricted to a single signer. The structures cannot 660 be converted between each other; as the signature computation 661 includes a parameter identifying which structure is being used, the 662 converted structure will fail signature validation. 664 4.1. Signing with One or More Signers 666 The COSE_Sign structure allows for one or more signatures to be 667 applied to a message payload. Parameters relating to the content and 668 parameters relating to the signature are carried along with the 669 signature itself. These parameters may be authenticated by the 670 signature, or just present. An example of a parameter about the 671 content is the content type. Examples of parameters about the 672 signature would be the algorithm and key used to create the signature 673 and counter signatures. 675 RFC 5652 indicates that: 677 When more than one signature is present, the successful validation 678 of one signature associated with a given signer is usually treated 679 as a successful signature by that signer. However, there are some 680 application environments where other rules are needed. An 681 application that employs a rule other than one valid signature for 682 each signer must specify those rules. Also, where simple matching 683 of the signer identifier is not sufficient to determine whether 684 the signatures were generated by the same signer, the application 685 specification must describe how to determine which signatures were 686 generated by the same signer. Support for different communities 687 of recipients is the primary reason that signers choose to include 688 more than one signature. 690 For example, the COSE_Sign structure might include signatures 691 generated with the Edwards-curve Digital Signature Algorithm (EdDSA) 692 [RFC8032] and with the Elliptic Curve Digital Signature Algorithm 693 (ECDSA) [DSS]. This allows recipients to verify the signature 694 associated with one algorithm or the other. More-detailed 695 information on multiple signature evaluations can be found in 696 [RFC5752]. 698 The signature structure can be encoded as either tagged or untagged 699 depending on the context it will be used in. A tagged COSE_Sign 700 structure is identified by the CBOR tag 98. The CDDL fragment that 701 represents this is: 703 COSE_Sign_Tagged = #6.98(COSE_Sign) 705 A COSE Signed Message is defined in two parts. The CBOR object that 706 carries the body and information about the body is called the 707 COSE_Sign structure. The CBOR object that carries the signature and 708 information about the signature is called the COSE_Signature 709 structure. Examples of COSE Signed Messages can be found in 710 Appendix C.1. 712 The COSE_Sign structure is a CBOR array. The fields of the array in 713 order are: 715 protected: This is as described in Section 3. 717 unprotected: This is as described in Section 3. 719 payload: This field contains the serialized content to be signed. 720 If the payload is not present in the message, the application is 721 required to supply the payload separately. The payload is wrapped 722 in a bstr to ensure that it is transported without changes. If 723 the payload is transported separately ("detached content"), then a 724 nil CBOR object is placed in this location, and it is the 725 responsibility of the application to ensure that it will be 726 transported without changes. 728 Note: When a signature with a message recovery algorithm is used 729 (Section 8), the maximum number of bytes that can be recovered is 730 the length of the payload. The size of the payload is reduced by 731 the number of bytes that will be recovered. If all of the bytes 732 of the payload are consumed, then the payload is encoded as a 733 zero-length binary string rather than as being absent. 735 signatures: This field is an array of signatures. Each signature is 736 represented as a COSE_Signature structure. 738 The CDDL fragment that represents the above text for COSE_Sign 739 follows. 741 COSE_Sign = [ 742 Headers, 743 payload : bstr / nil, 744 signatures : [+ COSE_Signature] 745 ] 747 The COSE_Signature structure is a CBOR array. The fields of the 748 array in order are: 750 protected: This is as described in Section 3. 752 unprotected: This is as described in Section 3. 754 signature: This field contains the computed signature value. The 755 type of the field is a bstr. Algorithms MUST specify padding if 756 the signature value is not a multiple of 8 bits. 758 The CDDL fragment that represents the above text for COSE_Signature 759 follows. 761 COSE_Signature = [ 762 Headers, 763 signature : bstr 764 ] 766 4.2. Signing with One Signer 768 The COSE_Sign1 signature structure is used when only one signature is 769 going to be placed on a message. The parameters dealing with the 770 content and the signature are placed in the same pair of buckets 771 rather than having the separation of COSE_Sign. 773 The structure can be encoded as either tagged or untagged depending 774 on the context it will be used in. A tagged COSE_Sign1 structure is 775 identified by the CBOR tag 18. The CDDL fragment that represents 776 this is: 778 COSE_Sign1_Tagged = #6.18(COSE_Sign1) 780 The CBOR object that carries the body, the signature, and the 781 information about the body and signature is called the COSE_Sign1 782 structure. Examples of COSE_Sign1 messages can be found in 783 Appendix C.2. 785 The COSE_Sign1 structure is a CBOR array. The fields of the array in 786 order are: 788 protected: This is as described in Section 3. 790 unprotected: This is as described in Section 3. 792 payload: This is as described in Section 4.1. 794 signature: This field contains the computed signature value. The 795 type of the field is a bstr. 797 The CDDL fragment that represents the above text for COSE_Sign1 798 follows. 800 COSE_Sign1 = [ 801 Headers, 802 payload : bstr / nil, 803 signature : bstr 804 ] 806 4.3. Externally Supplied Data 808 One of the features offered in the COSE document is the ability for 809 applications to provide additional data to be authenticated, but that 810 is not carried as part of the COSE object. The primary reason for 811 supporting this can be seen by looking at the CoAP message structure 812 [RFC7252], where the facility exists for options to be carried before 813 the payload. Examples of data that can be placed in this location 814 would be the CoAP code or CoAP options. If the data is in the header 815 section, then it is available for proxies to help in performing its 816 operations. For example, the Accept Option can be used by a proxy to 817 determine if an appropriate value is in the proxy's cache. But the 818 sender can prevent a proxy from changing the set of values that it 819 will accept by including that value in the resulting authentication 820 tag. However, it may also be desired to protect these values so that 821 if they are modified in transit, it can be detected. 823 This document describes the process for using a byte array of 824 externally supplied authenticated data; however, the method of 825 constructing the byte array is a function of the application. 826 Applications that use this feature need to define how the externally 827 supplied authenticated data is to be constructed. Such a 828 construction needs to take into account the following issues: 830 o If multiple items are included, applications need to ensure that 831 the same byte string is not produced if there are different 832 inputs. This could occur by appending the strings 'AB' and 'CDE' 833 or by appending the strings 'ABC' and 'DE'. This is usually 834 addressed by making fields a fixed width and/or encoding the 835 length of the field as part of the output. Using options from 836 CoAP [RFC7252] as an example, these fields use a TLV structure so 837 they can be concatenated without any problems. 839 o If multiple items are included, an order for the items needs to be 840 defined. Using options from CoAP as an example, an application 841 could state that the fields are to be ordered by the option 842 number. 844 o Applications need to ensure that the byte stream is going to be 845 the same on both sides. Using options from CoAP might give a 846 problem if the same relative numbering is kept. An intermediate 847 node could insert or remove an option, changing how the relative 848 number is done. An application would need to specify that the 849 relative number must be re-encoded to be relative only to the 850 options that are in the external data. 852 4.4. Signing and Verification Process 854 In order to create a signature, a well-defined byte stream is needed. 855 The Sig_struture is used to create the canonical form. This signing 856 and verification process takes in the body information (COSE_Sign or 857 COSE_Sign1), the signer information (COSE_Signature), and the 858 application data (external source). A Sig_structure is a CBOR array. 859 The fields of the Sig_struture in order are: 861 1. A text string identifying the context of the signature. The 862 context string is: 864 "Signature" for signatures using the COSE_Signature structure. 866 "Signature1" for signatures using the COSE_Sign1 structure. 868 "CounterSignature" for signatures used as counter signature 869 attributes. 871 2. The protected attributes from the body structure encoded in a 872 bstr type. If there are no protected attributes, a bstr of 873 length zero is used. 875 3. The protected attributes from the signer structure encoded in a 876 bstr type. If there are no protected attributes, a bstr of 877 length zero is used. This field is omitted for the COSE_Sign1 878 signature structure. 880 4. The protected attributes from the application encoded in a bstr 881 type. If this field is not supplied, it defaults to a zero- 882 length binary string. (See Section 4.3 for application guidance 883 on constructing this field.) 885 5. The payload to be signed encoded in a bstr type. The payload is 886 placed here independent of how it is transported. 888 The CDDL fragment that describes the above text is: 890 Sig_structure = [ 891 context : "Signature" / "Signature1" / "CounterSignature", 892 body_protected : empty_or_serialized_map, 893 ? sign_protected : empty_or_serialized_map, 894 external_aad : bstr, 895 payload : bstr 896 ] 898 How to compute a signature: 900 1. Create a Sig_structure and populate it with the appropriate 901 fields. 903 2. Create the value ToBeSigned by encoding the Sig_structure to a 904 byte string, using the encoding described in Section 13. 906 3. Call the signature creation algorithm passing in K (the key to 907 sign with), alg (the algorithm to sign with), and ToBeSigned (the 908 value to sign). 910 4. Place the resulting signature value in the 'signature' field of 911 the array. 913 The steps for verifying a signature are: 915 1. Create a Sig_structure object and populate it with the 916 appropriate fields. 918 2. Create the value ToBeSigned by encoding the Sig_structure to a 919 byte string, using the encoding described in Section 13. 921 3. Call the signature verification algorithm passing in K (the key 922 to verify with), alg (the algorithm used sign with), ToBeSigned 923 (the value to sign), and sig (the signature to be verified). 925 In addition to performing the signature verification, the application 926 may also perform the appropriate checks to ensure that the key is 927 correctly paired with the signing identity and that the signing 928 identity is authorized before performing actions. 930 4.5. Computing Counter Signatures 932 Counter signatures provide a method of associating a different 933 signature generated by different signers with some piece of content. 934 This is normally used to provide a signature on a signature allowing 935 for a proof that a signature existed at a given time (i.e., a 936 Timestamp). In this document, we allow for counter signatures to 937 exist in a greater number of environments. As an example, it is 938 possible to place a counter signature in the unprotected attributes 939 of a COSE_Encrypt object. This would allow for an intermediary to 940 either verify that the encrypted byte stream has not been modified, 941 without being able to decrypt it, or assert that an encrypted byte 942 stream either existed at a given time or passed through it in terms 943 of routing (i.e., a proxy signature). 945 An example of a counter signature on a signature can be found in 946 Appendix C.1.3. An example of a counter signature in an encryption 947 object can be found in Appendix C.3.3. 949 The creation and validation of counter signatures over the different 950 items relies on the fact that the objects have the same structure. 951 The elements are a set of protected attributes, a set of unprotected 952 attributes, and a body, in that order. This means that the 953 Sig_structure can be used in a uniform manner to get the byte stream 954 for processing a signature. If the counter signature is going to be 955 computed over a COSE_Encrypt structure, the body_protected and 956 payload items can be mapped into the Sig_structure in the same manner 957 as from the COSE_Sign structure. 959 It should be noted that only a signature algorithm with appendix (see 960 Section 8) can be used for counter signatures. This is because the 961 body should be able to be processed without having to evaluate the 962 counter signature, and this is not possible for signature schemes 963 with message recovery. 965 5. Encryption Objects 967 COSE supports two different encryption structures. COSE_Encrypt0 is 968 used when a recipient structure is not needed because the key to be 969 used is known implicitly. COSE_Encrypt is used the rest of the time. 970 This includes cases where there are multiple recipients or a 971 recipient algorithm other than direct is used. 973 5.1. Enveloped COSE Structure 975 The enveloped structure allows for one or more recipients of a 976 message. There are provisions for parameters about the content and 977 parameters about the recipient information to be carried in the 978 message. The protected parameters associated with the content are 979 authenticated by the content encryption algorithm. The protected 980 parameters associated with the recipient are authenticated by the 981 recipient algorithm (when the algorithm supports it). Examples of 982 parameters about the content are the type of the content and the 983 content encryption algorithm. Examples of parameters about the 984 recipient are the recipient's key identifier and the recipient's 985 encryption algorithm. 987 The same techniques and structures are used for encrypting both the 988 plaintext and the keys. This is different from the approach used by 989 both "Cryptographic Message Syntax (CMS)" [RFC5652] and "JSON Web 990 Encryption (JWE)" [RFC7516] where different structures are used for 991 the content layer and for the recipient layer. Two structures are 992 defined: COSE_Encrypt to hold the encrypted content and 993 COSE_recipient to hold the encrypted keys for recipients. Examples 994 of encrypted messages can be found in Appendix C.3. 996 The COSE_Encrypt structure can be encoded as either tagged or 997 untagged depending on the context it will be used in. A tagged 998 COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL 999 fragment that represents this is: 1001 COSE_Encrypt_Tagged = #6.96(COSE_Encrypt) 1003 The COSE_Encrypt structure is a CBOR array. The fields of the array 1004 in order are: 1006 protected: This is as described in Section 3. 1008 unprotected: This is as described in Section 3. 1010 ciphertext: This field contains the ciphertext encoded as a bstr. 1011 If the ciphertext is to be transported independently of the 1012 control information about the encryption process (i.e., detached 1013 content), then the field is encoded as a nil value. 1015 recipients: This field contains an array of recipient information 1016 structures. The type for the recipient information structure is a 1017 COSE_recipient. 1019 The CDDL fragment that corresponds to the above text is: 1021 COSE_Encrypt = [ 1022 Headers, 1023 ciphertext : bstr / nil, 1024 recipients : [+COSE_recipient] 1025 ] 1027 The COSE_recipient structure is a CBOR array. The fields of the 1028 array in order are: 1030 protected: This is as described in Section 3. 1032 unprotected: This is as described in Section 3. 1034 ciphertext: This field contains the encrypted key encoded as a bstr. 1035 All encoded keys are symmetric keys; the binary value of the key 1036 is the content. If there is not an encrypted key, then this field 1037 is encoded as a nil value. 1039 recipients: This field contains an array of recipient information 1040 structures. The type for the recipient information structure is a 1041 COSE_recipient (an example of this can be found in Appendix B). 1042 If there are no recipient information structures, this element is 1043 absent. 1045 The CDDL fragment that corresponds to the above text for 1046 COSE_recipient is: 1048 COSE_recipient = [ 1049 Headers, 1050 ciphertext : bstr / nil, 1051 ? recipients : [+COSE_recipient] 1052 ] 1054 5.1.1. Content Key Distribution Methods 1056 An encrypted message consists of an encrypted content and an 1057 encrypted CEK for one or more recipients. The CEK is encrypted for 1058 each recipient, using a key specific to that recipient. The details 1059 of this encryption depend on which class the recipient algorithm 1060 falls into. Specific details on each of the classes can be found in 1061 Section 12. A short summary of the five content key distribution 1062 methods is: 1064 direct: The CEK is the same as the identified previously distributed 1065 symmetric key or is derived from a previously distributed secret. 1066 No CEK is transported in the message. 1068 symmetric key-encryption keys (KEK): The CEK is encrypted using a 1069 previously distributed symmetric KEK. Also known as key wrap. 1071 key agreement: The recipient's public key and a sender's private key 1072 are used to generate a pairwise secret, a Key Derivation Function 1073 (KDF) is applied to derive a key, and then the CEK is either the 1074 derived key or encrypted by the derived key. 1076 key transport: The CEK is encrypted with the recipient's public key. 1077 No key transport algorithms are defined in this document. 1079 passwords: The CEK is encrypted in a KEK that is derived from a 1080 password. No password algorithms are defined in this document. 1082 5.2. Single Recipient Encrypted 1084 The COSE_Encrypt0 encrypted structure does not have the ability to 1085 specify recipients of the message. The structure assumes that the 1086 recipient of the object will already know the identity of the key to 1087 be used in order to decrypt the message. If a key needs to be 1088 identified to the recipient, the enveloped structure ought to be 1089 used. 1091 Examples of encrypted messages can be found in Appendix C.3. 1093 The COSE_Encrypt0 structure can be encoded as either tagged or 1094 untagged depending on the context it will be used in. A tagged 1095 COSE_Encrypt0 structure is identified by the CBOR tag 16. The CDDL 1096 fragment that represents this is: 1098 COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0) 1100 The COSE_Encrypt0 structure is a CBOR array. The fields of the array 1101 in order are: 1103 protected: This is as described in Section 3. 1105 unprotected: This is as described in Section 3. 1107 ciphertext: This is as described in Section 5.1. 1109 The CDDL fragment for COSE_Encrypt0 that corresponds to the above 1110 text is: 1112 COSE_Encrypt0 = [ 1113 Headers, 1114 ciphertext : bstr / nil, 1115 ] 1117 5.3. How to Encrypt and Decrypt for AEAD Algorithms 1119 The encryption algorithm for AEAD algorithms is fairly simple. The 1120 first step is to create a consistent byte stream for the 1121 authenticated data structure. For this purpose, we use an 1122 Enc_structure. The Enc_structure is a CBOR array. The fields of the 1123 Enc_structure in order are: 1125 1. A text string identifying the context of the authenticated data 1126 structure. The context string is: 1128 "Encrypt0" for the content encryption of a COSE_Encrypt0 data 1129 structure. 1131 "Encrypt" for the first layer of a COSE_Encrypt data structure 1132 (i.e., for content encryption). 1134 "Enc_Recipient" for a recipient encoding to be placed in an 1135 COSE_Encrypt data structure. 1137 "Mac_Recipient" for a recipient encoding to be placed in a 1138 MACed message structure. 1140 "Rec_Recipient" for a recipient encoding to be placed in a 1141 recipient structure. 1143 2. The protected attributes from the body structure encoded in a 1144 bstr type. If there are no protected attributes, a bstr of 1145 length zero is used. 1147 3. The protected attributes from the application encoded in a bstr 1148 type. If this field is not supplied, it defaults to a zero- 1149 length bstr. (See Section 4.3 for application guidance on 1150 constructing this field.) 1152 The CDDL fragment that describes the above text is: 1154 Enc_structure = [ 1155 context : "Encrypt" / "Encrypt0" / "Enc_Recipient" / 1156 "Mac_Recipient" / "Rec_Recipient", 1157 protected : empty_or_serialized_map, 1158 external_aad : bstr 1159 ] 1161 How to encrypt a message: 1163 1. Create an Enc_structure and populate it with the appropriate 1164 fields. 1166 2. Encode the Enc_structure to a byte stream (Additional 1167 Authenticated Data (AAD)), using the encoding described in 1168 Section 13. 1170 3. Determine the encryption key (K). This step is dependent on the 1171 class of recipient algorithm being used. For: 1173 No Recipients: The key to be used is determined by the algorithm 1174 and key at the current layer. Examples are key transport keys 1175 (Section 12.3), key wrap keys (Section 12.2), or pre-shared 1176 secrets. 1178 Direct Encryption and Direct Key Agreement: The key is 1179 determined by the key and algorithm in the recipient 1180 structure. The encryption algorithm and size of the key to be 1181 used are inputs into the KDF used for the recipient. (For 1182 direct, the KDF can be thought of as the identity operation.) 1183 Examples of these algorithms are found in Sections !!! DIRECT- 1184 KDF !!! and !!! ECDH !!! 1186 Other: The key is randomly or pseudorandomly generated. 1188 4. Call the encryption algorithm with K (the encryption key), P (the 1189 plaintext), and AAD. Place the returned ciphertext into the 1190 'ciphertext' field of the structure. 1192 5. For recipients of the message, recursively perform the encryption 1193 algorithm for that recipient, using K (the encryption key) as the 1194 plaintext. 1196 How to decrypt a message: 1198 1. Create an Enc_structure and populate it with the appropriate 1199 fields. 1201 2. Encode the Enc_structure to a byte stream (AAD), using the 1202 encoding described in Section 13. 1204 3. Determine the decryption key. This step is dependent on the 1205 class of recipient algorithm being used. For: 1207 No Recipients: The key to be used is determined by the algorithm 1208 and key at the current layer. Examples are key transport keys 1209 (Section 12.3), key wrap keys (Section 12.2), or pre-shared 1210 secrets. 1212 Direct Encryption and Direct Key Agreement: The key is 1213 determined by the key and algorithm in the recipient 1214 structure. The encryption algorithm and size of the key to be 1215 used are inputs into the KDF used for the recipient. (For 1216 direct, the KDF can be thought of as the identity operation.) 1217 Examples of these algorithms are found in Sections !!! DIRECT- 1218 KDF !!! and !!! ECDH !!! . 1220 Other: The key is determined by decoding and decrypting one of 1221 the recipient structures. 1223 4. Call the decryption algorithm with K (the decryption key to use), 1224 C (the ciphertext), and AAD. 1226 5.4. How to Encrypt and Decrypt for AE Algorithms 1228 How to encrypt a message: 1230 1. Verify that the 'protected' field is empty. 1232 2. Verify that there was no external additional authenticated data 1233 supplied for this operation. 1235 3. Determine the encryption key. This step is dependent on the 1236 class of recipient algorithm being used. For: 1238 No Recipients: The key to be used is determined by the algorithm 1239 and key at the current layer. Examples are key transport keys 1240 (Section 12.3), key wrap keys (Section 12.2), or pre-shared 1241 secrets. 1243 Direct Encryption and Direct Key Agreement: The key is 1244 determined by the key and algorithm in the recipient 1245 structure. The encryption algorithm and size of the key to be 1246 used are inputs into the KDF used for the recipient. (For 1247 direct, the KDF can be thought of as the identity operation.) 1248 Examples of these algorithms are found in Sections !!!DIRECT- 1249 KDF!!! and !!! ECDH !!! . 1251 Other: The key is randomly generated. 1253 4. Call the encryption algorithm with K (the encryption key to use) 1254 and P (the plaintext). Place the returned ciphertext into the 1255 'ciphertext' field of the structure. 1257 5. For recipients of the message, recursively perform the encryption 1258 algorithm for that recipient, using K (the encryption key) as the 1259 plaintext. 1261 How to decrypt a message: 1263 1. Verify that the 'protected' field is empty. 1265 2. Verify that there was no external additional authenticated data 1266 supplied for this operation. 1268 3. Determine the decryption key. This step is dependent on the 1269 class of recipient algorithm being used. For: 1271 No Recipients: The key to be used is determined by the algorithm 1272 and key at the current layer. Examples are key transport keys 1273 (Section 12.3), key wrap keys (Section 12.2), or pre-shared 1274 secrets. 1276 Direct Encryption and Direct Key Agreement: The key is 1277 determined by the key and algorithm in the recipient 1278 structure. The encryption algorithm and size of the key to be 1279 used are inputs into the KDF used for the recipient. (For 1280 direct, the KDF can be thought of as the identity operation.) 1281 Examples of these algorithms are found in Sections !!! DIRECT- 1282 KDF !!! and !!! ECDH !!! . 1284 Other: The key is determined by decoding and decrypting one of 1285 the recipient structures. 1287 4. Call the decryption algorithm with K (the decryption key to use) 1288 and C (the ciphertext). 1290 6. MAC Objects 1292 COSE supports two different MAC structures. COSE_MAC0 is used when a 1293 recipient structure is not needed because the key to be used is 1294 implicitly known. COSE_MAC is used for all other cases. These 1295 include a requirement for multiple recipients, the key being unknown, 1296 and a recipient algorithm of other than direct. 1298 In this section, we describe the structure and methods to be used 1299 when doing MAC authentication in COSE. This document allows for the 1300 use of all of the same classes of recipient algorithms as are allowed 1301 for encryption. 1303 When using MAC operations, there are two modes in which they can be 1304 used. The first is just a check that the content has not been 1305 changed since the MAC was computed. Any class of recipient algorithm 1306 can be used for this purpose. The second mode is to both check that 1307 the content has not been changed since the MAC was computed and to 1308 use the recipient algorithm to verify who sent it. The classes of 1309 recipient algorithms that support this are those that use a pre- 1310 shared secret or do static-static (SS) key agreement (without the key 1311 wrap step). In both of these cases, the entity that created and sent 1312 the message MAC can be validated. (This knowledge of the sender 1313 assumes that there are only two parties involved and that you did not 1314 send the message to yourself.) The origination property can be 1315 obtained with both of the MAC message structures. 1317 6.1. MACed Message with Recipients 1319 The multiple recipient MACed message uses two structures: the 1320 COSE_Mac structure defined in this section for carrying the body and 1321 the COSE_recipient structure (Section 5.1) to hold the key used for 1322 the MAC computation. Examples of MACed messages can be found in 1323 Appendix C.5. 1325 The MAC structure can be encoded as either tagged or untagged 1326 depending on the context it will be used in. A tagged COSE_Mac 1327 structure is identified by the CBOR tag 97. The CDDL fragment that 1328 represents this is: 1330 COSE_Mac_Tagged = #6.97(COSE_Mac) 1332 The COSE_Mac structure is a CBOR array. The fields of the array in 1333 order are: 1335 protected: This is as described in Section 3. 1337 unprotected: This is as described in Section 3. 1339 payload: This field contains the serialized content to be MACed. If 1340 the payload is not present in the message, the application is 1341 required to supply the payload separately. The payload is wrapped 1342 in a bstr to ensure that it is transported without changes. If 1343 the payload is transported separately (i.e., detached content), 1344 then a nil CBOR value is placed in this location, and it is the 1345 responsibility of the application to ensure that it will be 1346 transported without changes. 1348 tag: This field contains the MAC value. 1350 recipients: This is as described in Section 5.1. 1352 The CDDL fragment that represents the above text for COSE_Mac 1353 follows. 1355 COSE_Mac = [ 1356 Headers, 1357 payload : bstr / nil, 1358 tag : bstr, 1359 recipients :[+COSE_recipient] 1360 ] 1362 6.2. MACed Messages with Implicit Key 1364 In this section, we describe the structure and methods to be used 1365 when doing MAC authentication for those cases where the recipient is 1366 implicitly known. 1368 The MACed message uses the COSE_Mac0 structure defined in this 1369 section for carrying the body. Examples of MACed messages with an 1370 implicit key can be found in Appendix C.6. 1372 The MAC structure can be encoded as either tagged or untagged 1373 depending on the context it will be used in. A tagged COSE_Mac0 1374 structure is identified by the CBOR tag 17. The CDDL fragment that 1375 represents this is: 1377 COSE_Mac0_Tagged = #6.17(COSE_Mac0) 1379 The COSE_Mac0 structure is a CBOR array. The fields of the array in 1380 order are: 1382 protected: This is as described in Section 3. 1384 unprotected: This is as described in Section 3. 1386 payload: This is as described in Section 6.1. 1388 tag: This field contains the MAC value. 1390 The CDDL fragment that corresponds to the above text is: 1392 COSE_Mac0 = [ 1393 Headers, 1394 payload : bstr / nil, 1395 tag : bstr, 1396 ] 1398 6.3. How to Compute and Verify a MAC 1400 In order to get a consistent encoding of the data to be 1401 authenticated, the MAC_structure is used to have a canonical form. 1402 The MAC_structure is a CBOR array. The fields of the MAC_structure 1403 in order are: 1405 1. A text string that identifies the structure that is being 1406 encoded. This string is "MAC" for the COSE_Mac structure. This 1407 string is "MAC0" for the COSE_Mac0 structure. 1409 2. The protected attributes from the COSE_MAC structure. If there 1410 are no protected attributes, a zero-length bstr is used. 1412 3. The protected attributes from the application encoded as a bstr 1413 type. If this field is not supplied, it defaults to a zero- 1414 length binary string. (See Section 4.3 for application guidance 1415 on constructing this field.) 1417 4. The payload to be MACed encoded in a bstr type. The payload is 1418 placed here independent of how it is transported. 1420 The CDDL fragment that corresponds to the above text is: 1422 MAC_structure = [ 1423 context : "MAC" / "MAC0", 1424 protected : empty_or_serialized_map, 1425 external_aad : bstr, 1426 payload : bstr 1427 ] 1429 The steps to compute a MAC are: 1431 1. Create a MAC_structure and populate it with the appropriate 1432 fields. 1434 2. Create the value ToBeMaced by encoding the MAC_structure to a 1435 byte stream, using the encoding described in Section 13. 1437 3. Call the MAC creation algorithm passing in K (the key to use), 1438 alg (the algorithm to MAC with), and ToBeMaced (the value to 1439 compute the MAC on). 1441 4. Place the resulting MAC in the 'tag' field of the COSE_Mac or 1442 COSE_Mac0 structure. 1444 5. Encrypt and encode the MAC key for each recipient of the message. 1446 The steps to verify a MAC are: 1448 1. Create a MAC_structure object and populate it with the 1449 appropriate fields. 1451 2. Create the value ToBeMaced by encoding the MAC_structure to a 1452 byte stream, using the encoding described in Section 13. 1454 3. Obtain the cryptographic key from one of the recipients of the 1455 message. 1457 4. Call the MAC creation algorithm passing in K (the key to use), 1458 alg (the algorithm to MAC with), and ToBeMaced (the value to 1459 compute the MAC on). 1461 5. Compare the MAC value to the 'tag' field of the COSE_Mac or 1462 COSE_Mac0 structure. 1464 7. Key Objects 1466 A COSE Key structure is built on a CBOR map object. The set of 1467 common parameters that can appear in a COSE Key can be found in the 1468 IANA "COSE Key Common Parameters" registry (Section 15.5). 1469 Additional parameters defined for specific key types can be found in 1470 the IANA "COSE Key Type Parameters" registry (Section 15.6). 1472 A COSE Key Set uses a CBOR array object as its underlying type. The 1473 values of the array elements are COSE Keys. A COSE Key Set MUST have 1474 at least one element in the array. Examples of COSE Key Sets can be 1475 found in Appendix C.7. 1477 Each element in a COSE Key Set MUST be processed independently. If 1478 one element in a COSE Key Set is either malformed or uses a key that 1479 is not understood by an application, that key is ignored and the 1480 other keys are processed normally. 1482 The element "kty" is a required element in a COSE_Key map. 1484 The CDDL grammar describing COSE_Key and COSE_KeySet is: 1486 COSE_Key = { 1487 1 => tstr / int, ; kty 1488 ? 2 => bstr, ; kid 1489 ? 3 => tstr / int, ; alg 1490 ? 4 => [+ (tstr / int) ], ; key_ops 1491 ? 5 => bstr, ; Base IV 1492 * label => values 1493 } 1495 COSE_KeySet = [+COSE_Key] 1497 7.1. COSE Key Common Parameters 1499 This document defines a set of common parameters for a COSE Key 1500 object. Table 3 provides a summary of the parameters defined in this 1501 section. There are also parameters that are defined for specific key 1502 types. Key-type-specific parameters can be found in 1503 [I-D.schaad-cose-rfc8152bis-algs]. 1505 +---------+-------+----------------+------------+-------------------+ 1506 | Name | Label | CBOR Type | Value | Description | 1507 | | | | Registry | | 1508 +---------+-------+----------------+------------+-------------------+ 1509 | kty | 1 | tstr / int | COSE Key | Identification of | 1510 | | | | Common | the key type | 1511 | | | | Parameters | | 1512 | | | | | | 1513 | kid | 2 | bstr | | Key | 1514 | | | | | identification | 1515 | | | | | value -- match to | 1516 | | | | | kid in message | 1517 | | | | | | 1518 | alg | 3 | tstr / int | COSE | Key usage | 1519 | | | | Algorithms | restriction to | 1520 | | | | | this algorithm | 1521 | | | | | | 1522 | key_ops | 4 | [+ (tstr/int)] | | Restrict set of | 1523 | | | | | permissible | 1524 | | | | | operations | 1525 | | | | | | 1526 | Base IV | 5 | bstr | | Base IV to be | 1527 | | | | | xor-ed with | 1528 | | | | | Partial IVs | 1529 +---------+-------+----------------+------------+-------------------+ 1531 Table 3: Key Map Labels 1533 kty: This parameter is used to identify the family of keys for this 1534 structure and, thus, the set of key-type-specific parameters to be 1535 found. The set of values defined in this document can be found in 1536 !!!! TABLE_KEY_TYPES !!! . This parameter MUST be present in a 1537 key object. Implementations MUST verify that the key type is 1538 appropriate for the algorithm being processed. The key type MUST 1539 be included as part of the trust decision process. 1541 alg: This parameter is used to restrict the algorithm that is used 1542 with the key. If this parameter is present in the key structure, 1543 the application MUST verify that this algorithm matches the 1544 algorithm for which the key is being used. If the algorithms do 1545 not match, then this key object MUST NOT be used to perform the 1546 cryptographic operation. Note that the same key can be in a 1547 different key structure with a different or no algorithm 1548 specified; however, this is considered to be a poor security 1549 practice. 1551 kid: This parameter is used to give an identifier for a key. The 1552 identifier is not structured and can be anything from a user- 1553 provided string to a value computed on the public portion of the 1554 key. This field is intended for matching against a 'kid' 1555 parameter in a message in order to filter down the set of keys 1556 that need to be checked. 1558 key_ops: This parameter is defined to restrict the set of operations 1559 that a key is to be used for. The value of the field is an array 1560 of values from Table 4. Algorithms define the values of key ops 1561 that are permitted to appear and are required for specific 1562 operations. The set of values matches that in [RFC7517] and 1563 [W3C.WebCrypto]. 1565 Base IV: This parameter is defined to carry the base portion of an 1566 IV. It is designed to be used with the Partial IV header 1567 parameter defined in Section 3.1. This field provides the ability 1568 to associate a Partial IV with a key that is then modified on a 1569 per message basis with the Partial IV. 1571 Extreme care needs to be taken when using a Base IV in an 1572 application. Many encryption algorithms lose security if the same 1573 IV is used twice. 1575 If different keys are derived for each sender, using the same Base 1576 IV with Partial IVs starting at zero is likely to ensure that the 1577 IV would not be used twice for a single key. If different keys 1578 are derived for each sender, starting at the same Base IV is 1579 likely to satisfy this condition. If the same key is used for 1580 multiple senders, then the application needs to provide for a 1581 method of dividing the IV space up between the senders. This 1582 could be done by providing a different base point to start from or 1583 a different Partial IV to start with and restricting the number of 1584 messages to be sent before rekeying. 1586 +---------+-------+-------------------------------------------------+ 1587 | Name | Value | Description | 1588 +---------+-------+-------------------------------------------------+ 1589 | sign | 1 | The key is used to create signatures. Requires | 1590 | | | private key fields. | 1591 | verify | 2 | The key is used for verification of signatures. | 1592 | encrypt | 3 | The key is used for key transport encryption. | 1593 | decrypt | 4 | The key is used for key transport decryption. | 1594 | | | Requires private key fields. | 1595 | wrap | 5 | The key is used for key wrap encryption. | 1596 | key | | | 1597 | unwrap | 6 | The key is used for key wrap decryption. | 1598 | key | | Requires private key fields. | 1599 | derive | 7 | The key is used for deriving keys. Requires | 1600 | key | | private key fields. | 1601 | derive | 8 | The key is used for deriving bits not to be | 1602 | bits | | used as a key. Requires private key fields. | 1603 | MAC | 9 | The key is used for creating MACs. | 1604 | create | | | 1605 | MAC | 10 | The key is used for validating MACs. | 1606 | verify | | | 1607 +---------+-------+-------------------------------------------------+ 1609 Table 4: Key Operation Values 1611 8. Signature Algorithms 1613 There are two signature algorithm schemes. The first is signature 1614 with appendix. In this scheme, the message content is processed and 1615 a signature is produced; the signature is called the appendix. This 1616 is the scheme used by algorithms such as ECDSA and the RSA 1617 Probabilistic Signature Scheme (RSASSA-PSS). (In fact, the SSA in 1618 RSASSA-PSS stands for Signature Scheme with Appendix.) 1620 The signature functions for this scheme are: 1622 signature = Sign(message content, key) 1624 valid = Verification(message content, key, signature) 1626 The second scheme is signature with message recovery (an example of 1627 such an algorithm is [PVSig]). In this scheme, the message content 1628 is processed, but part of it is included in the signature. Moving 1629 bytes of the message content into the signature allows for smaller 1630 signatures; the signature size is still potentially large, but the 1631 message content has shrunk. This has implications for systems 1632 implementing these algorithms and for applications that use them. 1633 The first is that the message content is not fully available until 1634 after a signature has been validated. Until that point, the part of 1635 the message contained inside of the signature is unrecoverable. The 1636 second is that the security analysis of the strength of the signature 1637 is very much based on the structure of the message content. Messages 1638 that are highly predictable require additional randomness to be 1639 supplied as part of the signature process. In the worst case, it 1640 becomes the same as doing a signature with appendix. Finally, in the 1641 event that multiple signatures are applied to a message, all of the 1642 signature algorithms are going to be required to consume the same 1643 number of bytes of message content. This means that the mixing of 1644 the different schemes in a single message is not supported, and if a 1645 recovery signature scheme is used, then the same amount of content 1646 needs to be consumed by all of the signatures. 1648 The signature functions for this scheme are: 1650 signature, message sent = Sign(message content, key) 1652 valid, message content = Verification(message sent, key, signature) 1654 Signature algorithms are used with the COSE_Signature and COSE_Sign1 1655 structures. At this time, only signatures with appendixes are 1656 defined for use with COSE; however, considerable interest has been 1657 expressed in using a signature with message recovery algorithm due to 1658 the effective size reduction that is possible. Implementations will 1659 need to keep this in mind for later possible integration. 1661 9. Message Authentication Code (MAC) Algorithms 1663 Message Authentication Codes (MACs) provide data authentication and 1664 integrity protection. They provide either no or very limited data 1665 origination. A MAC, for example, can be used to prove the identity 1666 of the sender to a third party. 1668 MACs use the same scheme as signature with appendix algorithms. The 1669 message content is processed and an authentication code is produced. 1670 The authentication code is frequently called a tag. 1672 The MAC functions are: 1674 tag = MAC_Create(message content, key) 1676 valid = MAC_Verify(message content, key, tag) 1678 MAC algorithms can be based on either a block cipher algorithm (i.e., 1679 AES-MAC) or a hash algorithm (i.e., a Hash-based Message 1680 Authentication Code (HMAC)). This document defines a MAC algorithm 1681 using each of these constructions. 1683 MAC algorithms are used in the COSE_Mac and COSE_Mac0 structures. 1685 10. Content Encryption Algorithms 1687 Content encryption algorithms provide data confidentiality for 1688 potentially large blocks of data using a symmetric key. They provide 1689 integrity on the data that was encrypted; however, they provide 1690 either no or very limited data origination. (One cannot, for 1691 example, be used to prove the identity of the sender to a third 1692 party.) The ability to provide data origination is linked to how the 1693 CEK is obtained. 1695 COSE restricts the set of legal content encryption algorithms to 1696 those that support authentication both of the content and additional 1697 data. The encryption process will generate some type of 1698 authentication value, but that value may be either explicit or 1699 implicit in terms of the algorithm definition. For simplicity's 1700 sake, the authentication code will normally be defined as being 1701 appended to the ciphertext stream. The encryption functions are: 1703 ciphertext = Encrypt(message content, key, additional data) 1705 valid, message content = Decrypt(cipher text, key, additional data) 1707 Most AEAD algorithms are logically defined as returning the message 1708 content only if the decryption is valid. Many but not all 1709 implementations will follow this convention. The message content 1710 MUST NOT be used if the decryption does not validate. 1712 These algorithms are used in COSE_Encrypt and COSE_Encrypt0. 1714 11. Key Derivation Functions (KDFs) 1716 KDFs are used to take some secret value and generate a different one. 1717 The secret value comes in three flavors: 1719 o Secrets that are uniformly random: This is the type of secret that 1720 is created by a good random number generator. 1722 o Secrets that are not uniformly random: This is type of secret that 1723 is created by operations like key agreement. 1725 o Secrets that are not random: This is the type of secret that 1726 people generate for things like passwords. 1728 General KDFs work well with the first type of secret, can do 1729 reasonably well with the second type of secret, and generally do 1730 poorly with the last type of secret. None of the KDFs in this 1731 section are designed to deal with the type of secrets that are used 1732 for passwords. Functions like PBES2 [RFC8018] need to be used for 1733 that type of secret. 1735 The same KDF can be set up to deal with the first two types of 1736 secrets in a different way. The KDF defined in !!! HDKF !!! is such 1737 a function. This is reflected in the set of algorithms defined for 1738 the HMAC-based Extract-and-Expand Key Derivation Function (HKDF). 1740 When using KDFs, one component that is included is context 1741 information. Context information is used to allow for different 1742 keying information to be derived from the same secret. The use of 1743 context-based keying material is considered to be a good security 1744 practice. 1746 12. Content Key Distribution Methods 1748 Content key distribution methods (recipient algorithms) can be 1749 defined into a number of different classes. COSE has the ability to 1750 support many classes of recipient algorithms. In this section, a 1751 number of classes are listed, and then a set of algorithms are 1752 specified for each of the classes. The names of the recipient 1753 algorithm classes used here are the same as those defined in 1754 [RFC7516]. Other specifications use different terms for the 1755 recipient algorithm classes or do not support some of the recipient 1756 algorithm classes. 1758 12.1. Direct Encryption 1760 The direct encryption class algorithms share a secret between the 1761 sender and the recipient that is used either directly or after 1762 manipulation as the CEK. When direct encryption mode is used, it 1763 MUST be the only mode used on the message. 1765 The COSE_Recipient structure for the recipient is organized as 1766 follows: 1768 o The 'protected' field MUST be a zero-length item unless it is used 1769 in the computation of the content key. 1771 o The 'alg' parameter MUST be present. 1773 o A parameter identifying the shared secret SHOULD be present. 1775 o The 'ciphertext' field MUST be a zero-length item. 1777 o The 'recipients' field MUST be absent. 1779 12.2. Key Wrap 1781 In key wrap mode, the CEK is randomly generated and that key is then 1782 encrypted by a shared secret between the sender and the recipient. 1783 All of the currently defined key wrap algorithms for COSE are AE 1784 algorithms. Key wrap mode is considered to be superior to direct 1785 encryption if the system has any capability for doing random key 1786 generation. This is because the shared key is used to wrap random 1787 data rather than data that has some degree of organization and may in 1788 fact be repeating the same content. The use of key wrap loses the 1789 weak data origination that is provided by the direct encryption 1790 algorithms. 1792 The COSE_Encrypt structure for the recipient is organized as follows: 1794 o The 'protected' field MUST be absent if the key wrap algorithm is 1795 an AE algorithm. 1797 o The 'recipients' field is normally absent, but can be used. 1798 Applications MUST deal with a recipient field being present, not 1799 being able to decrypt that recipient is an acceptable way of 1800 dealing with it. Failing to process the message is not an 1801 acceptable way of dealing with it. 1803 o The plaintext to be encrypted is the key from next layer down 1804 (usually the content layer). 1806 o At a minimum, the 'unprotected' field MUST contain the 'alg' 1807 parameter and SHOULD contain a parameter identifying the shared 1808 secret. 1810 12.3. Key Transport 1812 Key transport mode is also called key encryption mode in some 1813 standards. Key transport mode differs from key wrap mode in that it 1814 uses an asymmetric encryption algorithm rather than a symmetric 1815 encryption algorithm to protect the key. This document does not 1816 define any key transport mode algorithms. 1818 When using a key transport algorithm, the COSE_Encrypt structure for 1819 the recipient is organized as follows: 1821 o The 'protected' field MUST be absent. 1823 o The plaintext to be encrypted is the key from the next layer down 1824 (usually the content layer). 1826 o At a minimum, the 'unprotected' field MUST contain the 'alg' 1827 parameter and SHOULD contain a parameter identifying the 1828 asymmetric key. 1830 12.4. Direct Key Agreement 1832 The 'direct key agreement' class of recipient algorithms uses a key 1833 agreement method to create a shared secret. A KDF is then applied to 1834 the shared secret to derive a key to be used in protecting the data. 1835 This key is normally used as a CEK or MAC key, but could be used for 1836 other purposes if more than two layers are in use (see Appendix B). 1838 The most commonly used key agreement algorithm is Diffie-Hellman, but 1839 other variants exist. Since COSE is designed for a store and forward 1840 environment rather than an online environment, many of the DH 1841 variants cannot be used as the receiver of the message cannot provide 1842 any dynamic key material. One side effect of this is that perfect 1843 forward secrecy (see [RFC4949]) is not achievable. A static key will 1844 always be used for the receiver of the COSE object. 1846 Two variants of DH that are supported are: 1848 Ephemeral-Static (ES) DH: where the sender of the message creates 1849 a one-time DH key and uses a static key for the recipient. The 1850 use of the ephemeral sender key means that no additional random 1851 input is needed as this is randomly generated for each message. 1853 Static-Static DH: where a static key is used for both the sender 1854 and the recipient. The use of static keys allows for the 1855 recipient to get a weak version of data origination for the 1856 message. When static-static key agreement is used, then some 1857 piece of unique data for the KDF is required to ensure that a 1858 different key is created for each message. 1860 When direct key agreement mode is used, there MUST be only one 1861 recipient in the message. This method creates the key directly, and 1862 that makes it difficult to mix with additional recipients. If 1863 multiple recipients are needed, then the version with key wrap needs 1864 to be used. 1866 The COSE_Encrypt structure for the recipient is organized as follows: 1868 o At a minimum, headers MUST contain the 'alg' parameter and SHOULD 1869 contain a parameter identifying the recipient's asymmetric key. 1871 o The headers SHOULD identify the sender's key for the static-static 1872 versions and MUST contain the sender's ephemeral key for the 1873 ephemeral-static versions. 1875 12.5. Key Agreement with Key Wrap 1877 Key Agreement with Key Wrap uses a randomly generated CEK. The CEK 1878 is then encrypted using a key wrap algorithm and a key derived from 1879 the shared secret computed by the key agreement algorithm. The 1880 function for this would be: 1882 encryptedKey = KeyWrap(KDF(DH-Shared, context), CEK) 1884 The COSE_Encrypt structure for the recipient is organized as follows: 1886 o The 'protected' field is fed into the KDF context structure. 1888 o The plaintext to be encrypted is the key from the next layer down 1889 (usually the content layer). 1891 o The 'alg' parameter MUST be present in the layer. 1893 o A parameter identifying the recipient's key SHOULD be present. A 1894 parameter identifying the sender's key SHOULD be present. 1896 13. CBOR Encoder Restrictions 1898 There has been an attempt to limit the number of places where the 1899 document needs to impose restrictions on how the CBOR Encoder needs 1900 to work. We have managed to narrow it down to the following 1901 restrictions: 1903 o The restriction applies to the encoding of the COSE_KDF_Context, 1904 the Sig_structure, the Enc_structure, and the MAC_structure. 1906 o The rules for "Canonical CBOR" (Section 3.9 of RFC 7049) MUST be 1907 used in these locations. The main rule that needs to be enforced 1908 is that all lengths in these structures MUST be encoded such that 1909 they are using definite lengths, and the minimum length encoding 1910 is used. 1912 o Applications MUST NOT generate messages with the same label used 1913 twice as a key in a single map. Applications MUST NOT parse and 1914 process messages with the same label used twice as a key in a 1915 single map. Applications can enforce the parse and process 1916 requirement by using parsers that will fail the parse step or by 1917 using parsers that will pass all keys to the application, and the 1918 application can perform the check for duplicate keys. 1920 14. Application Profiling Considerations 1922 This document is designed to provide a set of security services, but 1923 not implementation requirements for specific usage. The 1924 interoperability requirements are provided for how each of the 1925 individual services are used and how the algorithms are to be used 1926 for interoperability. The requirements about which algorithms and 1927 which services are needed are deferred to each application. 1929 An example of a profile can be found in [OSCOAP] where two profiles 1930 are being developed. One is for carrying content by itself, and the 1931 other is for carrying content in combination with CoAP headers. 1933 It is intended that a profile of this document be created that 1934 defines the interoperability requirements for that specific 1935 application. This section provides a set of guidelines and topics 1936 that need to be considered when profiling this document. 1938 o Applications need to determine the set of messages defined in this 1939 document that they will be using. The set of messages corresponds 1940 fairly directly to the set of security services that are needed 1941 and to the security levels needed. 1943 o Applications may define new header parameters for a specific 1944 purpose. Applications will often times select specific header 1945 parameters to use or not to use. For example, an application 1946 would normally state a preference for using either the IV or the 1947 Partial IV parameter. If the Partial IV parameter is specified, 1948 then the application would also need to define how the fixed 1949 portion of the IV would be determined. 1951 o When applications use externally defined authenticated data, they 1952 need to define how that data is encoded. This document assumes 1953 that the data will be provided as a byte stream. More information 1954 can be found in Section 4.3. 1956 o Applications need to determine the set of security algorithms that 1957 are to be used. When selecting the algorithms to be used as the 1958 mandatory-to-implement set, consideration should be given to 1959 choosing different types of algorithms when two are chosen for a 1960 specific purpose. An example of this would be choosing HMAC- 1961 SHA512 and AES-CMAC as different MAC algorithms; the construction 1962 is vastly different between these two algorithms. This means that 1963 a weakening of one algorithm would be unlikely to lead to a 1964 weakening of the other algorithms. Of course, these algorithms do 1965 not provide the same level of security and thus may not be 1966 comparable for the desired security functionality. 1968 o Applications may need to provide some type of negotiation or 1969 discovery method if multiple algorithms or message structures are 1970 permitted. The method can be as simple as requiring 1971 preconfiguration of the set of algorithms to providing a discovery 1972 method built into the protocol. S/MIME provided a number of 1973 different ways to approach the problem that applications could 1974 follow: 1976 * Advertising in the message (S/MIME capabilities) [RFC5751]. 1978 * Advertising in the certificate (capabilities extension) 1979 [RFC4262]. 1981 * Minimum requirements for the S/MIME, which have been updated 1982 over time [RFC2633] [RFC5751] (note that [RFC2633] has been 1983 obsoleted by [RFC5751]). 1985 15. IANA Considerations 1987 The registeries and registrations listed below were created during 1988 processing of RFC 8152 [RFC8152]. The only known action at this time 1989 is to update the references. 1991 15.1. CBOR Tag Assignment 1993 IANA has assigned the following tags from the "CBOR Tags" registry. 1994 The tags for COSE_Sign1, COSE_Encrypt0, and COSE_Mac0 were assigned 1995 in the 1 to 23 value range (one byte long when encoded). The tags 1996 for COSE_Sign, COSE_Encrypt, and COSE_Mac were assigned in the 24 to 1997 255 value range (two bytes long when encoded). 1999 The tags assigned are in Table 1. 2001 15.2. COSE Header Parameters Registry 2003 IANA has created a registry titled "COSE Header Parameters". The 2004 registry has been created to use the "Expert Review Required" 2005 registration procedure [RFC8126]. Guidelines for the experts are 2006 provided in Section 15.11. It should be noted that, in addition to 2007 the expert review, some portions of the registry require a 2008 specification, potentially a Standards Track RFC, be supplied as 2009 well. 2011 The columns of the registry are: 2013 Name: The name is present to make it easier to refer to and discuss 2014 the registration entry. The value is not used in the protocol. 2015 Names are to be unique in the table. 2017 Label: This is the value used for the label. The label can be 2018 either an integer or a string. Registration in the table is based 2019 on the value of the label requested. Integer values between 1 and 2020 255 and strings of length 1 are designated as "Standards Action". 2021 Integer values from 256 to 65535 and strings of length 2 are 2022 designated as "Specification Required". Integer values of greater 2023 than 65535 and strings of length greater than 2 are designated as 2024 "Expert Review". Integer values in the range -1 to -65536 are 2025 "delegated to the COSE Header Algorithm Parameters registry". 2026 Integer values less than -65536 are marked as private use. 2028 Value Type: This contains the CBOR type for the value portion of the 2029 label. 2031 Value Registry: This contains a pointer to the registry used to 2032 contain values where the set is limited. 2034 Description: This contains a brief description of the header field. 2036 Reference: This contains a pointer to the specification defining the 2037 header field (where public). 2039 The initial contents of the registry is ... 2041 15.3. COSE Header Algorithm Parameters Registry 2043 IANA has created a registry titled "COSE Header Algorithm 2044 Parameters". The registry uses the "Expert Review Required" 2045 registration procedure. Expert review guidelines are provided in 2046 Section 15.11. 2048 The columns of the registry are: 2050 Name: The name is present to make it easier to refer to and discuss 2051 the registration entry. The value is not used in the protocol. 2053 Algorithm: The algorithm(s) that this registry entry is used for. 2054 This value is taken from the "COSE Algorithms" registry. Multiple 2055 algorithms can be specified in this entry. For the table, the 2056 algorithm/label pair MUST be unique. 2058 Label: This is the value used for the label. The label is an 2059 integer in the range of -1 to -65536. 2061 Type: This contains the CBOR type for the value portion of the 2062 label. 2064 Description: This contains a brief description of the header field. 2066 Reference: This contains a pointer to the specification defining the 2067 header field (where public). 2069 15.4. COSE Algorithms Registry 2071 IANA has created a registry titled "COSE Algorithms". The registry 2072 has been created to use the "Expert Review Required" registration 2073 procedure. Guidelines for the experts are provided in Section 15.11. 2074 It should be noted that, in addition to the expert review, some 2075 portions of the registry require a specification, potentially a 2076 Standards Track RFC, be supplied as well. 2078 The columns of the registry are: 2080 Name: A value that can be used to identify an algorithm in documents 2081 for easier comprehension. The name SHOULD be unique. However, 2082 the 'Value' field is what is used to identify the algorithm, not 2083 the 'name' field. 2085 Value: The value to be used to identify this algorithm. Algorithm 2086 values MUST be unique. The value can be a positive integer, a 2087 negative integer, or a string. Integer values between -256 and 2088 255 and strings of length 1 are designated as "Standards Action". 2089 Integer values from -65536 to 65535 and strings of length 2 are 2090 designated as "Specification Required". Integer values greater 2091 than 65535 and strings of length greater than 2 are designated as 2092 "Expert Review". Integer values less than -65536 are marked as 2093 private use. 2095 Description: A short description of the algorithm. 2097 Reference: A document where the algorithm is defined (if publicly 2098 available). 2100 Recommended: Does the IETF have a consensus recommendation to use 2101 the algorithm? The legal values are 'Yes', 'No', and 2102 'Deprecated'. 2104 NOTE: The assignment of algorithm identifiers in this document was 2105 done so that positive numbers were used for the first layer objects 2106 (COSE_Sign, COSE_Sign1, COSE_Encrypt, COSE_Encrypt0, COSE_Mac, and 2107 COSE_Mac0). Negative numbers were used for second layer objects 2108 (COSE_Signature and COSE_recipient). Expert reviewers should 2109 consider this practice, but are not expected to be restricted by this 2110 precedent. 2112 15.5. COSE Key Common Parameters Registry 2114 IANA has created a registry titled "COSE Key Common Parameters". The 2115 registry has been created to use the "Expert Review Required" 2116 registration procedure. Guidelines for the experts are provided in 2117 Section 15.11. It should be noted that, in addition to the expert 2118 review, some portions of the registry require a specification, 2119 potentially a Standards Track RFC, be supplied as well. 2121 The columns of the registry are: 2123 Name: This is a descriptive name that enables easier reference to 2124 the item. It is not used in the encoding. 2126 Label: The value to be used to identify this algorithm. Key map 2127 labels MUST be unique. The label can be a positive integer, a 2128 negative integer, or a string. Integer values between 0 and 255 2129 and strings of length 1 are designated as "Standards Action". 2130 Integer values from 256 to 65535 and strings of length 2 are 2131 designated as "Specification Required". Integer values of greater 2132 than 65535 and strings of length greater than 2 are designated as 2133 "Expert Review". Integer values in the range -65536 to -1 are 2134 "used for key parameters specific to a single algorithm delegated 2135 to the COSE Key Type Parameters registry". Integer values less 2136 than -65536 are marked as private use. 2138 CBOR Type: This field contains the CBOR type for the field. 2140 Value Registry: This field denotes the registry that values come 2141 from, if one exists. 2143 Description: This field contains a brief description for the field. 2145 Reference: This contains a pointer to the public specification for 2146 the field if one exists. 2148 15.6. COSE Key Type Parameters Registry 2150 IANA has created a registry titled "COSE Key Type Parameters". The 2151 registry has been created to use the "Expert Review Required" 2152 registration procedure. Expert review guidelines are provided in 2153 Section 15.11. 2155 The columns of the table are: 2157 Key Type: This field contains a descriptive string of a key type. 2158 This should be a value that is in the "COSE Key Common Parameters" 2159 registry and is placed in the 'kty' field of a COSE Key structure. 2161 Name: This is a descriptive name that enables easier reference to 2162 the item. It is not used in the encoding. 2164 Label: The label is to be unique for every value of key type. The 2165 range of values is from -65536 to -1. Labels are expected to be 2166 reused for different keys. 2168 CBOR Type: This field contains the CBOR type for the field. 2170 Description: This field contains a brief description for the field. 2172 Reference: This contains a pointer to the public specification for 2173 the field if one exists. 2175 15.7. COSE Key Types Registry 2177 IANA has created a new registry titled "COSE Key Types". The 2178 registry has been created to use the "Expert Review Required" 2179 registration procedure. Expert review guidelines are provided in 2180 Section 15.11. 2182 The columns of this table are: 2184 Name: This is a descriptive name that enables easier reference to 2185 the item. The name MUST be unique. It is not used in the 2186 encoding. 2188 Value: This is the value used to identify the curve. These values 2189 MUST be unique. The value can be a positive integer, a negative 2190 integer, or a string. 2192 Description: This field contains a brief description of the curve. 2194 References: This contains a pointer to the public specification for 2195 the curve if one exists. 2197 15.8. COSE Elliptic Curves Registry 2199 IANA has created a registry titled "COSE Elliptic Curves". The 2200 registry has been created to use the "Expert Review Required" 2201 registration procedure. Guidelines for the experts are provided in 2202 Section 15.11. It should be noted that, in addition to the expert 2203 review, some portions of the registry require a specification, 2204 potentially a Standards Track RFC, be supplied as well. 2206 The columns of the table are: 2208 Name: This is a descriptive name that enables easier reference to 2209 the item. It is not used in the encoding. 2211 Value: This is the value used to identify the curve. These values 2212 MUST be unique. The integer values from -256 to 255 are 2213 designated as "Standards Action". The integer values from 256 to 2214 65535 and -65536 to -257 are designated as "Specification 2215 Required". Integer values over 65535 are designated as "Expert 2216 Review". Integer values less than -65536 are marked as private 2217 use. 2219 Key Type: This designates the key type(s) that can be used with this 2220 curve. 2222 Description: This field contains a brief description of the curve. 2224 Reference: This contains a pointer to the public specification for 2225 the curve if one exists. 2227 Recommended: Does the IETF have a consensus recommendation to use 2228 the algorithm? The legal values are 'Yes', 'No', and 2229 'Deprecated'. 2231 15.9. Media Type Registrations 2233 15.9.1. COSE Security Message 2235 This section registers the 'application/cose' media type in the 2236 "Media Types" registry. These media types are used to indicate that 2237 the content is a COSE message. 2239 Type name: application 2241 Subtype name: cose 2243 Required parameters: N/A 2245 Optional parameters: cose-type 2247 Encoding considerations: binary 2249 Security considerations: See the Security Considerations section 2250 of RFC 8152. 2252 Interoperability considerations: N/A 2254 Published specification: RFC 8152 2255 Applications that use this media type: IoT applications sending 2256 security content over HTTP(S) transports. 2258 Fragment identifier considerations: N/A 2260 Additional information: 2262 * Deprecated alias names for this type: N/A 2264 * Magic number(s): N/A 2266 * File extension(s): cbor 2268 * Macintosh file type code(s): N/A 2270 Person & email address to contact for further information: 2271 iesg@ietf.org 2273 Intended usage: COMMON 2275 Restrictions on usage: N/A 2277 Author: Jim Schaad, ietf@augustcellars.com 2279 Change Controller: IESG 2281 Provisional registration? No 2283 15.9.2. COSE Key Media Type 2285 This section registers the 'application/cose-key' and 'application/ 2286 cose-key-set' media types in the "Media Types" registry. These media 2287 types are used to indicate, respectively, that content is a COSE_Key 2288 or COSE_KeySet object. 2290 The template for registering 'application/cose-key' is: 2292 Type name: application 2294 Subtype name: cose-key 2296 Required parameters: N/A 2298 Optional parameters: N/A 2300 Encoding considerations: binary 2301 Security considerations: See the Security Considerations section 2302 of RFC 8152. 2304 Interoperability considerations: N/A 2306 Published specification: RFC 8152 2308 Applications that use this media type: Distribution of COSE based 2309 keys for IoT applications. 2311 Fragment identifier considerations: N/A 2313 Additional information: 2315 * Deprecated alias names for this type: N/A 2317 * Magic number(s): N/A 2319 * File extension(s): cbor 2321 * Macintosh file type code(s): N/A 2323 Person & email address to contact for further information: 2324 iesg@ietf.org 2326 Intended usage: COMMON 2328 Restrictions on usage: N/A 2330 Author: Jim Schaad, ietf@augustcellars.com 2332 Change Controller: IESG 2334 Provisional registration? No 2336 The template for registering 'application/cose-key-set' is: 2338 Type name: application 2340 Subtype name: cose-key-set 2342 Required parameters: N/A 2344 Optional parameters: N/A 2346 Encoding considerations: binary 2347 Security considerations: See the Security Considerations section 2348 of RFC 8152. 2350 Interoperability considerations: N/A 2352 Published specification: RFC 8152 2354 Applications that use this media type: Distribution of COSE based 2355 keys for IoT applications. 2357 Fragment identifier considerations: N/A 2359 Additional information: 2361 * Deprecated alias names for this type: N/A 2363 * Magic number(s): N/A 2365 * File extension(s): cbor 2367 * Macintosh file type code(s): N/A 2369 Person & email address to contact for further information: 2370 iesg@ietf.org 2372 Intended usage: COMMON 2374 Restrictions on usage: N/A 2376 Author: Jim Schaad, ietf@augustcellars.com 2378 Change Controller: IESG 2380 Provisional registration? No 2382 15.10. CoAP Content-Formats Registry 2384 IANA has added the following entries to the "CoAP Content-Formats" 2385 registry. 2387 +--------------------------------------+----------+-----+-----------+ 2388 | Media Type | Encoding | ID | Reference | 2389 +--------------------------------------+----------+-----+-----------+ 2390 | application/cose; cose-type="cose- | | 98 | [RFC8152] | 2391 | sign" | | | | 2392 | application/cose; cose-type="cose- | | 18 | [RFC8152] | 2393 | sign1" | | | | 2394 | application/cose; cose-type="cose- | | 96 | [RFC8152] | 2395 | encrypt" | | | | 2396 | application/cose; cose-type="cose- | | 16 | [RFC8152] | 2397 | encrypt0" | | | | 2398 | application/cose; cose-type="cose- | | 97 | [RFC8152] | 2399 | mac" | | | | 2400 | application/cose; cose-type="cose- | | 17 | [RFC8152] | 2401 | mac0" | | | | 2402 | application/cose-key | | 101 | [RFC8152] | 2403 | application/cose-key-set | | 102 | [RFC8152] | 2404 +--------------------------------------+----------+-----+-----------+ 2406 Table 5: CoAP Content-Formats for COSE 2408 15.11. Expert Review Instructions 2410 All of the IANA registries established in this document are defined 2411 as expert review. This section gives some general guidelines for 2412 what the experts should be looking for, but they are being designated 2413 as experts for a reason, so they should be given substantial 2414 latitude. 2416 Expert reviewers should take into consideration the following points: 2418 o Point squatting should be discouraged. Reviewers are encouraged 2419 to get sufficient information for registration requests to ensure 2420 that the usage is not going to duplicate one that is already 2421 registered, and that the point is likely to be used in 2422 deployments. The zones tagged as private use are intended for 2423 testing purposes and closed environments; code points in other 2424 ranges should not be assigned for testing. 2426 o Specifications are required for the standards track range of point 2427 assignment. Specifications should exist for specification 2428 required ranges, but early assignment before a specification is 2429 available is considered to be permissible. Specifications are 2430 needed for the first-come, first-serve range if they are expected 2431 to be used outside of closed environments in an interoperable way. 2432 When specifications are not provided, the description provided 2433 needs to have sufficient information to identify what the point is 2434 being used for. 2436 o Experts should take into account the expected usage of fields when 2437 approving point assignment. The fact that there is a range for 2438 standards track documents does not mean that a standards track 2439 document cannot have points assigned outside of that range. The 2440 length of the encoded value should be weighed against how many 2441 code points of that length are left, the size of device it will be 2442 used on, and the number of code points left that encode to that 2443 size. 2445 o When algorithms are registered, vanity registrations should be 2446 discouraged. One way to do this is to require registrations to 2447 provide additional documentation on security analysis of the 2448 algorithm. Another thing that should be considered is requesting 2449 an opinion on the algorithm from the Crypto Forum Research Group 2450 (CFRG). Algorithms that do not meet the security requirements of 2451 the community and the messages structures should not be 2452 registered. 2454 16. Security Considerations 2456 There are a number of security considerations that need to be taken 2457 into account by implementers of this specification. The security 2458 considerations that are specific to an individual algorithm are 2459 placed next to the description of the algorithm. While some 2460 considerations have been highlighted here, additional considerations 2461 may be found in the documents listed in the references. 2463 Implementations need to protect the private key material for any 2464 individuals. There are some cases in this document that need to be 2465 highlighted on this issue. 2467 o Using the same key for two different algorithms can leak 2468 information about the key. It is therefore recommended that keys 2469 be restricted to a single algorithm. 2471 o Use of 'direct' as a recipient algorithm combined with a second 2472 recipient algorithm exposes the direct key to the second 2473 recipient. 2475 o Several of the algorithms in this document have limits on the 2476 number of times that a key can be used without leaking information 2477 about the key. 2479 The use of ECDH and direct plus KDF (with no key wrap) will not 2480 directly lead to the private key being leaked; the one way function 2481 of the KDF will prevent that. There is, however, a different issue 2482 that needs to be addressed. Having two recipients requires that the 2483 CEK be shared between two recipients. The second recipient therefore 2484 has a CEK that was derived from material that can be used for the 2485 weak proof of origin. The second recipient could create a message 2486 using the same CEK and send it to the first recipient; the first 2487 recipient would, for either static-static ECDH or direct plus KDF, 2488 make an assumption that the CEK could be used for proof of origin 2489 even though it is from the wrong entity. If the key wrap step is 2490 added, then no proof of origin is implied and this is not an issue. 2492 Although it has been mentioned before, the use of a single key for 2493 multiple algorithms has been demonstrated in some cases to leak 2494 information about a key, provide the opportunity for attackers to 2495 forge integrity tags, or gain information about encrypted content. 2496 Binding a key to a single algorithm prevents these problems. Key 2497 creators and key consumers are strongly encouraged not only to create 2498 new keys for each different algorithm, but to include that selection 2499 of algorithm in any distribution of key material and strictly enforce 2500 the matching of algorithms in the key structure to algorithms in the 2501 message structure. In addition to checking that algorithms are 2502 correct, the key form needs to be checked as well. Do not use an 2503 'EC2' key where an 'OKP' key is expected. 2505 Before using a key for transmission, or before acting on information 2506 received, a trust decision on a key needs to be made. Is the data or 2507 action something that the entity associated with the key has a right 2508 to see or a right to request? A number of factors are associated 2509 with this trust decision. Some of the ones that are highlighted here 2510 are: 2512 o What are the permissions associated with the key owner? 2514 o Is the cryptographic algorithm acceptable in the current context? 2516 o Have the restrictions associated with the key, such as algorithm 2517 or freshness, been checked and are they correct? 2519 o Is the request something that is reasonable, given the current 2520 state of the application? 2522 o Have any security considerations that are part of the message been 2523 enforced (as specified by the application or 'crit' parameter)? 2525 There are a large number of algorithms presented in this document 2526 that use nonce values. For all of the nonces defined in this 2527 document, there is some type of restriction on the nonce being a 2528 unique value either for a key or for some other conditions. In all 2529 of these cases, there is no known requirement on the nonce being both 2530 unique and unpredictable; under these circumstances, it's reasonable 2531 to use a counter for creation of the nonce. In cases where one wants 2532 the pattern of the nonce to be unpredictable as well as unique, one 2533 can use a key created for that purpose and encrypt the counter to 2534 produce the nonce value. 2536 One area that has been starting to get exposure is doing traffic 2537 analysis of encrypted messages based on the length of the message. 2538 This specification does not provide for a uniform method of providing 2539 padding as part of the message structure. An observer can 2540 distinguish between two different strings (for example, 'YES' and 2541 'NO') based on the length for all of the content encryption 2542 algorithms that are defined in this document. This means that it is 2543 up to the applications to document how content padding is to be done 2544 in order to prevent or discourage such analysis. (For example, the 2545 strings could be defined as 'YES' and 'NO '.) 2547 17. References 2549 17.1. Normative References 2551 [AES-GCM] National Institute of Standards and Technology, 2552 "Recommendation for Block Cipher Modes of Operation: 2553 Galois/Counter Mode (GCM) and GMAC", NIST Special 2554 Publication 800-38D, DOI 10.6028/NIST.SP.800-38D, November 2555 2007, . 2558 [COAP.Formats] 2559 IANA, "Constrained RESTful Environments (CoRE) 2560 Parameters", 2561 . 2563 [DSS] National Institute of Standards and Technology, "Digital 2564 Signature Standard (DSS)", FIPS PUB 186-4, 2565 DOI 10.6028/NIST.FIPS.186-4, July 2013, 2566 . 2569 [I-D.schaad-cose-rfc8152bis-algs] 2570 Schaad, J., "COSE ALGS", November 2019, 2571 . 2573 [MAC] National Institute of Standards and Technology, "Computer 2574 Data Authentication", FIPS PUB 113, May 1985, 2575 . 2578 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 2579 Hashing for Message Authentication", RFC 2104, 2580 DOI 10.17487/RFC2104, February 1997, 2581 . 2583 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2584 Requirement Levels", BCP 14, RFC 2119, 2585 DOI 10.17487/RFC2119, March 1997, 2586 . 2588 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 2589 (AES) Key Wrap Algorithm", RFC 3394, DOI 10.17487/RFC3394, 2590 September 2002, . 2592 [RFC3610] Whiting, D., Housley, R., and N. Ferguson, "Counter with 2593 CBC-MAC (CCM)", RFC 3610, DOI 10.17487/RFC3610, September 2594 2003, . 2596 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 2597 Key Derivation Function (HKDF)", RFC 5869, 2598 DOI 10.17487/RFC5869, May 2010, 2599 . 2601 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 2602 Curve Cryptography Algorithms", RFC 6090, 2603 DOI 10.17487/RFC6090, February 2011, 2604 . 2606 [RFC6979] Pornin, T., "Deterministic Usage of the Digital Signature 2607 Algorithm (DSA) and Elliptic Curve Digital Signature 2608 Algorithm (ECDSA)", RFC 6979, DOI 10.17487/RFC6979, August 2609 2013, . 2611 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 2612 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 2613 October 2013, . 2615 [RFC7539] Nir, Y. and A. Langley, "ChaCha20 and Poly1305 for IETF 2616 Protocols", RFC 7539, DOI 10.17487/RFC7539, May 2015, 2617 . 2619 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 2620 for Security", RFC 7748, DOI 10.17487/RFC7748, January 2621 2016, . 2623 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 2624 Signature Algorithm (EdDSA)", RFC 8032, 2625 DOI 10.17487/RFC8032, January 2017, 2626 . 2628 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2629 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2630 May 2017, . 2632 [SEC1] Certicom Research, "SEC 1: Elliptic Curve Cryptography", 2633 Standards for Efficient Cryptography, Version 2.0, May 2634 2009, . 2636 17.2. Informative References 2638 [CDDL] Vigano, C. and H. Birkholz, "CBOR data definition language 2639 (CDDL): a notational convention to express CBOR data 2640 structures", Work in Progress, draft-greevenbosch-appsawg- 2641 cbor-cddl-09, March 2017. 2643 [OSCOAP] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 2644 "Object Security of CoAP (OSCOAP)", Work in Progress, 2645 draft-ietf-core-object-security-03, May 2017. 2647 [PVSig] Brown, D. and D. Johnson, "Formal Security Proofs for a 2648 Signature Scheme with Partial Message Recovery", 2649 DOI 10.1007/3-540-45353-9_11, LNCS Volume 2020, June 2000. 2651 [RFC2633] Ramsdell, B., Ed., "S/MIME Version 3 Message 2652 Specification", RFC 2633, DOI 10.17487/RFC2633, June 1999, 2653 . 2655 [RFC4231] Nystrom, M., "Identifiers and Test Vectors for HMAC-SHA- 2656 224, HMAC-SHA-256, HMAC-SHA-384, and HMAC-SHA-512", 2657 RFC 4231, DOI 10.17487/RFC4231, December 2005, 2658 . 2660 [RFC4262] Santesson, S., "X.509 Certificate Extension for Secure/ 2661 Multipurpose Internet Mail Extensions (S/MIME) 2662 Capabilities", RFC 4262, DOI 10.17487/RFC4262, December 2663 2005, . 2665 [RFC4493] Song, JH., Poovendran, R., Lee, J., and T. Iwata, "The 2666 AES-CMAC Algorithm", RFC 4493, DOI 10.17487/RFC4493, June 2667 2006, . 2669 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 2670 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 2671 . 2673 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 2674 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 2675 . 2677 [RFC5480] Turner, S., Brown, D., Yiu, K., Housley, R., and T. Polk, 2678 "Elliptic Curve Cryptography Subject Public Key 2679 Information", RFC 5480, DOI 10.17487/RFC5480, March 2009, 2680 . 2682 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 2683 RFC 5652, DOI 10.17487/RFC5652, September 2009, 2684 . 2686 [RFC5751] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet 2687 Mail Extensions (S/MIME) Version 3.2 Message 2688 Specification", RFC 5751, DOI 10.17487/RFC5751, January 2689 2010, . 2691 [RFC5752] Turner, S. and J. Schaad, "Multiple Signatures in 2692 Cryptographic Message Syntax (CMS)", RFC 5752, 2693 DOI 10.17487/RFC5752, January 2010, 2694 . 2696 [RFC5990] Randall, J., Kaliski, B., Brainard, J., and S. Turner, 2697 "Use of the RSA-KEM Key Transport Algorithm in the 2698 Cryptographic Message Syntax (CMS)", RFC 5990, 2699 DOI 10.17487/RFC5990, September 2010, 2700 . 2702 [RFC6151] Turner, S. and L. Chen, "Updated Security Considerations 2703 for the MD5 Message-Digest and the HMAC-MD5 Algorithms", 2704 RFC 6151, DOI 10.17487/RFC6151, March 2011, 2705 . 2707 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 2708 Specifications and Registration Procedures", BCP 13, 2709 RFC 6838, DOI 10.17487/RFC6838, January 2013, 2710 . 2712 [RFC7159] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 2713 Interchange Format", RFC 7159, DOI 10.17487/RFC7159, March 2714 2014, . 2716 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2717 Application Protocol (CoAP)", RFC 7252, 2718 DOI 10.17487/RFC7252, June 2014, 2719 . 2721 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 2722 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 2723 2015, . 2725 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 2726 RFC 7516, DOI 10.17487/RFC7516, May 2015, 2727 . 2729 [RFC7517] Jones, M., "JSON Web Key (JWK)", RFC 7517, 2730 DOI 10.17487/RFC7517, May 2015, 2731 . 2733 [RFC7518] Jones, M., "JSON Web Algorithms (JWA)", RFC 7518, 2734 DOI 10.17487/RFC7518, May 2015, 2735 . 2737 [RFC8017] Moriarty, K., Ed., Kaliski, B., Jonsson, J., and A. Rusch, 2738 "PKCS #1: RSA Cryptography Specifications Version 2.2", 2739 RFC 8017, DOI 10.17487/RFC8017, November 2016, 2740 . 2742 [RFC8018] Moriarty, K., Ed., Kaliski, B., and A. Rusch, "PKCS #5: 2743 Password-Based Cryptography Specification Version 2.1", 2744 RFC 8018, DOI 10.17487/RFC8018, January 2017, 2745 . 2747 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2748 Writing an IANA Considerations Section in RFCs", BCP 26, 2749 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2750 . 2752 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 2753 RFC 8152, DOI 10.17487/RFC8152, July 2017, 2754 . 2756 [SP800-56A] 2757 Barker, E., Chen, L., Roginsky, A., and M. Smid, 2758 "Recommendation for Pair-Wise Key Establishment Schemes 2759 Using Discrete Logarithm Cryptography", NIST Special 2760 Publication 800-56A, Revision 2, 2761 DOI 10.6028/NIST.SP.800-56Ar2, May 2013, 2762 . 2765 [W3C.WebCrypto] 2766 Watson, M., "Web Cryptography API", W3C Recommendation, 2767 January 2017, . 2769 Appendix A. Guidelines for External Data Authentication of Algorithms 2771 A portion of the working group has expressed a strong desire to relax 2772 the rule that the algorithm identifier be required to appear in each 2773 level of a COSE object. There are two basic reasons that have been 2774 advanced to support this position. First, the resulting message will 2775 be smaller if the algorithm identifier is omitted from the most 2776 common messages in a CoAP environment. Second, there is a potential 2777 bug that will arise if full checking is not done correctly between 2778 the different places that an algorithm identifier could be placed 2779 (the message itself, an application statement, the key structure that 2780 the sender possesses, and the key structure the recipient possesses). 2782 This appendix lays out how such a change can be made and the details 2783 that an application needs to specify in order to use this option. 2784 Two different sets of details are specified: those needed to omit an 2785 algorithm identifier and those needed to use a variant on the counter 2786 signature attribute that contains no attributes about itself. 2788 A.1. Algorithm Identification 2790 In this section, three sets of recommendations are laid out. The 2791 first set of recommendations apply to having an implicit algorithm 2792 identified for a single layer of a COSE object. The second set of 2793 recommendations apply to having multiple implicit algorithms 2794 identified for multiple layers of a COSE object. The third set of 2795 recommendations apply to having implicit algorithms for multiple COSE 2796 object constructs. 2798 The key words from RFC 2119 are deliberately not used here. This 2799 specification can provide recommendations, but it cannot enforce 2800 them. 2802 This set of recommendations applies to the case where an application 2803 is distributing a fixed algorithm along with the key information for 2804 use in a single COSE object. This normally applies to the smallest 2805 of the COSE objects, specifically COSE_Sign1, COSE_Mac0, and 2806 COSE_Encrypt0, but could apply to the other structures as well. 2808 The following items should be taken into account: 2810 o Applications need to list the set of COSE structures that implicit 2811 algorithms are to be used in. Applications need to require that 2812 the receipt of an explicit algorithm identifier in one of these 2813 structures will lead to the message being rejected. This 2814 requirement is stated so that there will never be a case where 2815 there is any ambiguity about the question of which algorithm 2816 should be used, the implicit or the explicit one. This applies 2817 even if the transported algorithm identifier is a protected 2818 attribute. This applies even if the transported algorithm is the 2819 same as the implicit algorithm. 2821 o Applications need to define the set of information that is to be 2822 considered to be part of a context when omitting algorithm 2823 identifiers. At a minimum, this would be the key identifier (if 2824 needed), the key, the algorithm, and the COSE structure it is used 2825 with. Applications should restrict the use of a single key to a 2826 single algorithm. As noted for some of the algorithms in this 2827 document, the use of the same key in different related algorithms 2828 can lead to leakage of information about the key, leakage about 2829 the data or the ability to perform forgeries. 2831 o In many cases, applications that make the algorithm identifier 2832 implicit will also want to make the context identifier implicit 2833 for the same reason. That is, omitting the context identifier 2834 will decrease the message size (potentially significantly 2835 depending on the length of the identifier). Applications that do 2836 this will need to describe the circumstances where the context 2837 identifier is to be omitted and how the context identifier is to 2838 be inferred in these cases. (An exhaustive search over all of the 2839 keys would normally not be considered to be acceptable.) An 2840 example of how this can be done is to tie the context to a 2841 transaction identifier. Both would be sent on the original 2842 message, but only the transaction identifier would need to be sent 2843 after that point as the context is tied into the transaction 2844 identifier. Another way would be to associate a context with a 2845 network address. All messages coming from a single network 2846 address can be assumed to be associated with a specific context. 2847 (In this case, the address would normally be distributed as part 2848 of the context.) 2850 o Applications cannot rely on key identifiers being unique unless 2851 they take significant efforts to ensure that they are computed in 2852 such a way as to create this guarantee. Even when an application 2853 does this, the uniqueness might be violated if the application is 2854 run in different contexts (i.e., with a different context 2855 provider) or if the system combines the security contexts from 2856 different applications together into a single store. 2858 o Applications should continue the practice of protecting the 2859 algorithm identifier. Since this is not done by placing it in the 2860 protected attributes field, applications should define an 2861 application-specific external data structure that includes this 2862 value. This external data field can be used as such for content 2863 encryption, MAC, and signature algorithms. It can be used in the 2864 SuppPrivInfo field for those algorithms that use a KDF to derive a 2865 key value. Applications may also want to protect other 2866 information that is part of the context structure as well. It 2867 should be noted that those fields, such as the key or a Base IV, 2868 are protected by virtue of being used in the cryptographic 2869 computation and do not need to be included in the external data 2870 field. 2872 The second case is having multiple implicit algorithm identifiers 2873 specified for a multiple layer COSE object. An example of how this 2874 would work is the encryption context that an application specifies, 2875 which contains a content encryption algorithm, a key wrap algorithm, 2876 a key identifier, and a shared secret. The sender omits sending the 2877 algorithm identifier for both the content layer and the recipient 2878 layer leaving only the key identifier. The receiver then uses the 2879 key identifier to get the implicit algorithm identifiers. 2881 The following additional items need to be taken into consideration: 2883 o Applications that want to support this will need to define a 2884 structure that allows for, and clearly identifies, both the COSE 2885 structure to be used with a given key and the structure and 2886 algorithm to be used for the secondary layer. The key for the 2887 secondary layer is computed as normal from the recipient layer. 2889 The third case is having multiple implicit algorithm identifiers, but 2890 targeted at potentially unrelated layers or different COSE objects. 2891 There are a number of different scenarios where this might be 2892 applicable. Some of these scenarios are: 2894 o Two contexts are distributed as a pair. Each of the contexts is 2895 for use with a COSE_Encrypt message. Each context will consist of 2896 distinct secret keys and IVs and potentially even different 2897 algorithms. One context is for sending messages from party A to 2898 party B, and the second context is for sending messages from party 2899 B to party A. This means that there is no chance for a reflection 2900 attack to occur as each party uses different secret keys to send 2901 its messages; a message that is reflected back to it would fail to 2902 decrypt. 2904 o Two contexts are distributed as a pair. The first context is used 2905 for encryption of the message, and the second context is used to 2906 place a counter signature on the message. The intention is that 2907 the second context can be distributed to other entities 2908 independently of the first context. This allows these entities to 2909 validate that the message came from an individual without being 2910 able to decrypt the message and see the content. 2912 o Two contexts are distributed as a pair. The first context 2913 contains a key for dealing with MACed messages, and the second 2914 context contains a key for dealing with encrypted messages. This 2915 allows for a unified distribution of keys to participants for 2916 different types of messages that have different keys, but where 2917 the keys may be used in a coordinated manner. 2919 For these cases, the following additional items need to be 2920 considered: 2922 o Applications need to ensure that the multiple contexts stay 2923 associated. If one of the contexts is invalidated for any reason, 2924 all of the contexts associated with it should also be invalidated. 2926 A.2. Counter Signature without Headers 2928 There is a group of people who want to have a counter signature 2929 parameter that is directly tied to the value being signed, and thus 2930 the authenticated and unauthenticated buckets can be removed from the 2931 message being sent. The focus on this is an even smaller size, as 2932 all of the information on the process of creating the counter 2933 signature is implicit rather than being explicitly carried in the 2934 message. This includes not only the algorithm identifier as 2935 presented above, but also items such as the key identification, which 2936 is always external to the signature structure. This means that the 2937 entities that are doing the validation of the counter signature are 2938 required to infer which key is to be used from context rather than 2939 being explicit. One way of doing this would be to presume that all 2940 data coming from a specific port (or to a specific URL) is to be 2941 validated by a specific key. (Note that this does not require that 2942 the key identifier be part of the value signed as it does not serve a 2943 cryptographic purpose. If the key validates the counter signature, 2944 then it should be presumed that the entity associated with that key 2945 produced the signature.) 2947 When computing the signature for the bare counter signature header, 2948 the same Sig_structure defined in Section 4.4 is used. The 2949 sign_protected field is omitted, as there is no protected header 2950 field in this counter signature header. The value of 2951 "CounterSignature0" is placed in the context field of the 2952 Sig_stucture. 2954 +-------------------+-------+-------+-------+-----------------------+ 2955 | Name | Label | Value | Value | Description | 2956 | | | Type | | | 2957 +-------------------+-------+-------+-------+-----------------------+ 2958 | CounterSignature0 | 9 | bstr | | Counter signature | 2959 | | | | | with implied signer | 2960 | | | | | and headers | 2961 +-------------------+-------+-------+-------+-----------------------+ 2963 Table 6: Header Parameter for CounterSignature0 2965 Appendix B. Two Layers of Recipient Information 2967 All of the currently defined recipient algorithm classes only use two 2968 layers of the COSE_Encrypt structure. The first layer is the message 2969 content, and the second layer is the content key encryption. 2970 However, if one uses a recipient algorithm such as the RSA Key 2971 Encapsulation Mechanism (RSA-KEM) (see Appendix A of RSA-KEM 2972 [RFC5990]), then it makes sense to have three layers of the 2973 COSE_Encrypt structure. 2975 These layers would be: 2977 o Layer 0: The content encryption layer. This layer contains the 2978 payload of the message. 2980 o Layer 1: The encryption of the CEK by a KEK. 2982 o Layer 2: The encryption of a long random secret using an RSA key 2983 and a key derivation function to convert that secret into the KEK. 2985 This is an example of what a triple layer message would look like. 2986 The message has the following layers: 2988 o Layer 0: Has a content encrypted with AES-GCM using a 128-bit key. 2990 o Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key. 2992 o Layer 2: Uses ECDH Ephemeral-Static direct to generate the layer 1 2993 key. 2995 In effect, this example is a decomposed version of using the 2996 ECDH-ES+A128KW algorithm. 2998 Size of binary file is 183 bytes 2999 96( 3000 [ 3001 / protected / h'a10101' / { 3002 \ alg \ 1:1 \ AES-GCM 128 \ 3003 } / , 3004 / unprotected / { 3005 / iv / 5:h'02d1f7e6f26c43d4868d87ce' 3006 }, 3007 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0 3008 811139868826e89218a75715b', 3009 / recipients / [ 3010 [ 3011 / protected / h'', 3012 / unprotected / { 3013 / alg / 1:-3 / A128KW / 3014 }, 3015 / ciphertext / h'dbd43c4e9d719c27c6275c67d628d493f090593db82 3016 18f11', 3017 / recipients / [ 3018 [ 3019 / protected / h'a1013818' / { 3020 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3021 } / , 3022 / unprotected / { 3023 / ephemeral / -1:{ 3024 / kty / 1:2, 3025 / crv / -1:1, 3026 / x / -2:h'b2add44368ea6d641f9ca9af308b4079aeb519f11 3027 e9b8a55a600b21233e86e68', 3028 / y / -3:false 3029 }, 3030 / kid / 4:'meriadoc.brandybuck@buckland.example' 3031 }, 3032 / ciphertext / h'' 3033 ] 3034 ] 3035 ] 3036 ] 3037 ] 3038 ) 3040 Appendix C. Examples 3042 This appendix includes a set of examples that show the different 3043 features and message types that have been defined in this document. 3044 To make the examples easier to read, they are presented using the 3045 extended CBOR diagnostic notation (defined in [CDDL]) rather than as 3046 a binary dump. 3048 A GitHub project has been created at that contains not only the examples presented in this 3050 document, but a more complete set of testing examples as well. Each 3051 example is found in a JSON file that contains the inputs used to 3052 create the example, some of the intermediate values that can be used 3053 in debugging the example and the output of the example presented in 3054 both a hex and a CBOR diagnostic notation format. Some of the 3055 examples at the site are designed failure testing cases; these are 3056 clearly marked as such in the JSON file. If errors in the examples 3057 in this document are found, the examples on GitHub will be updated, 3058 and a note to that effect will be placed in the JSON file. 3060 As noted, the examples are presented using the CBOR's diagnostic 3061 notation. A Ruby-based tool exists that can convert between the 3062 diagnostic notation and binary. This tool can be installed with the 3063 command line: 3065 gem install cbor-diag 3067 The diagnostic notation can be converted into binary files using the 3068 following command line: 3070 diag2cbor.rb < inputfile > outputfile 3072 The examples can be extracted from the XML version of this document 3073 via an XPath expression as all of the artwork is tagged with the 3074 attribute type='CBORdiag'. (Depending on the XPath evaluator one is 3075 using, it may be necessary to deal with > as an entity.) 3077 //artwork[@type='CDDL']/text() 3079 C.1. Examples of Signed Messages 3081 C.1.1. Single Signature 3083 This example uses the following: 3085 o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3087 Size of binary file is 103 bytes 3088 98( 3089 [ 3090 / protected / h'', 3091 / unprotected / {}, 3092 / payload / 'This is the content.', 3093 / signatures / [ 3094 [ 3095 / protected / h'a10126' / { 3096 \ alg \ 1:-7 \ ECDSA 256 \ 3097 } / , 3098 / unprotected / { 3099 / kid / 4:'11' 3100 }, 3101 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 3102 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 3103 98f53afd2fa0f30a' 3104 ] 3105 ] 3106 ] 3107 ) 3109 C.1.2. Multiple Signers 3111 This example uses the following: 3113 o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3115 o Signature Algorithm: ECDSA w/ SHA-512, Curve P-521 3117 Size of binary file is 277 bytes 3118 98( 3119 [ 3120 / protected / h'', 3121 / unprotected / {}, 3122 / payload / 'This is the content.', 3123 / signatures / [ 3124 [ 3125 / protected / h'a10126' / { 3126 \ alg \ 1:-7 \ ECDSA 256 \ 3127 } / , 3128 / unprotected / { 3129 / kid / 4:'11' 3130 }, 3131 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 3132 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 3133 98f53afd2fa0f30a' 3134 ], 3135 [ 3136 / protected / h'a1013823' / { 3137 \ alg \ 1:-36 3138 } / , 3139 / unprotected / { 3140 / kid / 4:'bilbo.baggins@hobbiton.example' 3141 }, 3142 / signature / h'00a2d28a7c2bdb1587877420f65adf7d0b9a06635dd1 3143 de64bb62974c863f0b160dd2163734034e6ac003b01e8705524c5c4ca479a952f024 3144 7ee8cb0b4fb7397ba08d009e0c8bf482270cc5771aa143966e5a469a09f613488030 3145 c5b07ec6d722e3835adb5b2d8c44e95ffb13877dd2582866883535de3bb03d01753f 3146 83ab87bb4f7a0297' 3147 ] 3148 ] 3149 ] 3150 ) 3152 C.1.3. Counter Signature 3154 This example uses the following: 3156 o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3158 o The same parameters are used for both the signature and the 3159 counter signature. 3161 Size of binary file is 180 bytes 3162 98( 3163 [ 3164 / protected / h'', 3165 / unprotected / { 3166 / countersign / 7:[ 3167 / protected / h'a10126' / { 3168 \ alg \ 1:-7 \ ECDSA 256 \ 3169 } / , 3170 / unprotected / { 3171 / kid / 4:'11' 3172 }, 3173 / signature / h'5ac05e289d5d0e1b0a7f048a5d2b643813ded50bc9e4 3174 9220f4f7278f85f19d4a77d655c9d3b51e805a74b099e1e085aacd97fc29d72f887e 3175 8802bb6650cceb2c' 3176 ] 3177 }, 3178 / payload / 'This is the content.', 3179 / signatures / [ 3180 [ 3181 / protected / h'a10126' / { 3182 \ alg \ 1:-7 \ ECDSA 256 \ 3183 } / , 3184 / unprotected / { 3185 / kid / 4:'11' 3186 }, 3187 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 3188 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 3189 98f53afd2fa0f30a' 3190 ] 3191 ] 3192 ] 3193 ) 3195 C.1.4. Signature with Criticality 3197 This example uses the following: 3199 o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3201 o There is a criticality marker on the "reserved" header parameter 3203 Size of binary file is 125 bytes 3204 98( 3205 [ 3206 / protected / h'a2687265736572766564f40281687265736572766564' / 3207 { 3208 "reserved":false, 3209 \ crit \ 2:[ 3210 "reserved" 3211 ] 3212 } / , 3213 / unprotected / {}, 3214 / payload / 'This is the content.', 3215 / signatures / [ 3216 [ 3217 / protected / h'a10126' / { 3218 \ alg \ 1:-7 \ ECDSA 256 \ 3219 } / , 3220 / unprotected / { 3221 / kid / 4:'11' 3222 }, 3223 / signature / h'3fc54702aa56e1b2cb20284294c9106a63f91bac658d 3224 69351210a031d8fc7c5ff3e4be39445b1a3e83e1510d1aca2f2e8a7c081c7645042b 3225 18aba9d1fad1bd9c' 3226 ] 3227 ] 3228 ] 3229 ) 3231 C.2. Single Signer Examples 3233 C.2.1. Single ECDSA Signature 3235 This example uses the following: 3237 o Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3239 Size of binary file is 98 bytes 3240 18( 3241 [ 3242 / protected / h'a10126' / { 3243 \ alg \ 1:-7 \ ECDSA 256 \ 3244 } / , 3245 / unprotected / { 3246 / kid / 4:'11' 3247 }, 3248 / payload / 'This is the content.', 3249 / signature / h'8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4 3250 d25a91aef0b0117e2af9a291aa32e14ab834dc56ed2a223444547e01f11d3b0916e5 3251 a4c345cacb36' 3252 ] 3253 ) 3255 C.3. Examples of Enveloped Messages 3257 C.3.1. Direct ECDH 3259 This example uses the following: 3261 o CEK: AES-GCM w/ 128-bit key 3263 o Recipient class: ECDH Ephemeral-Static, Curve P-256 3265 Size of binary file is 151 bytes 3266 96( 3267 [ 3268 / protected / h'a10101' / { 3269 \ alg \ 1:1 \ AES-GCM 128 \ 3270 } / , 3271 / unprotected / { 3272 / iv / 5:h'c9cf4df2fe6c632bf7886413' 3273 }, 3274 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 3275 c52a357da7a644b8070a151b0', 3276 / recipients / [ 3277 [ 3278 / protected / h'a1013818' / { 3279 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3280 } / , 3281 / unprotected / { 3282 / ephemeral / -1:{ 3283 / kty / 1:2, 3284 / crv / -1:1, 3285 / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbf 3286 bf054e1c7b4d91d6280', 3287 / y / -3:true 3288 }, 3289 / kid / 4:'meriadoc.brandybuck@buckland.example' 3290 }, 3291 / ciphertext / h'' 3292 ] 3293 ] 3294 ] 3295 ) 3297 C.3.2. Direct Plus Key Derivation 3299 This example uses the following: 3301 o CEK: AES-CCM w/ 128-bit key, truncate the tag to 64 bits 3303 o Recipient class: Use HKDF on a shared secret with the following 3304 implicit fields as part of the context. 3306 * salt: "aabbccddeeffgghh" 3308 * PartyU identity: "lighting-client" 3310 * PartyV identity: "lighting-server" 3312 * Supplementary Public Other: "Encryption Example 02" 3314 Size of binary file is 91 bytes 3316 96( 3317 [ 3318 / protected / h'a1010a' / { 3319 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3320 } / , 3321 / unprotected / { 3322 / iv / 5:h'89f52f65a1c580933b5261a76c' 3323 }, 3324 / ciphertext / h'753548a19b1307084ca7b2056924ed95f2e3b17006dfe93 3325 1b687b847', 3326 / recipients / [ 3327 [ 3328 / protected / h'a10129' / { 3329 \ alg \ 1:-10 3330 } / , 3331 / unprotected / { 3332 / salt / -20:'aabbccddeeffgghh', 3333 / kid / 4:'our-secret' 3334 }, 3335 / ciphertext / h'' 3336 ] 3337 ] 3338 ] 3339 ) 3341 C.3.3. Counter Signature on Encrypted Content 3343 This example uses the following: 3345 o CEK: AES-GCM w/ 128-bit key 3347 o Recipient class: ECDH Ephemeral-Static, Curve P-256 3349 Size of binary file is 326 bytes 3350 96( 3351 [ 3352 / protected / h'a10101' / { 3353 \ alg \ 1:1 \ AES-GCM 128 \ 3354 } / , 3355 / unprotected / { 3356 / iv / 5:h'c9cf4df2fe6c632bf7886413', 3357 / countersign / 7:[ 3358 / protected / h'a1013823' / { 3359 \ alg \ 1:-36 3360 } / , 3361 / unprotected / { 3362 / kid / 4:'bilbo.baggins@hobbiton.example' 3363 }, 3364 / signature / h'00929663c8789bb28177ae28467e66377da12302d7f9 3365 594d2999afa5dfa531294f8896f2b6cdf1740014f4c7f1a358e3a6cf57f4ed6fb02f 3366 cf8f7aa989f5dfd07f0700a3a7d8f3c604ba70fa9411bd10c2591b483e1d2c31de00 3367 3183e434d8fba18f17a4c7e3dfa003ac1cf3d30d44d2533c4989d3ac38c38b71481c 3368 c3430c9d65e7ddff' 3369 ] 3370 }, 3371 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 3372 c52a357da7a644b8070a151b0', 3373 / recipients / [ 3374 [ 3375 / protected / h'a1013818' / { 3376 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3377 } / , 3378 / unprotected / { 3379 / ephemeral / -1:{ 3380 / kty / 1:2, 3381 / crv / -1:1, 3382 / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbf 3383 bf054e1c7b4d91d6280', 3384 / y / -3:true 3385 }, 3386 / kid / 4:'meriadoc.brandybuck@buckland.example' 3387 }, 3388 / ciphertext / h'' 3389 ] 3390 ] 3391 ] 3392 ) 3394 C.3.4. Encrypted Content with External Data 3396 This example uses the following: 3398 o CEK: AES-GCM w/ 128-bit key 3400 o Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap 3402 o Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077' 3404 Size of binary file is 173 bytes 3406 96( 3407 [ 3408 / protected / h'a10101' / { 3409 \ alg \ 1:1 \ AES-GCM 128 \ 3410 } / , 3411 / unprotected / { 3412 / iv / 5:h'02d1f7e6f26c43d4868d87ce' 3413 }, 3414 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e28529d8f5335 3415 e5f0165eee976b4a5f6c6f09d', 3416 / recipients / [ 3417 [ 3418 / protected / h'a101381f' / { 3419 \ alg \ 1:-32 \ ECHD-SS+A128KW \ 3420 } / , 3421 / unprotected / { 3422 / static kid / -3:'peregrin.took@tuckborough.example', 3423 / kid / 4:'meriadoc.brandybuck@buckland.example', 3424 / U nonce / -22:h'0101' 3425 }, 3426 / ciphertext / h'41e0d76f579dbd0d936a662d54d8582037de2e366fd 3427 e1c62' 3428 ] 3429 ] 3430 ] 3431 ) 3433 C.4. Examples of Encrypted Messages 3435 C.4.1. Simple Encrypted Message 3437 This example uses the following: 3439 o CEK: AES-CCM w/ 128-bit key and a 64-bit tag 3441 Size of binary file is 52 bytes 3442 16( 3443 [ 3444 / protected / h'a1010a' / { 3445 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3446 } / , 3447 / unprotected / { 3448 / iv / 5:h'89f52f65a1c580933b5261a78c' 3449 }, 3450 / ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce 3451 460ffb569' 3452 ] 3453 ) 3455 C.4.2. Encrypted Message with a Partial IV 3457 This example uses the following: 3459 o CEK: AES-CCM w/ 128-bit key and a 64-bit tag 3461 o Prefix for IV is 89F52F65A1C580933B52 3463 Size of binary file is 41 bytes 3465 16( 3466 [ 3467 / protected / h'a1010a' / { 3468 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3469 } / , 3470 / unprotected / { 3471 / partial iv / 6:h'61a7' 3472 }, 3473 / ciphertext / h'252a8911d465c125b6764739700f0141ed09192de139e05 3474 3bd09abca' 3475 ] 3476 ) 3478 C.5. Examples of MACed Messages 3480 C.5.1. Shared Secret Direct MAC 3482 This example uses the following: 3484 o MAC: AES-CMAC, 256-bit key, truncated to 64 bits 3486 o Recipient class: direct shared secret 3488 Size of binary file is 57 bytes 3489 97( 3490 [ 3491 / protected / h'a1010f' / { 3492 \ alg \ 1:15 \ AES-CBC-MAC-256//64 \ 3493 } / , 3494 / unprotected / {}, 3495 / payload / 'This is the content.', 3496 / tag / h'9e1226ba1f81b848', 3497 / recipients / [ 3498 [ 3499 / protected / h'', 3500 / unprotected / { 3501 / alg / 1:-6 / direct /, 3502 / kid / 4:'our-secret' 3503 }, 3504 / ciphertext / h'' 3505 ] 3506 ] 3507 ] 3508 ) 3510 C.5.2. ECDH Direct MAC 3512 This example uses the following: 3514 o MAC: HMAC w/SHA-256, 256-bit key 3516 o Recipient class: ECDH key agreement, two static keys, HKDF w/ 3517 context structure 3519 Size of binary file is 214 bytes 3520 97( 3521 [ 3522 / protected / h'a10105' / { 3523 \ alg \ 1:5 \ HMAC 256//256 \ 3524 } / , 3525 / unprotected / {}, 3526 / payload / 'This is the content.', 3527 / tag / h'81a03448acd3d305376eaa11fb3fe416a955be2cbe7ec96f012c99 3528 4bc3f16a41', 3529 / recipients / [ 3530 [ 3531 / protected / h'a101381a' / { 3532 \ alg \ 1:-27 \ ECDH-SS + HKDF-256 \ 3533 } / , 3534 / unprotected / { 3535 / static kid / -3:'peregrin.took@tuckborough.example', 3536 / kid / 4:'meriadoc.brandybuck@buckland.example', 3537 / U nonce / -22:h'4d8553e7e74f3c6a3a9dd3ef286a8195cbf8a23d 3538 19558ccfec7d34b824f42d92bd06bd2c7f0271f0214e141fb779ae2856abf585a583 3539 68b017e7f2a9e5ce4db5' 3540 }, 3541 / ciphertext / h'' 3542 ] 3543 ] 3544 ] 3545 ) 3547 C.5.3. Wrapped MAC 3549 This example uses the following: 3551 o MAC: AES-MAC, 128-bit key, truncated to 64 bits 3553 o Recipient class: AES Key Wrap w/ a pre-shared 256-bit key 3555 Size of binary file is 109 bytes 3556 97( 3557 [ 3558 / protected / h'a1010e' / { 3559 \ alg \ 1:14 \ AES-CBC-MAC-128//64 \ 3560 } / , 3561 / unprotected / {}, 3562 / payload / 'This is the content.', 3563 / tag / h'36f5afaf0bab5d43', 3564 / recipients / [ 3565 [ 3566 / protected / h'', 3567 / unprotected / { 3568 / alg / 1:-5 / A256KW /, 3569 / kid / 4:'018c0ae5-4d9b-471b-bfd6-eef314bc7037' 3570 }, 3571 / ciphertext / h'711ab0dc2fc4585dce27effa6781c8093eba906f227 3572 b6eb0' 3573 ] 3574 ] 3575 ] 3576 ) 3578 C.5.4. Multi-Recipient MACed Message 3580 This example uses the following: 3582 o MAC: HMAC w/ SHA-256, 128-bit key 3584 o Recipient class: Uses three different methods 3586 1. ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 128-bit 3587 key 3589 2. AES Key Wrap w/ 256-bit key 3591 Size of binary file is 309 bytes 3592 97( 3593 [ 3594 / protected / h'a10105' / { 3595 \ alg \ 1:5 \ HMAC 256//256 \ 3596 } / , 3597 / unprotected / {}, 3598 / payload / 'This is the content.', 3599 / tag / h'bf48235e809b5c42e995f2b7d5fa13620e7ed834e337f6aa43df16 3600 1e49e9323e', 3601 / recipients / [ 3602 [ 3603 / protected / h'a101381c' / { 3604 \ alg \ 1:-29 \ ECHD-ES+A128KW \ 3605 } / , 3606 / unprotected / { 3607 / ephemeral / -1:{ 3608 / kty / 1:2, 3609 / crv / -1:3, 3610 / x / -2:h'0043b12669acac3fd27898ffba0bcd2e6c366d53bc4db 3611 71f909a759304acfb5e18cdc7ba0b13ff8c7636271a6924b1ac63c02688075b55ef2 3612 d613574e7dc242f79c3', 3613 / y / -3:true 3614 }, 3615 / kid / 4:'bilbo.baggins@hobbiton.example' 3616 }, 3617 / ciphertext / h'339bc4f79984cdc6b3e6ce5f315a4c7d2b0ac466fce 3618 a69e8c07dfbca5bb1f661bc5f8e0df9e3eff5' 3619 ], 3620 [ 3621 / protected / h'', 3622 / unprotected / { 3623 / alg / 1:-5 / A256KW /, 3624 / kid / 4:'018c0ae5-4d9b-471b-bfd6-eef314bc7037' 3625 }, 3626 / ciphertext / h'0b2c7cfce04e98276342d6476a7723c090dfdd15f9a 3627 518e7736549e998370695e6d6a83b4ae507bb' 3628 ] 3629 ] 3630 ] 3631 ) 3633 C.6. Examples of MAC0 Messages 3635 C.6.1. Shared Secret Direct MAC 3637 This example uses the following: 3639 o MAC: AES-CMAC, 256-bit key, truncated to 64 bits 3640 o Recipient class: direct shared secret 3642 Size of binary file is 37 bytes 3644 17( 3645 [ 3646 / protected / h'a1010f' / { 3647 \ alg \ 1:15 \ AES-CBC-MAC-256//64 \ 3648 } / , 3649 / unprotected / {}, 3650 / payload / 'This is the content.', 3651 / tag / h'726043745027214f' 3652 ] 3653 ) 3655 Note that this example uses the same inputs as Appendix C.5.1. 3657 C.7. COSE Keys 3659 C.7.1. Public Keys 3661 This is an example of a COSE Key Set. This example includes the 3662 public keys for all of the previous examples. 3664 In order the keys are: 3666 o An EC key with a kid of "meriadoc.brandybuck@buckland.example" 3668 o An EC key with a kid of "peregrin.took@tuckborough.example" 3670 o An EC key with a kid of "bilbo.baggins@hobbiton.example" 3672 o An EC key with a kid of "11" 3674 Size of binary file is 481 bytes 3676 [ 3677 { 3678 -1:1, 3679 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 3680 8551d', 3681 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 3682 4d19c', 3683 1:2, 3684 2:'meriadoc.brandybuck@buckland.example' 3685 }, 3686 { 3687 -1:1, 3688 -2:h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a 3689 09eff', 3690 -3:h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbf 3691 c117e', 3692 1:2, 3693 2:'11' 3694 }, 3695 { 3696 -1:3, 3697 -2:h'0072992cb3ac08ecf3e5c63dedec0d51a8c1f79ef2f82f94f3c737bf5de 3698 7986671eac625fe8257bbd0394644caaa3aaf8f27a4585fbbcad0f2457620085e5c8 3699 f42ad', 3700 -3:h'01dca6947bce88bc5790485ac97427342bc35f887d86d65a089377e247e 3701 60baa55e4e8501e2ada5724ac51d6909008033ebc10ac999b9d7f5cc2519f3fe1ea1 3702 d9475', 3703 1:2, 3704 2:'bilbo.baggins@hobbiton.example' 3705 }, 3706 { 3707 -1:1, 3708 -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbfbf054e1c7b4d91 3709 d6280', 3710 -3:h'f01400b089867804b8e9fc96c3932161f1934f4223069170d924b7e03bf 3711 822bb', 3712 1:2, 3713 2:'peregrin.took@tuckborough.example' 3714 } 3715 ] 3717 C.7.2. Private Keys 3719 This is an example of a COSE Key Set. This example includes the 3720 private keys for all of the previous examples. 3722 In order the keys are: 3724 o An EC key with a kid of "meriadoc.brandybuck@buckland.example" 3726 o A shared-secret key with a kid of "our-secret" 3728 o An EC key with a kid of "peregrin.took@tuckborough.example" 3730 o A shared-secret key with a kid of "018c0ae5-4d9b-471b- 3731 bfd6-eef314bc7037" 3733 o An EC key with a kid of "bilbo.baggins@hobbiton.example" 3735 o An EC key with a kid of "11" 3737 Size of binary file is 816 bytes 3739 [ 3740 { 3741 1:2, 3742 2:'meriadoc.brandybuck@buckland.example', 3743 -1:1, 3744 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 3745 8551d', 3746 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 3747 4d19c', 3748 -4:h'aff907c99f9ad3aae6c4cdf21122bce2bd68b5283e6907154ad911840fa 3749 208cf' 3750 }, 3751 { 3752 1:2, 3753 2:'11', 3754 -1:1, 3755 -2:h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a 3756 09eff', 3757 -3:h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbf 3758 c117e', 3759 -4:h'57c92077664146e876760c9520d054aa93c3afb04e306705db609030850 3760 7b4d3' 3761 }, 3762 { 3763 1:2, 3764 2:'bilbo.baggins@hobbiton.example', 3765 -1:3, 3766 -2:h'0072992cb3ac08ecf3e5c63dedec0d51a8c1f79ef2f82f94f3c737bf5de 3767 7986671eac625fe8257bbd0394644caaa3aaf8f27a4585fbbcad0f2457620085e5c8 3768 f42ad', 3769 -3:h'01dca6947bce88bc5790485ac97427342bc35f887d86d65a089377e247e 3770 60baa55e4e8501e2ada5724ac51d6909008033ebc10ac999b9d7f5cc2519f3fe1ea1 3771 d9475', 3772 -4:h'00085138ddabf5ca975f5860f91a08e91d6d5f9a76ad4018766a476680b 3773 55cd339e8ab6c72b5facdb2a2a50ac25bd086647dd3e2e6e99e84ca2c3609fdf177f 3774 eb26d' 3775 }, 3776 { 3777 1:4, 3778 2:'our-secret', 3779 -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4 3780 27188' 3781 }, 3782 { 3783 1:2, 3784 -1:1, 3785 2:'peregrin.took@tuckborough.example', 3786 -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbfbf054e1c7b4d91 3787 d6280', 3788 -3:h'f01400b089867804b8e9fc96c3932161f1934f4223069170d924b7e03bf 3789 822bb', 3790 -4:h'02d1f7e6f26c43d4868d87ceb2353161740aacf1f7163647984b522a848 3791 df1c3' 3792 }, 3793 { 3794 1:4, 3795 2:'our-secret2', 3796 -1:h'849b5786457c1491be3a76dcea6c4271' 3797 }, 3798 { 3799 1:4, 3800 2:'018c0ae5-4d9b-471b-bfd6-eef314bc7037', 3801 -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4 3802 27188' 3803 } 3804 ] 3806 Acknowledgments 3808 This document is a product of the COSE working group of the IETF. 3810 The following individuals are to blame for getting me started on this 3811 project in the first place: Richard Barnes, Matt Miller, and Martin 3812 Thomson. 3814 The initial version of the specification was based to some degree on 3815 the outputs of the JOSE and S/MIME working groups. 3817 The following individuals provided input into the final form of the 3818 document: Carsten Bormann, John Bradley, Brain Campbell, Michael B. 3820 Jones, Ilari Liusvaara, Francesca Palombini, Ludwig Seitz, and Goran 3821 Selander. 3823 Author's Address 3825 Jim Schaad 3826 August Cellars 3828 Email: ietf@augustcellars.com