idnits 2.17.1 draft-ietf-cose-rfc8152bis-struct-10.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 : ---------------------------------------------------------------------------- ** The abstract seems to contain references ([I-D.ietf-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 (2 June 2020) is 1422 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) ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) -- Possible downref: Non-RFC (?) normative reference: ref. 'DSS' ** Downref: Normative reference to an Informational RFC: RFC 8032 == Outdated reference: A later version (-12) exists of draft-ietf-cose-rfc8152bis-algs-08 ** Downref: Normative reference to an Informational draft: draft-ietf-cose-rfc8152bis-algs (ref. 'I-D.ietf-cose-rfc8152bis-algs') -- Obsolete informational reference (is this intentional?): RFC 8152 (Obsoleted by RFC 9052, RFC 9053) -- Obsolete informational reference (is this intentional?): RFC 2633 (Obsoleted by RFC 3851) -- Obsolete informational reference (is this intentional?): RFC 5751 (Obsoleted by RFC 8551) == Outdated reference: A later version (-09) exists of draft-ietf-cose-hash-algs-04 == Outdated reference: A later version (-10) exists of draft-ietf-core-groupcomm-bis-00 Summary: 4 errors (**), 0 flaws (~~), 4 warnings (==), 5 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) 2 June 2020 5 Intended status: Standards Track 6 Expires: 4 December 2020 8 CBOR Object Signing and Encryption (COSE): Structures and Process 9 draft-ietf-cose-rfc8152bis-struct-10 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.ietf-cose-rfc8152bis-algs] obsoletes 23 RFC8152. 25 Contributing to this document 27 This note is to be removed before publishing as an RFC. 29 The source for this draft is being maintained in GitHub. Suggested 30 changes should be submitted as pull requests at https://github.com/ 31 cose-wg/cose-rfc8152bis. Instructions are on that page as well. 32 Editorial changes can be managed in GitHub, but any substantial 33 issues need to be discussed on the COSE mailing list. 35 Status of This Memo 37 This Internet-Draft is submitted in full conformance with the 38 provisions of BCP 78 and BCP 79. 40 Internet-Drafts are working documents of the Internet Engineering 41 Task Force (IETF). Note that other groups may also distribute 42 working documents as Internet-Drafts. The list of current Internet- 43 Drafts is at https://datatracker.ietf.org/drafts/current/. 45 Internet-Drafts are draft documents valid for a maximum of six months 46 and may be updated, replaced, or obsoleted by other documents at any 47 time. It is inappropriate to use Internet-Drafts as reference 48 material or to cite them other than as "work in progress." 49 This Internet-Draft will expire on 4 December 2020. 51 Copyright Notice 53 Copyright (c) 2020 IETF Trust and the persons identified as the 54 document authors. All rights reserved. 56 This document is subject to BCP 78 and the IETF Trust's Legal 57 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 58 license-info) in effect on the date of publication of this document. 59 Please review these documents carefully, as they describe your rights 60 and restrictions with respect to this document. Code Components 61 extracted from this document must include Simplified BSD License text 62 as described in Section 4.e of the Trust Legal Provisions and are 63 provided without warranty as described in the Simplified BSD License. 65 Table of Contents 67 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 68 1.1. Requirements Terminology . . . . . . . . . . . . . . . . 6 69 1.2. Changes from RFC8152 . . . . . . . . . . . . . . . . . . 6 70 1.3. Design Changes from JOSE . . . . . . . . . . . . . . . . 6 71 1.4. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 7 72 1.5. CBOR-Related Terminology . . . . . . . . . . . . . . . . 8 73 1.6. Document Terminology . . . . . . . . . . . . . . . . . . 9 74 2. Basic COSE Structure . . . . . . . . . . . . . . . . . . . . 9 75 3. Header Parameters . . . . . . . . . . . . . . . . . . . . . . 13 76 3.1. Common COSE Header Parameters . . . . . . . . . . . . . . 15 77 4. Signing Objects . . . . . . . . . . . . . . . . . . . . . . . 18 78 4.1. Signing with One or More Signers . . . . . . . . . . . . 18 79 4.2. Signing with One Signer . . . . . . . . . . . . . . . . . 20 80 4.3. Externally Supplied Data . . . . . . . . . . . . . . . . 21 81 4.4. Signing and Verification Process . . . . . . . . . . . . 22 82 5. Counter Signatures . . . . . . . . . . . . . . . . . . . . . 24 83 5.1. Full Counter Signatures . . . . . . . . . . . . . . . . . 25 84 5.2. Abbreviated Counter Signatures . . . . . . . . . . . . . 26 85 6. Encryption Objects . . . . . . . . . . . . . . . . . . . . . 26 86 6.1. Enveloped COSE Structure . . . . . . . . . . . . . . . . 26 87 6.1.1. Content Key Distribution Methods . . . . . . . . . . 28 88 6.2. Single Recipient Encrypted . . . . . . . . . . . . . . . 29 89 6.3. How to Encrypt and Decrypt for AEAD Algorithms . . . . . 29 90 6.4. How to Encrypt and Decrypt for AE Algorithms . . . . . . 32 91 7. MAC Objects . . . . . . . . . . . . . . . . . . . . . . . . . 33 92 7.1. MACed Message with Recipients . . . . . . . . . . . . . . 34 93 7.2. MACed Messages with Implicit Key . . . . . . . . . . . . 35 94 7.3. How to Compute and Verify a MAC . . . . . . . . . . . . . 35 95 8. Key Objects . . . . . . . . . . . . . . . . . . . . . . . . . 37 96 8.1. COSE Key Common Parameters . . . . . . . . . . . . . . . 37 98 9. Taxonomy of Algorithms used by COSE . . . . . . . . . . . . . 40 99 9.1. Signature Algorithms . . . . . . . . . . . . . . . . . . 41 100 9.2. Message Authentication Code (MAC) Algorithms . . . . . . 42 101 9.3. Content Encryption Algorithms . . . . . . . . . . . . . . 42 102 9.4. Key Derivation Functions (KDFs) . . . . . . . . . . . . . 43 103 9.5. Content Key Distribution Methods . . . . . . . . . . . . 44 104 9.5.1. Direct Encryption . . . . . . . . . . . . . . . . . . 44 105 9.5.2. Key Wrap . . . . . . . . . . . . . . . . . . . . . . 44 106 9.5.3. Key Transport . . . . . . . . . . . . . . . . . . . . 45 107 9.5.4. Direct Key Agreement . . . . . . . . . . . . . . . . 45 108 9.5.5. Key Agreement with Key Wrap . . . . . . . . . . . . . 46 109 10. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 47 110 11. Application Profiling Considerations . . . . . . . . . . . . 47 111 12. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 49 112 12.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . 49 113 12.2. COSE Header Parameters Registry . . . . . . . . . . . . 49 114 12.3. COSE Header Algorithm Parameters Registry . . . . . . . 49 115 12.4. COSE Key Common Parameters Registry . . . . . . . . . . 49 116 12.5. Media Type Registrations . . . . . . . . . . . . . . . . 50 117 12.5.1. COSE Security Message . . . . . . . . . . . . . . . 50 118 12.5.2. COSE Key Media Type . . . . . . . . . . . . . . . . 51 119 12.6. CoAP Content-Formats Registry . . . . . . . . . . . . . 53 120 13. Security Considerations . . . . . . . . . . . . . . . . . . . 53 121 14. Implementation Status . . . . . . . . . . . . . . . . . . . . 55 122 14.1. Author's Versions . . . . . . . . . . . . . . . . . . . 55 123 14.2. JavaScript Version . . . . . . . . . . . . . . . . . . . 56 124 14.3. Python Version . . . . . . . . . . . . . . . . . . . . . 56 125 14.4. COSE Testing Library . . . . . . . . . . . . . . . . . . 57 126 15. References . . . . . . . . . . . . . . . . . . . . . . . . . 57 127 15.1. Normative References . . . . . . . . . . . . . . . . . . 57 128 15.2. Informative References . . . . . . . . . . . . . . . . . 58 129 Appendix A. Guidelines for External Data Authentication of 130 Algorithms . . . . . . . . . . . . . . . . . . . . . . . 61 131 Appendix B. Two Layers of Recipient Information . . . . . . . . 65 132 Appendix C. Examples . . . . . . . . . . . . . . . . . . . . . . 66 133 C.1. Examples of Signed Messages . . . . . . . . . . . . . . . 67 134 C.1.1. Single Signature . . . . . . . . . . . . . . . . . . 67 135 C.1.2. Multiple Signers . . . . . . . . . . . . . . . . . . 68 136 C.1.3. Counter Signature . . . . . . . . . . . . . . . . . . 69 137 C.1.4. Signature with Criticality . . . . . . . . . . . . . 70 138 C.2. Single Signer Examples . . . . . . . . . . . . . . . . . 71 139 C.2.1. Single ECDSA Signature . . . . . . . . . . . . . . . 71 140 C.3. Examples of Enveloped Messages . . . . . . . . . . . . . 72 141 C.3.1. Direct ECDH . . . . . . . . . . . . . . . . . . . . . 72 142 C.3.2. Direct Plus Key Derivation . . . . . . . . . . . . . 73 143 C.3.3. Counter Signature on Encrypted Content . . . . . . . 74 144 C.3.4. Encrypted Content with External Data . . . . . . . . 75 145 C.4. Examples of Encrypted Messages . . . . . . . . . . . . . 76 146 C.4.1. Simple Encrypted Message . . . . . . . . . . . . . . 76 147 C.4.2. Encrypted Message with a Partial IV . . . . . . . . . 77 148 C.5. Examples of MACed Messages . . . . . . . . . . . . . . . 77 149 C.5.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 77 150 C.5.2. ECDH Direct MAC . . . . . . . . . . . . . . . . . . . 78 151 C.5.3. Wrapped MAC . . . . . . . . . . . . . . . . . . . . . 79 152 C.5.4. Multi-Recipient MACed Message . . . . . . . . . . . . 80 153 C.6. Examples of MAC0 Messages . . . . . . . . . . . . . . . . 81 154 C.6.1. Shared Secret Direct MAC . . . . . . . . . . . . . . 81 155 C.7. COSE Keys . . . . . . . . . . . . . . . . . . . . . . . . 82 156 C.7.1. Public Keys . . . . . . . . . . . . . . . . . . . . . 82 157 C.7.2. Private Keys . . . . . . . . . . . . . . . . . . . . 83 158 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 85 159 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 86 161 1. Introduction 163 There has been an increased focus on small, constrained devices that 164 make up the Internet of Things (IoT). One of the standards that has 165 come out of this process is "Concise Binary Object Representation 166 (CBOR)" [RFC7049]. CBOR extended the data model of the JavaScript 167 Object Notation (JSON) [RFC8259] by allowing for binary data, among 168 other changes. CBOR has been adopted by several of the IETF working 169 groups dealing with the IoT world as their encoding of data 170 structures. CBOR was designed specifically both to be small in terms 171 of messages transported and implementation size and be a schema-free 172 decoder. A need exists to provide message security services for IoT, 173 and using CBOR as the message-encoding format makes sense. 175 The JOSE working group produced a set of documents [RFC7515] 176 [RFC7516] [RFC7517] [RFC7518] that specified how to process 177 encryption, signatures, and Message Authentication Code (MAC) 178 operations and how to encode keys using JSON. This document along 179 with [I-D.ietf-cose-rfc8152bis-algs] defines the CBOR Object Signing 180 and Encryption (COSE) standard, which does the same thing for the 181 CBOR encoding format. While there is a strong attempt to keep the 182 flavor of the original JSON Object Signing and Encryption (JOSE) 183 documents, two considerations are taken into account: 185 * CBOR has capabilities that are not present in JSON and are 186 appropriate to use. One example of this is the fact that CBOR has 187 a method of encoding binary directly without first converting it 188 into a base64-encoded text string. 190 * COSE is not a direct copy of the JOSE specification. In the 191 process of creating COSE, decisions that were made for JOSE were 192 re-examined. In many cases, different results were decided on as 193 the criteria were not always the same. 195 This document contains: 197 * The description of the structure for the CBOR objects which are 198 transmitted over the wire. Two objects are defined for 199 encryption, signing and message authentication. One object is 200 defined for transporting keys and one for transporting groups of 201 keys. 203 * The procedures used to build the inputs to the cryptographic 204 functions required for each of the structures. 206 * A starting set of attributes that apply to the different security 207 objects. 209 This document does not contain the rules and procedures for using 210 specific cryptographic algorithms. Details on specific algorithms 211 can be found in [I-D.ietf-cose-rfc8152bis-algs] and [RFC8230]. 212 Details for additional algorithms are expected to be defined in 213 future documents. 215 COSE was initially designed as part of a solution to provide security 216 to Constrained RESTful Environments (CoRE), and this is done using 217 [RFC8613] and [I-D.ietf-core-groupcomm-bis]. However, COSE is not 218 restricted to just these cases and can be used in any place where one 219 would consider either JOSE or CMS [RFC5652] for the purpose of 220 providing security services. The use of COSE, like JOSE and CMS, is 221 only in store and forward or offline protocols, different solutions 222 would be appropriate for online protocols although one can use COSE 223 in an online protocol after having done some type of online key 224 establishment process. Any application which uses COSE for security 225 services first needs to determine what security services are required 226 and then select the appropriate COSE structures and cryptographic 227 algorithms based on those needs. Section 11 provides additional 228 information on what applications need to specify when using COSE. 230 One feature that is present in CMS that is not present in this 231 standard is a digest structure. This omission is deliberate. It is 232 better for the structure to be defined in each protocol as different 233 protocols will want to include a different set of fields as part of 234 the structure. While an algorithm identifier and the digest value 235 are going to be common to all applications, the two values may not 236 always be adjacent as the algorithm could be defined once with 237 multiple values. Applications may additionally want to define 238 additional data fields as part of the structure. A common structure 239 is going to include a URI or other pointer to where the data that is 240 being hashed is kept, allowing this to be application-specific. 241 [I-D.ietf-cose-hash-algs] contains one such possible structure along 242 with defining a set of digest algorithms. 244 1.1. Requirements Terminology 246 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 247 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 248 "OPTIONAL" in this document are to be interpreted as described in BCP 249 14 [RFC2119] [RFC8174] when, and only when, they appear in all 250 capitals, as shown here. 252 1.2. Changes from RFC8152 254 * Split the original document into this document and 255 [I-D.ietf-cose-rfc8152bis-algs]. 257 * Add some text describing why there is no digest structure defined 258 by COSE. 260 * Rearrange the text around counter signatures and define a CBOR Tag 261 for a standalone counter signature. 263 * Text clarifications and changes in terminology. 265 1.3. Design Changes from JOSE 267 * Define a single top message structure so that encrypted, signed, 268 and MACed messages can easily be identified and still have a 269 consistent view. 271 * Signed messages distinguish between the protected and unprotected 272 header parameters that relate to the content from those that 273 relate to the signature. 275 * MACed messages are separated from signed messages. 277 * MACed messages have the ability to use the same set of recipient 278 algorithms as enveloped messages for obtaining the MAC 279 authentication key. 281 * Use binary encodings, rather than base64url encodings, to encode 282 binary data. 284 * Combine the authentication tag for encryption algorithms with the 285 ciphertext. 287 * The set of cryptographic algorithms has been expanded in some 288 directions and trimmed in others. 290 1.4. CBOR Grammar 292 There was not a standard CBOR grammar available when COSE was 293 originally written. For that reason the CBOR data objects defined 294 here are described in prose. Since that time CBOR Data Definition 295 Language (CDDL) [RFC8610] has been published as an RFC. The CBOR 296 grammar presented in this document is compatible with CDDL. 298 The document was developed by first working on the grammar and then 299 developing the prose to go with it. An artifact of this is that the 300 prose was written using the primitive type strings defined by CBOR 301 Data Definition Language (CDDL) [RFC8610]. In this specification, 302 the following primitive types are used: 304 any -- non-specific value that permits all CBOR values to be 305 placed here. 307 bool -- a boolean value (true: major type 7, value 21; false: 308 major type 7, value 20). 310 bstr -- byte string (major type 2). 312 int -- an unsigned integer or a negative integer. 314 nil -- a null value (major type 7, value 22). 316 nint -- a negative integer (major type 1). 318 tstr -- a UTF-8 text string (major type 3). 320 uint -- an unsigned integer (major type 0). 322 Two syntaxes from CDDL appear in this document as shorthand. These 323 are: 325 FOO / BAR -- indicates that either FOO or BAR can appear here. 327 [+ FOO] -- indicates that the type FOO appears one or more times 328 in an array. 330 * FOO -- indicates that the type FOO appears zero or more times. 332 Two of the constraints defined by CDDL are also used in this 333 document. These are: 335 type1 .cbor type2 -- indicates that the contents of type1, usually 336 bstr, contains a value of type2. 338 type1 .size integer -- indicates that the contents of type1 is 339 integer bytes long 341 As well as the prose description, a version of a CBOR grammar is 342 presented in CDDL. The CDDL grammar is informational; the prose 343 description is normative. 345 The collected CDDL can be extracted from the XML version of this 346 document via the following XPath expression below. (Depending on the 347 XPath evaluator one is using, it may be necessary to deal with > 348 as an entity.) 350 //sourcecode[@type='CDDL']/text() 352 CDDL expects the initial non-terminal symbol to be the first symbol 353 in the file. For this reason, the first fragment of CDDL is 354 presented here. 356 start = COSE_Messages / COSE_Key / COSE_KeySet / Internal_Types 358 ; This is defined to make the tool quieter: 359 Internal_Types = Sig_structure / Enc_structure / MAC_structure 361 The non-terminal Internal_Types is defined for dealing with the 362 automated validation tools used during the writing of this document. 363 It references those non-terminals that are used for security 364 computations but are not emitted for transport. 366 1.5. CBOR-Related Terminology 368 In JSON, maps are called objects and only have one kind of map key: a 369 text string. In COSE, we use text strings, negative integers, and 370 unsigned integers as map keys. The integers are used for compactness 371 of encoding and easy comparison. The inclusion of text strings 372 allows for an additional range of short encoded values to be used as 373 well. Since the word "key" is mainly used in its other meaning, as a 374 cryptographic key, we use the term "label" for this usage as a map 375 key. 377 The presence in a CBOR map of a label that is not a text string or an 378 integer is an error. Applications can either fail processing or 379 process messages by ignoring incorrect labels; however, they MUST NOT 380 create messages with incorrect labels. 382 A CDDL grammar fragment defines the non-terminal 'label', as in the 383 previous paragraph, and 'values', which permits any value to be used. 385 label = int / tstr 386 values = any 388 1.6. Document Terminology 390 In this document, we use the following terminology: 392 Byte is a synonym for octet. 394 Constrained Application Protocol (CoAP) is a specialized web transfer 395 protocol for use in constrained systems. It is defined in [RFC7252]. 397 Authenticated Encryption (AE) [RFC5116] algorithms are those 398 encryption algorithms that provide an authentication check of the 399 contents algorithm with the encryption service. 401 Authenticated Encryption with Associated Data (AEAD) [RFC5116] 402 algorithms provide the same content authentication service as AE 403 algorithms, but they additionally provide for authentication of non- 404 encrypted data as well. 406 Context is used throughout the document to represent information that 407 is not part of the COSE message. Information which is part of the 408 context can come from several different sources including: Protocol 409 interactions, associated key structures and program configuration. 410 The context to use can be implicit, identified using the 'kid 411 context' header parameter defined in [RFC8613], or identified by a 412 protocol-specific identifier. Context should generally be included 413 in the cryptographic configuration; for more details see Section 4.3. 415 The term 'byte string' is used for sequences of bytes, while the term 416 'text string' is used for sequences of characters. 418 2. Basic COSE Structure 420 The COSE object structure is designed so that there can be a large 421 amount of common code when parsing and processing the different types 422 of security messages. All of the message structures are built on the 423 CBOR array type. The first three elements of the array always 424 contain the same information: 426 1. The protected header parameters encoded and wrapped in a bstr. 428 2. The unprotected header parameters as a map. 430 3. The content of the message. The content is either the plaintext 431 or the ciphertext as appropriate. The content may be detached 432 (i.e. transported separately from the COSE structure), but the 433 location is still used. The content is wrapped in a bstr when 434 present and is a nil value when detached. 436 Elements after this point are dependent on the specific message type. 438 COSE messages are built using the concept of layers to separate 439 different types of cryptographic concepts. As an example of how this 440 works, consider the COSE_Encrypt message (Section 6.1). This message 441 type is broken into two layers: the content layer and the recipient 442 layer. In the content layer, the plaintext is encrypted and 443 information about the encrypted message is placed. In the recipient 444 layer, the content encryption key (CEK) is encrypted and information 445 about how it is encrypted for each recipient is placed. A single 446 layer version of the encryption message COSE_Encrypt0 (Section 6.2) 447 is provided for cases where the CEK is pre-shared. 449 Identification of which type of message has been presented is done by 450 the following methods: 452 1. The specific message type is known from the context. This may be 453 defined by a marker in the containing structure or by 454 restrictions specified by the application protocol. 456 2. The message type is identified by a CBOR tag. Messages with a 457 CBOR tag are known in this specification as tagged messages, 458 while those without the CBOR tag are known as untagged messages. 459 This document defines a CBOR tag for each of the message 460 structures. These tags can be found in Table 1. 462 3. When a COSE object is carried in a media type of 'application/ 463 cose', the optional parameter 'cose-type' can be used to identify 464 the embedded object. The parameter is OPTIONAL if the tagged 465 version of the structure is used. The parameter is REQUIRED if 466 the untagged version of the structure is used. The value to use 467 with the parameter for each of the structures can be found in 468 Table 1. 470 4. When a COSE object is carried as a CoAP payload, the CoAP 471 Content-Format Option can be used to identify the message 472 content. The CoAP Content-Format values can be found in Table 2. 473 The CBOR tag for the message structure is not required as each 474 security message is uniquely identified. 476 +------+------------------+-----------------------+-------------+ 477 | CBOR | cose-type | Data Item | Semantics | 478 | Tag | | | | 479 +======+==================+=======================+=============+ 480 | 98 | cose-sign | COSE_Sign | COSE Signed | 481 | | | | Data Object | 482 +------+------------------+-----------------------+-------------+ 483 | 18 | cose-sign1 | COSE_Sign1 | COSE Single | 484 | | | | Signer Data | 485 | | | | Object | 486 +------+------------------+-----------------------+-------------+ 487 | 96 | cose-encrypt | COSE_Encrypt | COSE | 488 | | | | Encrypted | 489 | | | | Data Object | 490 +------+------------------+-----------------------+-------------+ 491 | 16 | cose-encrypt0 | COSE_Encrypt0 | COSE Single | 492 | | | | Recipient | 493 | | | | Encrypted | 494 | | | | Data Object | 495 +------+------------------+-----------------------+-------------+ 496 | 97 | cose-mac | COSE_Mac | COSE MACed | 497 | | | | Data Object | 498 +------+------------------+-----------------------+-------------+ 499 | 17 | cose-mac0 | COSE_Mac0 | COSE Mac w/ | 500 | | | | o | 501 | | | | Recipients | 502 | | | | Object | 503 +------+------------------+-----------------------+-------------+ 504 | TBD0 | cose-countersign | COSE_Countersignature | COSE | 505 | | | | standalone | 506 | | | | counter | 507 | | | | signature | 508 +------+------------------+-----------------------+-------------+ 510 Table 1: COSE Message Identification 512 +---------------------------+----------+-----+------------+ 513 | Media Type | Encoding | ID | Reference | 514 +===========================+==========+=====+============+ 515 | application/cose; cose- | | 98 | [[THIS | 516 | type="cose-sign" | | | DOCUMENT]] | 517 +---------------------------+----------+-----+------------+ 518 | application/cose; cose- | | 18 | [[THIS | 519 | type="cose-sign1" | | | DOCUMENT]] | 520 +---------------------------+----------+-----+------------+ 521 | application/cose; cose- | | 96 | [[THIS | 522 | type="cose-encrypt" | | | DOCUMENT]] | 523 +---------------------------+----------+-----+------------+ 524 | application/cose; cose- | | 16 | [[THIS | 525 | type="cose-encrypt0" | | | DOCUMENT]] | 526 +---------------------------+----------+-----+------------+ 527 | application/cose; cose- | | 97 | [[THIS | 528 | type="cose-mac" | | | DOCUMENT]] | 529 +---------------------------+----------+-----+------------+ 530 | application/cose; cose- | | 17 | [[THIS | 531 | type="cose-mac0" | | | DOCUMENT]] | 532 +---------------------------+----------+-----+------------+ 533 | application/cose-key | | 101 | [[THIS | 534 | | | | DOCUMENT]] | 535 +---------------------------+----------+-----+------------+ 536 | application/cose-key-set | | 102 | [[THIS | 537 | | | | DOCUMENT]] | 538 +---------------------------+----------+-----+------------+ 540 Table 2: CoAP Content-Formats for COSE 542 The following CDDL fragment identifies all of the top messages 543 defined in this document. Separate non-terminals are defined for the 544 tagged and the untagged versions of the messages. 546 COSE_Messages = COSE_Untagged_Message / COSE_Tagged_Message 548 COSE_Untagged_Message = COSE_Sign / COSE_Sign1 / 549 COSE_Encrypt / COSE_Encrypt0 / 550 COSE_Mac / COSE_Mac0 / COSE_Countersignature 552 COSE_Tagged_Message = COSE_Sign_Tagged / COSE_Sign1_Tagged / 553 COSE_Encrypt_Tagged / COSE_Encrypt0_Tagged / 554 COSE_Mac_Tagged / COSE_Mac0_Tagged / COSE_Countersignature_Tagged 556 3. Header Parameters 558 The structure of COSE has been designed to have two buckets of 559 information that are not considered to be part of the payload itself, 560 but are used for holding information about content, algorithms, keys, 561 or evaluation hints for the processing of the layer. These two 562 buckets are available for use in all of the structures except for 563 keys. While these buckets are present, they may not all be usable in 564 all instances. For example, while the protected bucket is defined as 565 part of the recipient structure, some of the algorithms used for 566 recipient structures do not provide for authenticated data. If this 567 is the case, the protected bucket is left empty. 569 Both buckets are implemented as CBOR maps. The map key is a 'label' 570 (Section 1.5). The value portion is dependent on the definition for 571 the label. Both maps use the same set of label/value pairs. The 572 integer and text string values for labels have been divided into 573 several sections including a standard range, a private range, and a 574 range that is dependent on the algorithm selected. The defined 575 labels can be found in the "COSE Header Parameters" IANA registry 576 (Section 12.2). 578 The two buckets are: 580 protected: Contains parameters about the current layer that are 581 cryptographically protected. This bucket MUST be empty if it is 582 not going to be included in a cryptographic computation. This 583 bucket is encoded in the message as a binary object. This value 584 is obtained by CBOR encoding the protected map and wrapping it in 585 a bstr object. Senders SHOULD encode a zero-length map as a zero- 586 length byte string rather than as a zero-length map (encoded as 587 h'a0'). The zero-length binary encoding is preferred because it 588 is both shorter and the version used in the serialization 589 structures for cryptographic computation. After encoding the map, 590 the value is wrapped in the binary object. Recipients MUST accept 591 both a zero-length byte string and a zero-length map encoded in 592 the binary value. 594 Wrapping the encoding with a byte string allows for the protected 595 map to be transported with a greater chance that it will not be 596 altered accidentally in transit. (Badly behaved intermediates 597 could decode and re-encode, but this will result in a failure to 598 verify unless the re-encoded byte string is identical to the 599 decoded byte string.) This avoids the problem of all parties 600 needing to be able to do a common canonical encoding. 602 unprotected: Contains parameters about the current layer that are 603 not cryptographically protected. 605 Only header parameters that deal with the current layer are to be 606 placed at that layer. As an example of this, the header parameter 607 'content type' describes the content of the message being carried in 608 the message. As such, this header parameter is placed only in the 609 content layer and is not placed in the recipient or signature layers. 610 In principle, one should be able to process any given layer without 611 reference to any other layer. With the exception of the COSE_Sign 612 structure, the only data that needs to cross layers is the 613 cryptographic key. 615 The buckets are present in all of the security objects defined in 616 this document. The fields in order are the 'protected' bucket (as a 617 CBOR 'bstr' type) and then the 'unprotected' bucket (as a CBOR 'map' 618 type). The presence of both buckets is required. The header 619 parameters that go into the buckets come from the IANA "COSE Header 620 Parameters" registry (Section 12.2). Some common header parameters 621 are defined in the next section. 623 Labels in each of the maps MUST be unique. When processing messages, 624 if a label appears multiple times, the message MUST be rejected as 625 malformed. Applications SHOULD verify that the same label does not 626 occur in both the protected and unprotected header parameters. If 627 the message is not rejected as malformed, attributes MUST be obtained 628 from the protected bucket before they are obtained from the 629 unprotected bucket. 631 The following CDDL fragment represents the two header parameter 632 buckets. A group "Headers" is defined in CDDL that represents the 633 two buckets in which attributes are placed. This group is used to 634 provide these two fields consistently in all locations. A type is 635 also defined that represents the map of common header parameters. 637 Headers = ( 638 protected : empty_or_serialized_map, 639 unprotected : header_map 640 ) 642 header_map = { 643 Generic_Headers, 644 * label => values 645 } 647 empty_or_serialized_map = bstr .cbor header_map / bstr .size 0 649 3.1. Common COSE Header Parameters 651 This section defines a set of common header parameters. A summary of 652 these header parameters can be found in Table 3. This table should 653 be consulted to determine the value of label and the type of the 654 value. 656 The set of header parameters defined in this section are: 658 alg: This header parameter is used to indicate the algorithm used 659 for the security processing. This header parameter MUST be 660 authenticated where the ability to do so exists. This support is 661 provided by AEAD algorithms or construction (COSE_Sign, 662 COSE_Sign1, COSE_Mac, and COSE_Mac0). This authentication can be 663 done either by placing the header parameter in the protected 664 header parameter bucket or as part of the externally supplied 665 data. The value is taken from the "COSE Algorithms" registry (see 666 [COSE.Algorithms]). 668 crit: This header parameter is used to indicate which protected 669 header parameters an application that is processing a message is 670 required to understand. Header parameters defined in this 671 document do not need to be included as they should be understood 672 by all implementations. When present, this the 'crit' header 673 parameter MUST be placed in the protected header parameter bucket. 674 The array MUST have at least one value in it. 676 Not all header parameter labels need to be included in the 'crit' 677 header parameter. The rules for deciding which header parameters 678 are placed in the array are: 680 * Integer labels in the range of 0 to 7 SHOULD be omitted. 682 * Integer labels in the range -1 to -128 can be omitted as they 683 are algorithm dependent. If an application can correctly 684 process an algorithm, it can be assumed that it will correctly 685 process all of the common header parameters associated with 686 that algorithm. Integer labels in the range -129 to -65536 687 SHOULD be included as these would be less common header 688 parameters that might not be generally supported. 690 * Labels for header parameters required for an application MAY be 691 omitted. Applications should have a statement if the label can 692 be omitted. 694 The header parameters indicated by 'crit' can be processed by 695 either the security library code or an application using a 696 security library; the only requirement is that the header 697 parameter is processed. If the 'crit' value list includes a label 698 for which the header parameter is not in the protected header 699 parameters bucket, this is a fatal error in processing the 700 message. 702 content type: This header parameter is used to indicate the content 703 type of the data in the payload or ciphertext fields. Integers 704 are from the "CoAP Content-Formats" IANA registry table 705 [COAP.Formats]. Text values following the syntax of "/" where and are 707 defined in Section 4.2 of [RFC6838]. Leading and trailing 708 whitespace is also omitted. Textual content values along with 709 parameters and subparameters can be located using the IANA "Media 710 Types" registry. Applications SHOULD provide this header 711 parameter if the content structure is potentially ambiguous. 713 kid: This header parameter identifies one piece of data that can be 714 used as input to find the needed cryptographic key. The value of 715 this header parameter can be matched against the 'kid' member in a 716 COSE_Key structure. Other methods of key distribution can define 717 an equivalent field to be matched. Applications MUST NOT assume 718 that 'kid' values are unique. There may be more than one key with 719 the same 'kid' value, so all of the keys associated with this 720 'kid' may need to be checked. The internal structure of 'kid' 721 values is not defined and cannot be relied on by applications. 722 Key identifier values are hints about which key to use. This is 723 not a security-critical field. For this reason, it can be placed 724 in the unprotected header parameters bucket. 726 IV: This header parameter holds the Initialization Vector (IV) 727 value. For some symmetric encryption algorithms, this may be 728 referred to as a nonce. The IV can be placed in the unprotected 729 bucket as modifying the IV will cause the decryption to yield 730 plaintext that is readily detectable as garbled. 732 Partial IV: This header parameter holds a part of the IV value. 733 When using the COSE_Encrypt0 structure, a portion of the IV can be 734 part of the context associated with the key (Context IV) while a 735 portion can be changed with each message (Partial IV). This field 736 is used to carry a value that causes the IV to be changed for each 737 message. The Partial IV can be placed in the unprotected bucket 738 as modifying the value will cause the decryption to yield 739 plaintext that is readily detectable as garbled. The 740 'Initialization Vector' and 'Partial Initialization Vector' header 741 parameters MUST NOT both be present in the same security layer. 743 The message IV is generated by the following steps: 745 1. Left-pad the Partial IV with zeros to the length of IV. 747 2. XOR the padded Partial IV with the context IV. 749 counter signature: This header parameter holds one or more counter 750 signature values. Counter signatures provide a method of having a 751 second party sign some data. The counter signature header 752 parameter can occur as an unprotected attribute in any of the 753 following structures: COSE_Sign1, COSE_Signature, COSE_Encrypt, 754 COSE_recipient, COSE_Encrypt0, COSE_Mac, and COSE_Mac0. These 755 structures all have the same beginning elements, so that a 756 consistent calculation of the counter signature can be computed. 757 Details on counter signatures are found in Section 5. 759 +---------+-----+----------------+-----------------+----------------+ 760 | Name |Label| Value Type | Value Registry | Description | 761 +=========+=====+================+=================+================+ 762 | alg | 1 | int / tstr | COSE Algorithms | Cryptographic | 763 | | | | registry |algorithm to use| 764 +---------+-----+----------------+-----------------+----------------+ 765 | crit | 2 | [+ label] | COSE Header |Critical header | 766 | | | | Parameters |parameters to be| 767 | | | | registry | understood | 768 +---------+-----+----------------+-----------------+----------------+ 769 | content | 3 | tstr / uint | CoAP Content- |Content type of | 770 | type | | |Formats or Media | the payload | 771 | | | |Types registries | | 772 +---------+-----+----------------+-----------------+----------------+ 773 | kid | 4 | bstr | | Key identifier | 774 +---------+-----+----------------+-----------------+----------------+ 775 | IV | 5 | bstr | | Full | 776 | | | | | Initialization | 777 | | | | | Vector | 778 +---------+-----+----------------+-----------------+----------------+ 779 | Partial | 6 | bstr | | Partial | 780 | IV | | | | Initialization | 781 | | | | | Vector | 782 +---------+-----+----------------+-----------------+----------------+ 783 | counter | 7 |COSE_Signature /| | CBOR-encoded | 784 |signature| | [+ | | signature | 785 | | |COSE_Signature ]| | structure | 786 +---------+-----+----------------+-----------------+----------------+ 788 Table 3: Common Header Parameters 790 The CDDL fragment that represents the set of header parameters 791 defined in this section is given below. Each of the header 792 parameters is tagged as optional because they do not need to be in 793 every map; header parameters required in specific maps are discussed 794 above. 796 Generic_Headers = ( 797 ? 1 => int / tstr, ; algorithm identifier 798 ? 2 => [+label], ; criticality 799 ? 3 => tstr / int, ; content type 800 ? 4 => bstr, ; key identifier 801 ? 5 => bstr, ; IV 802 ? 6 => bstr, ; Partial IV 803 ? 7 => COSE_Signature / [+COSE_Signature] ; Counter signature 804 ) 806 4. Signing Objects 808 COSE supports two different signature structures. COSE_Sign allows 809 for one or more signatures to be applied to the same content. 810 COSE_Sign1 is restricted to a single signer. The structures cannot 811 be converted between each other; as the signature computation 812 includes a parameter identifying which structure is being used, the 813 converted structure will fail signature validation. 815 4.1. Signing with One or More Signers 817 The COSE_Sign structure allows for one or more signatures to be 818 applied to a message payload. Header parameters relating to the 819 content and header parameters relating to the signature are carried 820 along with the signature itself. These header parameters may be 821 authenticated by the signature, or just present. An example of 822 header a parameter about the content is the content type header 823 parameter. Examples of header parameters about the signature would 824 be the algorithm and key used to create the signature and counter 825 signatures. 827 RFC 5652 indicates that: 829 | When more than one signature is present, the successful validation 830 | of one signature associated with a given signer is usually treated 831 | as a successful signature by that signer. However, there are some 832 | application environments where other rules are needed. An 833 | application that employs a rule other than one valid signature for 834 | each signer must specify those rules. Also, where simple matching 835 | of the signer identifier is not sufficient to determine whether 836 | the signatures were generated by the same signer, the application 837 | specification must describe how to determine which signatures were 838 | generated by the same signer. Support for different communities 839 | of recipients is the primary reason that signers choose to include 840 | more than one signature. 842 For example, the COSE_Sign structure might include signatures 843 generated with the Edwards-curve Digital Signature Algorithm (EdDSA) 844 [RFC8032] and with the Elliptic Curve Digital Signature Algorithm 845 (ECDSA) [DSS]. This allows recipients to verify the signature 846 associated with one algorithm or the other. More-detailed 847 information on multiple signature evaluations can be found in 848 [RFC5752]. 850 The signature structure can be encoded as either tagged or untagged 851 depending on the context it will be used in. A tagged COSE_Sign 852 structure is identified by the CBOR tag 98. The CDDL fragment that 853 represents this is: 855 COSE_Sign_Tagged = #6.98(COSE_Sign) 857 A COSE Signed Message is defined in two parts. The CBOR object that 858 carries the body and information about the body is called the 859 COSE_Sign structure. The CBOR object that carries the signature and 860 information about the signature is called the COSE_Signature 861 structure. Examples of COSE Signed Messages can be found in 862 Appendix C.1. 864 The COSE_Sign structure is a CBOR array. The fields of the array in 865 order are: 867 protected: This is as described in Section 3. 869 unprotected: This is as described in Section 3. 871 payload: This field contains the serialized content to be signed. 872 If the payload is not present in the message, the application is 873 required to supply the payload separately. The payload is wrapped 874 in a bstr to ensure that it is transported without changes. If 875 the payload is transported separately ("detached content"), then a 876 nil CBOR object is placed in this location, and it is the 877 responsibility of the application to ensure that it will be 878 transported without changes. 880 Note: When a signature with a message recovery algorithm is used 881 (Section 9.1), the maximum number of bytes that can be recovered 882 is the length of the payload. The size of the payload is reduced 883 by the number of bytes that will be recovered. If all of the 884 bytes of the payload are consumed, then the payload is encoded as 885 a zero-length byte string rather than as being absent. 887 signatures: This field is an array of signatures. Each signature is 888 represented as a COSE_Signature structure. 890 The CDDL fragment that represents the above text for COSE_Sign 891 follows. 893 COSE_Sign = [ 894 Headers, 895 payload : bstr / nil, 896 signatures : [+ COSE_Signature] 897 ] 899 The COSE_Signature structure is a CBOR array. The fields of the 900 array in order are: 902 protected: This is as described in Section 3. 904 unprotected: This is as described in Section 3. 906 signature: This field contains the computed signature value. The 907 type of the field is a bstr. Algorithms MUST specify padding if 908 the signature value is not a multiple of 8 bits. 910 The CDDL fragment that represents the above text for COSE_Signature 911 follows. 913 COSE_Signature = [ 914 Headers, 915 signature : bstr 916 ] 918 4.2. Signing with One Signer 920 The COSE_Sign1 signature structure is used when only one signature is 921 going to be placed on a message. The header parameters dealing with 922 the content and the signature are placed in the same pair of buckets 923 rather than having the separation of COSE_Sign. 925 The structure can be encoded as either tagged or untagged depending 926 on the context it will be used in. A tagged COSE_Sign1 structure is 927 identified by the CBOR tag 18. The CDDL fragment that represents 928 this is: 930 COSE_Sign1_Tagged = #6.18(COSE_Sign1) 931 The CBOR object that carries the body, the signature, and the 932 information about the body and signature is called the COSE_Sign1 933 structure. Examples of COSE_Sign1 messages can be found in 934 Appendix C.2. 936 The COSE_Sign1 structure is a CBOR array. The fields of the array in 937 order are: 939 protected: This is as described in Section 3. 941 unprotected: This is as described in Section 3. 943 payload: This is as described in Section 4.1. 945 signature: This field contains the computed signature value. The 946 type of the field is a bstr. 948 The CDDL fragment that represents the above text for COSE_Sign1 949 follows. 951 COSE_Sign1 = [ 952 Headers, 953 payload : bstr / nil, 954 signature : bstr 955 ] 957 4.3. Externally Supplied Data 959 One of the features offered in the COSE document is the ability for 960 applications to provide additional data to be authenticated, but that 961 is not carried as part of the COSE object. The primary reason for 962 supporting this can be seen by looking at the CoAP message structure 963 [RFC7252], where the facility exists for options to be carried before 964 the payload. Examples of data that can be placed in this location 965 would be the CoAP code or CoAP options. If the data is in the 966 headers of the CoAP message, then it is available for proxies to help 967 in performing its operations. For example, the Accept Option can be 968 used by a proxy to determine if an appropriate value is in the 969 proxy's cache. But the sender can cause a failure at the server if a 970 proxy, or an attacker, changes the set of accept values by including 971 the field in the application-supplied data. 973 This document describes the process for using a byte array of 974 externally supplied authenticated data; the method of constructing 975 the byte array is a function of the application. Applications that 976 use this feature need to define how the externally supplied 977 authenticated data is to be constructed. Such a construction needs 978 to take into account the following issues: 980 * If multiple items are included, applications need to ensure that 981 the same byte string cannot be produced if there are different 982 inputs. This would occur by appending the text strings 'AB' and 983 'CDE' or by appending the text strings 'ABC' and 'DE'. This is 984 usually addressed by making fields a fixed width and/or encoding 985 the length of the field as part of the output. Using options from 986 CoAP [RFC7252] as an example, these fields use a TLV structure so 987 they can be concatenated without any problems. 989 * If multiple items are included, an order for the items needs to be 990 defined. Using options from CoAP as an example, an application 991 could state that the fields are to be ordered by the option 992 number. 994 * Applications need to ensure that the byte string is going to be 995 the same on both sides. Using options from CoAP might give a 996 problem if the same relative numbering is kept. An intermediate 997 node could insert or remove an option, changing how the relative 998 number is done. An application would need to specify that the 999 relative number must be re-encoded to be relative only to the 1000 options that are in the external data. 1002 4.4. Signing and Verification Process 1004 In order to create a signature, a well-defined byte string is needed. 1005 The Sig_structure is used to create the canonical form. This signing 1006 and verification process takes in the body information (COSE_Sign or 1007 COSE_Sign1), the signer information (COSE_Signature), and the 1008 application data (external source). A Sig_structure is a CBOR array. 1009 The fields of the Sig_structure in order are: 1011 1. A context text string identifying the context of the signature. 1012 The context text string is: 1014 "Signature" for signatures using the COSE_Signature structure. 1016 "Signature1" for signatures using the COSE_Sign1 structure. 1018 "CounterSignature" for signatures used as counter signature 1019 attributes. 1021 "CounterSignature0" for signatures used as CounterSignature0 1022 attributes. 1024 2. The protected attributes from the body structure encoded in a 1025 bstr type. If there are no protected attributes, a zero-length 1026 byte string is used. 1028 3. The protected attributes from the signer structure encoded in a 1029 bstr type. If there are no protected attributes, a zero-length 1030 byte string is used. This field is omitted for the COSE_Sign1 1031 signature structure and CounterSignature0 attributes. 1033 4. The protected attributes from the application encoded in a bstr 1034 type. If this field is not supplied, it defaults to a zero- 1035 length byte string. (See Section 4.3 for application guidance on 1036 constructing this field.) 1038 5. The payload to be signed encoded in a bstr type. The payload is 1039 placed here independent of how it is transported. 1041 The CDDL fragment that describes the above text is: 1043 Sig_structure = [ 1044 context : "Signature" / "Signature1" / "CounterSignature" / 1045 "CounterSignature0", 1046 body_protected : empty_or_serialized_map, 1047 ? sign_protected : empty_or_serialized_map, 1048 external_aad : bstr, 1049 payload : bstr 1050 ] 1052 How to compute a signature: 1054 1. Create a Sig_structure and populate it with the appropriate 1055 fields. 1057 2. Create the value ToBeSigned by encoding the Sig_structure to a 1058 byte string, using the encoding described in Section 10. 1060 3. Call the signature creation algorithm passing in K (the key to 1061 sign with), alg (the algorithm to sign with), and ToBeSigned (the 1062 value to sign). 1064 4. Place the resulting signature value in the correct location. 1065 This is the 'signature' field of the COSE_Signature, COSE_Sign1 1066 or COSE_Countersignature structures. This is the value of the 1067 Countersignature0 attribute. 1069 The steps for verifying a signature are: 1071 1. Create a Sig_structure and populate it with the appropriate 1072 fields. 1074 2. Create the value ToBeSigned by encoding the Sig_structure to a 1075 byte string, using the encoding described in Section 10. 1077 3. Call the signature verification algorithm passing in K (the key 1078 to verify with), alg (the algorithm used sign with), ToBeSigned 1079 (the value to sign), and sig (the signature to be verified). 1081 In addition to performing the signature verification, the application 1082 performs the appropriate checks to ensure that the key is correctly 1083 paired with the signing identity and that the signing identity is 1084 authorized before performing actions. 1086 5. Counter Signatures 1088 A counter signature is normally defined as a second signature that 1089 confirms a primary signature. A normal example of a counter 1090 signature is the signature that a notary public places on a document 1091 as witnessing that you have signed the document. Thus applying a 1092 counter signature to either the COSE_Signature or COSE_Sign1 objects 1093 match this traditional definition. This document extends the context 1094 of a counter signature to allow it to be applied to all of the 1095 security structures defined. It needs to be noted that the counter 1096 signature needs to be treated as a separate operation from the 1097 initial operation even if it is applied by the same user as is done 1098 in [I-D.ietf-core-groupcomm-bis]. 1100 COSE supports two different forms for counter signatures. Full 1101 counter signatures use the structure COSE_Countersign. This is same 1102 structure as COSE_Signature and thus it can have protected 1103 attributes, chained counter signatures and information about 1104 identifying the key. Abbreviated counter signatures use the 1105 structure COSE_Countersign1. This structure only contains the 1106 signature value and nothing else. The structures cannot be converted 1107 between each other; as the signature computation includes a parameter 1108 identifying which structure is being used, the converted structure 1109 will fail signature validation. 1111 COSE was designed for uniformity in how the data structures are 1112 specified. One result of this is that for COSE one can expand the 1113 concept of counter signatures beyond just the idea of signing a 1114 signature to being able to sign most of the structures without having 1115 to create a new signing layer. When creating a counter signature, 1116 one needs to be clear about the security properties that result. 1117 When done on a COSE_Signature, the normal counter signature semantics 1118 are preserved. That is the counter signature makes a statement about 1119 the existence of a signature and, when used as a timestamp, a time 1120 point at which the signature exists. When done on a COSE_Mac or a 1121 COSE_Mac0, one effectively upgrades the MAC operation to a signature 1122 operation. When done on a COSE_Encrypt or COSE_Encrypt0, the 1123 existence of the encrypted data is attested to. It should be noted 1124 that there is a big difference between attesting to the encrypted 1125 data as opposed to attesting to the unencrypted data. If the latter 1126 is what is desired, then one needs to apply a signature to the data 1127 and then encrypt that. It is always possible to construct cases 1128 where the use of two different keys will appear to result in a 1129 successful decryption (the tag check success), but which produce two 1130 completely different plaintexts. This situation is not detectable by 1131 a counter signature on the encrypted data. 1133 5.1. Full Counter Signatures 1135 The COSE_Countersignature structure allows for the same set of 1136 capabilities of a COSE_Signature. This means that all of the 1137 capabilities of a signature are duplicated with this structure. 1138 Specifically, the counter signer does not need to be related to the 1139 producer of what is being counter signed as key and algorithm 1140 identification can be placed in the counter signature attributes. 1141 This also means that the counter signature can itself be counter 1142 signed. This is a feature required by protocols such as long-term 1143 archiving services. More information on how this is used can be 1144 found in the evidence record syntax described in [RFC4998]. 1146 The full counter signature structure can be encoded as either tagged 1147 or untagged depending on the context it is used in. A tagged 1148 COSE_Countersign structure is identified by the CBOR tag TBD0. The 1149 CDDL fragment for full counter signatures is: 1151 COSE_CounterSignature_Tagged = #6.98(COSE_CounterSignature) 1152 COSE_CounterSignature = COSE_Signature 1154 The details of the fields of a counter signature can be found in 1155 Section 4.1. The process of creating and validating abbreviated 1156 counter signatures is defined in Section 4.4. 1158 An example of a counter signature on a signature can be found in 1159 Appendix C.1.3. An example of a counter signature in an encryption 1160 object can be found in Appendix C.3.3. 1162 It should be noted that only a signature algorithm with appendix (see 1163 Section 9.1) can be used for counter signatures. This is because the 1164 body should be able to be processed without having to evaluate the 1165 counter signature, and this is not possible for signature schemes 1166 with message recovery. 1168 5.2. Abbreviated Counter Signatures 1170 Abbreviated counter signatures were designed primarily to deal with 1171 the problem of having encrypted group messaging, but still needing to 1172 know who originated the message. The objective was to keep the 1173 counter signature as small as possible while still providing the 1174 needed security. For abbreviated counter signatures, there is no 1175 provision for any protected attributes related to the signing 1176 operation. Instead, the parameters for computing or verifying the 1177 abbreviated counter signature are inferred from the same context used 1178 to describe the encryption, signature, or MAC processing. 1180 The byte string representing the signature value is placed in the 1181 CounterSignature0 attribute. This attribute is then encoded as an 1182 unprotected header parameter. The attribute is defined below. 1184 The process of creating and validating abbreviated counter signatures 1185 is defined in Section 4.4. 1187 +-------------------+-------+-------+-------+-------------------+ 1188 | Name | Label | Value | Value | Description | 1189 | | | Type | | | 1190 +===================+=======+=======+=======+===================+ 1191 | CounterSignature0 | 9 | bstr | | Abbreviated | 1192 | | | | | Counter Signature | 1193 +-------------------+-------+-------+-------+-------------------+ 1195 Table 4: Header Parameter for CounterSignature0 1197 6. Encryption Objects 1199 COSE supports two different encryption structures. COSE_Encrypt0 is 1200 used when a recipient structure is not needed because the key to be 1201 used is known implicitly. COSE_Encrypt is used the rest of the time. 1202 This includes cases where there are multiple recipients or a 1203 recipient algorithm other than direct (i.e. pre-shared secret) is 1204 used. 1206 6.1. Enveloped COSE Structure 1208 The enveloped structure allows for one or more recipients of a 1209 message. There are provisions for header parameters about the 1210 content and header parameters about the recipient information to be 1211 carried in the message. The protected header parameters associated 1212 with the content are authenticated by the content encryption 1213 algorithm. The protected header parameters associated with the 1214 recipient are authenticated by the recipient algorithm (when the 1215 algorithm supports it). Examples of header parameters about the 1216 content are the type of the content and the content encryption 1217 algorithm. Examples of header parameters about the recipient are the 1218 recipient's key identifier and the recipient's encryption algorithm. 1220 The same techniques and nearly the same structure are used for 1221 encrypting both the plaintext and the keys. This is different from 1222 the approach used by both "Cryptographic Message Syntax (CMS)" 1223 [RFC5652] and "JSON Web Encryption (JWE)" [RFC7516] where different 1224 structures are used for the content layer and for the recipient 1225 layer. Two structures are defined: COSE_Encrypt to hold the 1226 encrypted content and COSE_recipient to hold the encrypted keys for 1227 recipients. Examples of encrypted messages can be found in 1228 Appendix C.3. 1230 The COSE_Encrypt structure can be encoded as either tagged or 1231 untagged depending on the context it will be used in. A tagged 1232 COSE_Encrypt structure is identified by the CBOR tag 96. The CDDL 1233 fragment that represents this is: 1235 COSE_Encrypt_Tagged = #6.96(COSE_Encrypt) 1237 The COSE_Encrypt structure is a CBOR array. The fields of the array 1238 in order are: 1240 protected: This is as described in Section 3. 1242 unprotected: This is as described in Section 3. 1244 ciphertext: This field contains the ciphertext encoded as a bstr. 1245 If the ciphertext is to be transported independently of the 1246 control information about the encryption process (i.e., detached 1247 content), then the field is encoded as a nil value. 1249 recipients: This field contains an array of recipient information 1250 structures. The type for the recipient information structure is a 1251 COSE_recipient. 1253 The CDDL fragment that corresponds to the above text is: 1255 COSE_Encrypt = [ 1256 Headers, 1257 ciphertext : bstr / nil, 1258 recipients : [+COSE_recipient] 1259 ] 1261 The COSE_recipient structure is a CBOR array. The fields of the 1262 array in order are: 1264 protected: This is as described in Section 3. 1266 unprotected: This is as described in Section 3. 1268 ciphertext: This field contains the encrypted key encoded as a bstr. 1269 All encoded keys are symmetric keys; the binary value of the key 1270 is the content. If there is not an encrypted key, then this field 1271 is encoded as a nil value. 1273 recipients: This field contains an array of recipient information 1274 structures. The type for the recipient information structure is a 1275 COSE_recipient (an example of this can be found in Appendix B). 1276 If there are no recipient information structures, this element is 1277 absent. 1279 The CDDL fragment that corresponds to the above text for 1280 COSE_recipient is: 1282 COSE_recipient = [ 1283 Headers, 1284 ciphertext : bstr / nil, 1285 ? recipients : [+COSE_recipient] 1286 ] 1288 6.1.1. Content Key Distribution Methods 1290 An encrypted message consists of an encrypted content and an 1291 encrypted CEK for one or more recipients. The CEK is encrypted for 1292 each recipient, using a key specific to that recipient. The details 1293 of this encryption depend on which class the recipient algorithm 1294 falls into. Specific details on each of the classes can be found in 1295 Section 9.5. A short summary of the five content key distribution 1296 methods is: 1298 direct: The CEK is the same as the identified previously distributed 1299 symmetric key or is derived from a previously distributed secret. 1300 No CEK is transported in the message. 1302 symmetric key-encryption keys (KEK): The CEK is encrypted using a 1303 previously distributed symmetric KEK. Also known as key wrap. 1305 key agreement: The recipient's public key and a sender's private key 1306 are used to generate a pairwise secret, a Key Derivation Function 1307 (KDF) is applied to derive a key, and then the CEK is either the 1308 derived key or encrypted by the derived key. 1310 key transport: The CEK is encrypted with the recipient's public key. 1312 passwords: The CEK is encrypted in a KEK that is derived from a 1313 password. As of when this document was published, no password 1314 algorithms have been defined. 1316 6.2. Single Recipient Encrypted 1318 The COSE_Encrypt0 encrypted structure does not have the ability to 1319 specify recipients of the message. The structure assumes that the 1320 recipient of the object will already know the identity of the key to 1321 be used in order to decrypt the message. If a key needs to be 1322 identified to the recipient, the enveloped structure ought to be 1323 used. 1325 Examples of encrypted messages can be found in Appendix C.3. 1327 The COSE_Encrypt0 structure can be encoded as either tagged or 1328 untagged depending on the context it will be used in. A tagged 1329 COSE_Encrypt0 structure is identified by the CBOR tag 16. The CDDL 1330 fragment that represents this is: 1332 COSE_Encrypt0_Tagged = #6.16(COSE_Encrypt0) 1334 The COSE_Encrypt0 structure is a CBOR array. The fields of the array 1335 in order are: 1337 protected: This is as described in Section 3. 1339 unprotected: This is as described in Section 3. 1341 ciphertext: This is as described in Section 6.1. 1343 The CDDL fragment for COSE_Encrypt0 that corresponds to the above 1344 text is: 1346 COSE_Encrypt0 = [ 1347 Headers, 1348 ciphertext : bstr / nil, 1349 ] 1351 6.3. How to Encrypt and Decrypt for AEAD Algorithms 1353 The encryption algorithm for AEAD algorithms is fairly simple. The 1354 first step is to create a consistent byte string for the 1355 authenticated data structure. For this purpose, we use an 1356 Enc_structure. The Enc_structure is a CBOR array. The fields of the 1357 Enc_structure in order are: 1359 1. A context text string identifying the context of the 1360 authenticated data structure. The context text string is: 1362 "Encrypt0" for the content encryption of a COSE_Encrypt0 data 1363 structure. 1365 "Encrypt" for the first layer of a COSE_Encrypt data structure 1366 (i.e., for content encryption). 1368 "Enc_Recipient" for a recipient encoding to be placed in an 1369 COSE_Encrypt data structure. 1371 "Mac_Recipient" for a recipient encoding to be placed in a 1372 MACed message structure. 1374 "Rec_Recipient" for a recipient encoding to be placed in a 1375 recipient structure. 1377 2. The protected attributes from the body structure encoded in a 1378 bstr type. If there are no protected attributes, a zero-length 1379 byte string is used. 1381 3. The protected attributes from the application encoded in a bstr 1382 type. If this field is not supplied, it defaults to a zero- 1383 length byte string. (See Section 4.3 for application guidance on 1384 constructing this field.) 1386 The CDDL fragment that describes the above text is: 1388 Enc_structure = [ 1389 context : "Encrypt" / "Encrypt0" / "Enc_Recipient" / 1390 "Mac_Recipient" / "Rec_Recipient", 1391 protected : empty_or_serialized_map, 1392 external_aad : bstr 1393 ] 1395 How to encrypt a message: 1397 1. Create an Enc_structure and populate it with the appropriate 1398 fields. 1400 2. Encode the Enc_structure to a byte string (Additional 1401 Authenticated Data (AAD)), using the encoding described in 1402 Section 10. 1404 3. Determine the encryption key (K). This step is dependent on the 1405 class of recipient algorithm being used. For: 1407 No Recipients: The key to be used is determined by the algorithm 1408 and key at the current layer. Examples are key transport keys 1409 (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared 1410 secrets. 1412 Direct Encryption and Direct Key Agreement: The key is 1413 determined by the key and algorithm in the recipient 1414 structure. The encryption algorithm and size of the key to be 1415 used are inputs into the KDF used for the recipient. (For 1416 direct, the KDF can be thought of as the identity operation.) 1417 Examples of these algorithms are found in Sections 6.1.2 and 1418 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. 1420 Other: The key is randomly or pseudo-randomly generated. 1422 4. Call the encryption algorithm with K (the encryption key), P (the 1423 plaintext), and AAD. Place the returned ciphertext into the 1424 'ciphertext' field of the structure. 1426 5. For recipients of the message, recursively perform the encryption 1427 algorithm for that recipient, using K (the encryption key) as the 1428 plaintext. 1430 How to decrypt a message: 1432 1. Create an Enc_structure and populate it with the appropriate 1433 fields. 1435 2. Encode the Enc_structure to a byte string (AAD), using the 1436 encoding described in Section 10. 1438 3. Determine the decryption key. This step is dependent on the 1439 class of recipient algorithm being used. For: 1441 No Recipients: The key to be used is determined by the algorithm 1442 and key at the current layer. Examples are key transport keys 1443 (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared 1444 secrets. 1446 Direct Encryption and Direct Key Agreement: The key is 1447 determined by the key and algorithm in the recipient 1448 structure. The encryption algorithm and size of the key to be 1449 used are inputs into the KDF used for the recipient. (For 1450 direct, the KDF can be thought of as the identity operation.) 1452 Other: The key is determined by decoding and decrypting one of 1453 the recipient structures. 1455 4. Call the decryption algorithm with K (the decryption key to use), 1456 C (the ciphertext), and AAD. 1458 6.4. How to Encrypt and Decrypt for AE Algorithms 1460 How to encrypt a message: 1462 1. Verify that the 'protected' field is empty. 1464 2. Verify that there was no external additional authenticated data 1465 supplied for this operation. 1467 3. Determine the encryption key. This step is dependent on the 1468 class of recipient algorithm being used. For: 1470 No Recipients: The key to be used is determined by the algorithm 1471 and key at the current layer. Examples are key transport keys 1472 (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared 1473 secrets. 1475 Direct Encryption and Direct Key Agreement: The key is 1476 determined by the key and algorithm in the recipient 1477 structure. The encryption algorithm and size of the key to be 1478 used are inputs into the KDF used for the recipient. (For 1479 direct, the KDF can be thought of as the identity operation.) 1480 Examples of these algorithms are found in Sections 6.1.2 and 1481 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. 1483 Other: The key is randomly generated. 1485 4. Call the encryption algorithm with K (the encryption key to use) 1486 and P (the plaintext). Place the returned ciphertext into the 1487 'ciphertext' field of the structure. 1489 5. For recipients of the message, recursively perform the encryption 1490 algorithm for that recipient, using K (the encryption key) as the 1491 plaintext. 1493 How to decrypt a message: 1495 1. Verify that the 'protected' field is empty. 1497 2. Verify that there was no external additional authenticated data 1498 supplied for this operation. 1500 3. Determine the decryption key. This step is dependent on the 1501 class of recipient algorithm being used. For: 1503 No Recipients: The key to be used is determined by the algorithm 1504 and key at the current layer. Examples are key transport keys 1505 (Section 9.5.3), key wrap keys (Section 9.5.2), or pre-shared 1506 secrets. 1508 Direct Encryption and Direct Key Agreement: The key is 1509 determined by the key and algorithm in the recipient 1510 structure. The encryption algorithm and size of the key to be 1511 used are inputs into the KDF used for the recipient. (For 1512 direct, the KDF can be thought of as the identity operation.) 1513 Examples of these algorithms are found in Sections 6.1.2 and 1514 6.3 of [I-D.ietf-cose-rfc8152bis-algs]. 1516 Other: The key is determined by decoding and decrypting one of 1517 the recipient structures. 1519 4. Call the decryption algorithm with K (the decryption key to use) 1520 and C (the ciphertext). 1522 7. MAC Objects 1524 COSE supports two different MAC structures. COSE_MAC0 is used when a 1525 recipient structure is not needed because the key to be used is 1526 implicitly known. COSE_MAC is used for all other cases. These 1527 include a requirement for multiple recipients, the key being unknown, 1528 or a recipient algorithm of other than direct. 1530 In this section, we describe the structure and methods to be used 1531 when doing MAC authentication in COSE. This document allows for the 1532 use of all of the same classes of recipient algorithms as are allowed 1533 for encryption. 1535 When using MAC operations, there are two modes in which they can be 1536 used. The first is just a check that the content has not been 1537 changed since the MAC was computed. Any class of recipient algorithm 1538 can be used for this purpose. The second mode is to both check that 1539 the content has not been changed since the MAC was computed and to 1540 use the recipient algorithm to verify who sent it. The classes of 1541 recipient algorithms that support this are those that use a pre- 1542 shared secret or do static-static (SS) key agreement (without the key 1543 wrap step). In both of these cases, the entity that created and sent 1544 the message MAC can be validated. (This knowledge of the sender 1545 assumes that there are only two parties involved and that you did not 1546 send the message to yourself.) The origination property can be 1547 obtained with both of the MAC message structures. 1549 7.1. MACed Message with Recipients 1551 The multiple recipient MACed message uses two structures: the 1552 COSE_Mac structure defined in this section for carrying the body and 1553 the COSE_recipient structure (Section 6.1) to hold the key used for 1554 the MAC computation. Examples of MACed messages can be found in 1555 Appendix C.5. 1557 The MAC structure can be encoded as either tagged or untagged 1558 depending on the context it will be used in. A tagged COSE_Mac 1559 structure is identified by the CBOR tag 97. The CDDL fragment that 1560 represents this is: 1562 COSE_Mac_Tagged = #6.97(COSE_Mac) 1564 The COSE_Mac structure is a CBOR array. The fields of the array in 1565 order are: 1567 protected: This is as described in Section 3. 1569 unprotected: This is as described in Section 3. 1571 payload: This field contains the serialized content to be MACed. If 1572 the payload is not present in the message, the application is 1573 required to supply the payload separately. The payload is wrapped 1574 in a bstr to ensure that it is transported without changes. If 1575 the payload is transported separately (i.e., detached content), 1576 then a nil CBOR value is placed in this location, and it is the 1577 responsibility of the application to ensure that it will be 1578 transported without changes. 1580 tag: This field contains the MAC value. 1582 recipients: This is as described in Section 6.1. 1584 The CDDL fragment that represents the above text for COSE_Mac 1585 follows. 1587 COSE_Mac = [ 1588 Headers, 1589 payload : bstr / nil, 1590 tag : bstr, 1591 recipients :[+COSE_recipient] 1592 ] 1594 7.2. MACed Messages with Implicit Key 1596 In this section, we describe the structure and methods to be used 1597 when doing MAC authentication for those cases where the recipient is 1598 implicitly known. 1600 The MACed message uses the COSE_Mac0 structure defined in this 1601 section for carrying the body. Examples of MACed messages with an 1602 implicit key can be found in Appendix C.6. 1604 The MAC structure can be encoded as either tagged or untagged 1605 depending on the context it will be used in. A tagged COSE_Mac0 1606 structure is identified by the CBOR tag 17. The CDDL fragment that 1607 represents this is: 1609 COSE_Mac0_Tagged = #6.17(COSE_Mac0) 1611 The COSE_Mac0 structure is a CBOR array. The fields of the array in 1612 order are: 1614 protected: This is as described in Section 3. 1616 unprotected: This is as described in Section 3. 1618 payload: This is as described in Section 7.1. 1620 tag: This field contains the MAC value. 1622 The CDDL fragment that corresponds to the above text is: 1624 COSE_Mac0 = [ 1625 Headers, 1626 payload : bstr / nil, 1627 tag : bstr, 1628 ] 1630 7.3. How to Compute and Verify a MAC 1632 In order to get a consistent encoding of the data to be 1633 authenticated, the MAC_structure is used to have a canonical form. 1634 The MAC_structure is a CBOR array. The fields of the MAC_structure 1635 in order are: 1637 1. A context text string that identifies the structure that is being 1638 encoded. This context text string is "MAC" for the COSE_Mac 1639 structure. This context text string is "MAC0" for the COSE_Mac0 1640 structure. 1642 2. The protected attributes from the COSE_MAC structure. If there 1643 are no protected attributes, a zero-length bstr is used. 1645 3. The protected attributes from the application encoded as a bstr 1646 type. If this field is not supplied, it defaults to a zero- 1647 length byte string. (See Section 4.3 for application guidance on 1648 constructing this field.) 1650 4. The payload to be MACed encoded in a bstr type. The payload is 1651 placed here independent of how it is transported. 1653 The CDDL fragment that corresponds to the above text is: 1655 MAC_structure = [ 1656 context : "MAC" / "MAC0", 1657 protected : empty_or_serialized_map, 1658 external_aad : bstr, 1659 payload : bstr 1660 ] 1662 The steps to compute a MAC are: 1664 1. Create a MAC_structure and populate it with the appropriate 1665 fields. 1667 2. Create the value ToBeMaced by encoding the MAC_structure to a 1668 byte string, using the encoding described in Section 10. 1670 3. Call the MAC creation algorithm passing in K (the key to use), 1671 alg (the algorithm to MAC with), and ToBeMaced (the value to 1672 compute the MAC on). 1674 4. Place the resulting MAC in the 'tag' field of the COSE_Mac or 1675 COSE_Mac0 structure. 1677 5. For COSE_Mac structures, encrypt and encode the MAC key for each 1678 recipient of the message. 1680 The steps to verify a MAC are: 1682 1. Create a MAC_structure and populate it with the appropriate 1683 fields. 1685 2. Create the value ToBeMaced by encoding the MAC_structure to a 1686 byte string, using the encoding described in Section 10. 1688 3. For COSE_Mac structures, obtain the cryptographic key from one of 1689 the recipients of the message. 1691 4. Call the MAC creation algorithm passing in K (the key to use), 1692 alg (the algorithm to MAC with), and ToBeMaced (the value to 1693 compute the MAC on). 1695 5. Compare the MAC value to the 'tag' field of the COSE_Mac or 1696 COSE_Mac0 structure. 1698 8. Key Objects 1700 A COSE Key structure is built on a CBOR map. The set of common 1701 parameters that can appear in a COSE Key can be found in the IANA 1702 "COSE Key Common Parameters" registry (Section 12.4). Additional 1703 parameters defined for specific key types can be found in the IANA 1704 "COSE Key Type Parameters" registry ([COSE.KeyParameters]). 1706 A COSE Key Set uses a CBOR array object as its underlying type. The 1707 values of the array elements are COSE Keys. A COSE Key Set MUST have 1708 at least one element in the array. Examples of COSE Key Sets can be 1709 found in Appendix C.7. 1711 Each element in a COSE Key Set MUST be processed independently. If 1712 one element in a COSE Key Set is either malformed or uses a key that 1713 is not understood by an application, that key is ignored and the 1714 other keys are processed normally. 1716 The element "kty" is a required element in a COSE_Key map. 1718 The CDDL grammar describing COSE_Key and COSE_KeySet is: 1720 COSE_Key = { 1721 1 => tstr / int, ; kty 1722 ? 2 => bstr, ; kid 1723 ? 3 => tstr / int, ; alg 1724 ? 4 => [+ (tstr / int) ], ; key_ops 1725 ? 5 => bstr, ; Base IV 1726 * label => values 1727 } 1729 COSE_KeySet = [+COSE_Key] 1731 8.1. COSE Key Common Parameters 1733 This document defines a set of common parameters for a COSE Key 1734 object. Table 5 provides a summary of the parameters defined in this 1735 section. There are also parameters that are defined for specific key 1736 types. Key-type-specific parameters can be found in 1737 [I-D.ietf-cose-rfc8152bis-algs]. 1739 +---------+-------+--------+------------+--------------------+ 1740 | Name | Label | CBOR | Value | Description | 1741 | | | Type | Registry | | 1742 +=========+=======+========+============+====================+ 1743 | kty | 1 | tstr / | COSE Key | Identification of | 1744 | | | int | Types | the key type | 1745 +---------+-------+--------+------------+--------------------+ 1746 | kid | 2 | bstr | | Key identification | 1747 | | | | | value -- match to | 1748 | | | | | kid in message | 1749 +---------+-------+--------+------------+--------------------+ 1750 | alg | 3 | tstr / | COSE | Key usage | 1751 | | | int | Algorithms | restriction to | 1752 | | | | | this algorithm | 1753 +---------+-------+--------+------------+--------------------+ 1754 | key_ops | 4 | [+ | | Restrict set of | 1755 | | | (tstr/ | | permissible | 1756 | | | int)] | | operations | 1757 +---------+-------+--------+------------+--------------------+ 1758 | Base IV | 5 | bstr | | Base IV to be xor- | 1759 | | | | | ed with Partial | 1760 | | | | | IVs | 1761 +---------+-------+--------+------------+--------------------+ 1763 Table 5: Key Map Labels 1765 kty: This parameter is used to identify the family of keys for this 1766 structure and, thus, the set of key-type-specific parameters to be 1767 found. The set of values defined in this document can be found in 1768 [COSE.KeyTypes]. This parameter MUST be present in a key object. 1769 Implementations MUST verify that the key type is appropriate for 1770 the algorithm being processed. The key type MUST be included as 1771 part of the trust decision process. 1773 alg: This parameter is used to restrict the algorithm that is used 1774 with the key. If this parameter is present in the key structure, 1775 the application MUST verify that this algorithm matches the 1776 algorithm for which the key is being used. If the algorithms do 1777 not match, then this key object MUST NOT be used to perform the 1778 cryptographic operation. Note that the same key can be in a 1779 different key structure with a different or no algorithm 1780 specified; however, this is considered to be a poor security 1781 practice. 1783 kid: This parameter is used to give an identifier for a key. The 1784 identifier is not structured and can be anything from a user- 1785 provided byte string to a value computed on the public portion of 1786 the key. This field is intended for matching against a 'kid' 1787 parameter in a message in order to filter down the set of keys 1788 that need to be checked. 1790 key_ops: This parameter is defined to restrict the set of operations 1791 that a key is to be used for. The value of the field is an array 1792 of values from Table 6. Algorithms define the values of key ops 1793 that are permitted to appear and are required for specific 1794 operations. The set of values matches that in [RFC7517] and 1795 [W3C.WebCrypto]. 1797 Base IV: This parameter is defined to carry the base portion of an 1798 IV. It is designed to be used with the Partial IV header 1799 parameter defined in Section 3.1. This field provides the ability 1800 to associate a Partial IV with a key that is then modified on a 1801 per message basis with the Partial IV. 1803 Extreme care needs to be taken when using a Base IV in an 1804 application. Many encryption algorithms lose security if the same 1805 IV is used twice. 1807 If different keys are derived for each sender, using the same Base 1808 IV with Partial IVs starting at zero is likely to ensure that the 1809 IV would not be used twice for a single key. If different keys 1810 are derived for each sender, starting at the same Base IV is 1811 likely to satisfy this condition. If the same key is used for 1812 multiple senders, then the application needs to provide for a 1813 method of dividing the IV space up between the senders. This 1814 could be done by providing a different base point to start from or 1815 a different Partial IV to start with and restricting the number of 1816 messages to be sent before rekeying. 1818 +---------+-------+----------------------------------------------+ 1819 | Name | Value | Description | 1820 +=========+=======+==============================================+ 1821 | sign | 1 | The key is used to create signatures. | 1822 | | | Requires private key fields. | 1823 +---------+-------+----------------------------------------------+ 1824 | verify | 2 | The key is used for verification of | 1825 | | | signatures. | 1826 +---------+-------+----------------------------------------------+ 1827 | encrypt | 3 | The key is used for key transport | 1828 | | | encryption. | 1829 +---------+-------+----------------------------------------------+ 1830 | decrypt | 4 | The key is used for key transport | 1831 | | | decryption. Requires private key fields. | 1832 +---------+-------+----------------------------------------------+ 1833 | wrap | 5 | The key is used for key wrap encryption. | 1834 | key | | | 1835 +---------+-------+----------------------------------------------+ 1836 | unwrap | 6 | The key is used for key wrap decryption. | 1837 | key | | Requires private key fields. | 1838 +---------+-------+----------------------------------------------+ 1839 | derive | 7 | The key is used for deriving keys. Requires | 1840 | key | | private key fields. | 1841 +---------+-------+----------------------------------------------+ 1842 | derive | 8 | The key is used for deriving bits not to be | 1843 | bits | | used as a key. Requires private key fields. | 1844 +---------+-------+----------------------------------------------+ 1845 | MAC | 9 | The key is used for creating MACs. | 1846 | create | | | 1847 +---------+-------+----------------------------------------------+ 1848 | MAC | 10 | The key is used for validating MACs. | 1849 | verify | | | 1850 +---------+-------+----------------------------------------------+ 1852 Table 6: Key Operation Values 1854 9. Taxonomy of Algorithms used by COSE 1856 In this section, a taxonomy of the different algorithm types that can 1857 be used in COSE is laid out. This taxonomy should not be considered 1858 to be exhaustive. New algorithms will be created which will not fit 1859 into this taxonomy. If this occurs, then new documents addressing 1860 this new algorithms are going to be needed. 1862 9.1. Signature Algorithms 1864 Signature algorithms provide data origination and data integrity 1865 services. Data origination provides the ability to infer who 1866 originated the data based on who signed the data. Data integrity 1867 provides the ability to verify that the data has not been modified 1868 since it was signed. 1870 There are two signature algorithm schemes. The first is signature 1871 with appendix. In this scheme, the message content is processed and 1872 a signature is produced; the signature is called the appendix. This 1873 is the scheme used by algorithms such as ECDSA and the RSA 1874 Probabilistic Signature Scheme (RSASSA-PSS). (In fact, the SSA in 1875 RSASSA-PSS stands for Signature Scheme with Appendix.) 1877 The signature functions for this scheme are: 1879 signature = Sign(message content, key) 1881 valid = Verification(message content, key, signature) 1883 The second scheme is signature with message recovery (an example of 1884 such an algorithm is [PVSig]). In this scheme, the message content 1885 is processed, but part of it is included in the signature. Moving 1886 bytes of the message content into the signature allows for smaller 1887 signatures; the signature size is still potentially large, but the 1888 message content has shrunk. This has implications for systems 1889 implementing these algorithms and for applications that use them. 1890 The first is that the message content is not fully available until 1891 after a signature has been validated. Until that point, the part of 1892 the message contained inside of the signature is unrecoverable. The 1893 second is that the security analysis of the strength of the signature 1894 is very much based on the structure of the message content. Messages 1895 that are highly predictable require additional randomness to be 1896 supplied as part of the signature process. In the worst case, it 1897 becomes the same as doing a signature with appendix. Finally, in the 1898 event that multiple signatures are applied to a message, all of the 1899 signature algorithms are going to be required to consume the same 1900 number of bytes of message content. This means that the mixing of 1901 the different schemes in a single message is not supported, and if a 1902 recovery signature scheme is used, then the same amount of content 1903 needs to be consumed by all of the signatures. 1905 The signature functions for this scheme are: 1907 signature, message sent = Sign(message content, key) 1909 valid, message content = Verification(message sent, key, signature) 1910 Signature algorithms are used with the COSE_Signature and COSE_Sign1 1911 structures. At this time, only signatures with appendixes are 1912 defined for use with COSE; however, considerable interest has been 1913 expressed in using a signature with message recovery algorithm due to 1914 the effective size reduction that is possible. Implementations will 1915 need to keep this in mind for later possible integration. 1917 9.2. Message Authentication Code (MAC) Algorithms 1919 Message Authentication Codes (MACs) provide data authentication and 1920 integrity protection. They provide either no or very limited data 1921 origination. A MAC, for example, cannot be used to prove the 1922 identity of the sender to a third party. 1924 MACs use the same scheme as signature with appendix algorithms. The 1925 message content is processed and an authentication code is produced. 1926 The authentication code is frequently called a tag. 1928 The MAC functions are: 1930 tag = MAC_Create(message content, key) 1932 valid = MAC_Verify(message content, key, tag) 1934 MAC algorithms can be based on either a block cipher algorithm (i.e., 1935 AES-MAC) or a hash algorithm (i.e., a Hash-based Message 1936 Authentication Code (HMAC)). [I-D.ietf-cose-rfc8152bis-algs] defines 1937 a MAC algorithm using each of these constructions. 1939 MAC algorithms are used in the COSE_Mac and COSE_Mac0 structures. 1941 9.3. Content Encryption Algorithms 1943 Content encryption algorithms provide data confidentiality for 1944 potentially large blocks of data using a symmetric key. They provide 1945 integrity on the data that was encrypted; however, they provide 1946 either no or very limited data origination. (One cannot, for 1947 example, be used to prove the identity of the sender to a third 1948 party.) The ability to provide data origination is linked to how the 1949 CEK is obtained. 1951 COSE restricts the set of legal content encryption algorithms to 1952 those that support authentication both of the content and additional 1953 data. The encryption process will generate some type of 1954 authentication value, but that value may be either explicit or 1955 implicit in terms of the algorithm definition. For simplicity's 1956 sake, the authentication code will normally be defined as being 1957 appended to the ciphertext stream. The encryption functions are: 1959 ciphertext = Encrypt(message content, key, additional data) 1961 valid, message content = Decrypt(ciphertext, key, additional data) 1963 Most AEAD algorithms are logically defined as returning the message 1964 content only if the decryption is valid. Many but not all 1965 implementations will follow this convention. The message content 1966 MUST NOT be used if the decryption does not validate. 1968 These algorithms are used in COSE_Encrypt and COSE_Encrypt0. 1970 9.4. Key Derivation Functions (KDFs) 1972 KDFs are used to take some secret value and generate a different one. 1973 The secret value comes in three flavors: 1975 * Secrets that are uniformly random: This is the type of secret that 1976 is created by a good random number generator. 1978 * Secrets that are not uniformly random: This is type of secret that 1979 is created by operations like key agreement. 1981 * Secrets that are not random: This is the type of secret that 1982 people generate for things like passwords. 1984 General KDFs work well with the first type of secret, can do 1985 reasonably well with the second type of secret, and generally do 1986 poorly with the last type of secret. Functions like PBES2 [RFC8018] 1987 need to be used for non-random secrets. 1989 The same KDF can be set up to deal with the first two types of 1990 secrets in a different way. The KDF defined in section 5.1 of 1991 [I-D.ietf-cose-rfc8152bis-algs] is such a function. This is 1992 reflected in the set of algorithms defined around the HMAC-based 1993 Extract-and-Expand Key Derivation Function (HKDF). 1995 When using KDFs, one component that is included is context 1996 information. Context information is used to allow for different 1997 keying information to be derived from the same secret. The use of 1998 context-based keying material is considered to be a good security 1999 practice. 2001 9.5. Content Key Distribution Methods 2003 Content key distribution methods (recipient algorithms) can be 2004 defined into a number of different classes. COSE has the ability to 2005 support many classes of recipient algorithms. In this section, a 2006 number of classes are listed. The names of the recipient algorithm 2007 classes used here are the same as those defined in [RFC7516]. Other 2008 specifications use different terms for the recipient algorithm 2009 classes or do not support some of the recipient algorithm classes. 2011 9.5.1. Direct Encryption 2013 The direct encryption class algorithms share a secret between the 2014 sender and the recipient that is used either directly or after 2015 manipulation as the CEK. When direct encryption mode is used, it 2016 MUST be the only mode used on the message. 2018 The COSE_Recipient structure for the recipient is organized as 2019 follows: 2021 * The 'protected' field MUST be a zero-length byte string unless it 2022 is used in the computation of the content key. 2024 * The 'alg' header parameter MUST be present. 2026 * A header parameter identifying the shared secret SHOULD be 2027 present. 2029 * The 'ciphertext' field MUST be a zero-length byte string. 2031 * The 'recipients' field MUST be absent. 2033 9.5.2. Key Wrap 2035 In key wrap mode, the CEK is randomly generated and that key is then 2036 encrypted by a shared secret between the sender and the recipient. 2037 All of the currently defined key wrap algorithms for COSE are AE 2038 algorithms. Key wrap mode is considered to be superior to direct 2039 encryption if the system has any capability for doing random key 2040 generation. This is because the shared key is used to wrap random 2041 data rather than data that has some degree of organization and may in 2042 fact be repeating the same content. The use of key wrap loses the 2043 weak data origination that is provided by the direct encryption 2044 algorithms. 2046 The COSE_Encrypt structure for the recipient is organized as follows: 2048 * The 'protected' field MUST be absent if the key wrap algorithm is 2049 an AE algorithm. 2051 * The 'recipients' field is normally absent, but can be used. 2052 Applications MUST deal with a recipient field being present that 2053 has an unsupported algorithm, not being able to decrypt that 2054 recipient is an acceptable way of dealing with it. Failing to 2055 process the message is not an acceptable way of dealing with it. 2057 * The plaintext to be encrypted is the key from next layer down 2058 (usually the content layer). 2060 * At a minimum, the 'unprotected' field MUST contain the 'alg' 2061 header parameter and SHOULD contain a header parameter identifying 2062 the shared secret. 2064 9.5.3. Key Transport 2066 Key transport mode is also called key encryption mode in some 2067 standards. Key transport mode differs from key wrap mode in that it 2068 uses an asymmetric encryption algorithm rather than a symmetric 2069 encryption algorithm to protect the key. A set of key transport 2070 algorithms are defined in [RFC8230]. 2072 When using a key transport algorithm, the COSE_Encrypt structure for 2073 the recipient is organized as follows: 2075 * The 'protected' field MUST be absent. 2077 * The plaintext to be encrypted is the key from the next layer down 2078 (usually the content layer). 2080 * At a minimum, the 'unprotected' field MUST contain the 'alg' 2081 header parameter and SHOULD contain a parameter identifying the 2082 asymmetric key. 2084 9.5.4. Direct Key Agreement 2086 The 'direct key agreement' class of recipient algorithms uses a key 2087 agreement method to create a shared secret. A KDF is then applied to 2088 the shared secret to derive a key to be used in protecting the data. 2089 This key is normally used as a CEK or MAC key, but could be used for 2090 other purposes if more than two layers are in use (see Appendix B). 2092 The most commonly used key agreement algorithm is Diffie-Hellman, but 2093 other variants exist. Since COSE is designed for a store and forward 2094 environment rather than an online environment, many of the DH 2095 variants cannot be used as the receiver of the message cannot provide 2096 any dynamic key material. One side effect of this is that perfect 2097 forward secrecy (see [RFC4949]) is not achievable. A static key will 2098 always be used for the receiver of the COSE object. 2100 Two variants of DH that are supported are: 2102 Ephemeral-Static (ES) DH: where the sender of the message creates 2103 a one-time DH key and uses a static key for the recipient. The 2104 use of the ephemeral sender key means that no additional random 2105 input is needed as this is randomly generated for each message. 2107 Static-Static (SS) DH: where a static key is used for both the 2108 sender and the recipient. The use of static keys allows for the 2109 recipient to get a weak version of data origination for the 2110 message. When static-static key agreement is used, then some 2111 piece of unique data for the KDF is required to ensure that a 2112 different key is created for each message. 2114 When direct key agreement mode is used, there MUST be only one 2115 recipient in the message. This method creates the key directly, and 2116 that makes it difficult to mix with additional recipients. If 2117 multiple recipients are needed, then the version with key wrap needs 2118 to be used. 2120 The COSE_Encrypt structure for the recipient is organized as follows: 2122 * At a minimum, headers MUST contain the 'alg' header parameter and 2123 SHOULD contain a header parameter identifying the recipient's 2124 asymmetric key. 2126 * The headers SHOULD identify the sender's key for the static-static 2127 versions and MUST contain the sender's ephemeral key for the 2128 ephemeral-static versions. 2130 9.5.5. Key Agreement with Key Wrap 2132 Key Agreement with Key Wrap uses a randomly generated CEK. The CEK 2133 is then encrypted using a key wrap algorithm and a key derived from 2134 the shared secret computed by the key agreement algorithm. The 2135 function for this would be: 2137 encryptedKey = KeyWrap(KDF(DH-Shared, context), CEK) 2139 The COSE_Encrypt structure for the recipient is organized as follows: 2141 * The 'protected' field is fed into the KDF context structure. 2143 * The plaintext to be encrypted is the key from the next layer down 2144 (usually the content layer). 2146 * The 'alg' header parameter MUST be present in the layer. 2148 * A header parameter identifying the recipient's key SHOULD be 2149 present. A header parameter identifying the sender's key SHOULD 2150 be present. 2152 10. CBOR Encoding Restrictions 2154 The document limits the restrictions it imposes on the CBOR Encoder 2155 needs to work. 2157 * The restriction applies to the encoding of the Sig_structure, the 2158 Enc_structure, and the MAC_structure. 2160 * Encoding MUST be done using definite lengths and values MUST be 2161 the minimum possible length. This means that the integer 1 is 2162 encoded as "0x01" and not "0x1801". 2164 * Applications MUST NOT generate messages with the same label used 2165 twice as a key in a single map. Applications MUST NOT parse and 2166 process messages with the same label used twice as a key in a 2167 single map. Applications can enforce the parse and process 2168 requirement by using parsers that will fail the parse step or by 2169 using parsers that will pass all keys to the application, and the 2170 application can perform the check for duplicate keys. 2172 11. Application Profiling Considerations 2174 This document is designed to provide a set of security services, but 2175 not impose algorithm implementation requirements for specific usage. 2176 The interoperability requirements are provided for how each of the 2177 individual services are used and how the algorithms are to be used 2178 for interoperability. The requirements about which algorithms and 2179 which services are needed are deferred to each application. 2181 An example of a profile can be found in [RFC8613] where one was 2182 developed for carrying content in combination with CoAP headers. 2184 It is intended that a profile of this document be created that 2185 defines the interoperability requirements for that specific 2186 application. This section provides a set of guidelines and topics 2187 that need to be considered when profiling this document. 2189 * Applications need to determine the set of messages defined in this 2190 document that they will be using. The set of messages corresponds 2191 fairly directly to the set of security services that are needed 2192 and to the security levels needed. 2194 * Applications may define new header parameters for a specific 2195 purpose. Applications will often times select specific header 2196 parameters to use or not to use. For example, an application 2197 would normally state a preference for using either the IV or the 2198 Partial IV header parameter. If the Partial IV header parameter 2199 is specified, then the application also needs to define how the 2200 fixed portion of the IV is determined. 2202 * When applications use externally defined authenticated data, they 2203 need to define how that data is encoded. This document assumes 2204 that the data will be provided as a byte string. More information 2205 can be found in Section 4.3. 2207 * Applications need to determine the set of security algorithms that 2208 are to be used. When selecting the algorithms to be used as the 2209 mandatory-to-implement set, consideration should be given to 2210 choosing different types of algorithms when two are chosen for a 2211 specific purpose. An example of this would be choosing HMAC- 2212 SHA512 and AES-CMAC as different MAC algorithms; the construction 2213 is vastly different between these two algorithms. This means that 2214 a weakening of one algorithm would be unlikely to lead to a 2215 weakening of the other algorithms. Of course, these algorithms do 2216 not provide the same level of security and thus may not be 2217 comparable for the desired security functionality. 2219 * Applications may need to provide some type of negotiation or 2220 discovery method if multiple algorithms or message structures are 2221 permitted. The method can be as simple as requiring pre- 2222 configuration of the set of algorithms to providing a discovery 2223 method built into the protocol. S/MIME provided a number of 2224 different ways to approach the problem that applications could 2225 follow: 2227 - Advertising in the message (S/MIME capabilities) [RFC5751]. 2229 - Advertising in the certificate (capabilities extension) 2230 [RFC4262]. 2232 - Minimum requirements for the S/MIME, which have been updated 2233 over time [RFC2633] [RFC5751] (note that [RFC2633] has been 2234 obsoleted by [RFC5751]). 2236 12. IANA Considerations 2238 The registries and registrations listed below were created during 2239 processing of RFC 8152 [RFC8152]. The majority of the actions are to 2240 update the references to point to this document. 2242 12.1. CBOR Tag Assignment 2244 IANA assigned tags in the "CBOR Tags" registry as part of processing 2245 [RFC8152]. IANA is requested to update the references from [RFC8152] 2246 to this document. 2248 IANA is requested to register a new tag for the CounterSignature 2249 type. 2251 * Tag: TBD0 2253 * Data Item: COSE_Signature 2255 * Semantics: COSE standalone counter signature 2257 * Reference: [[this document]] 2259 12.2. COSE Header Parameters Registry 2261 IANA created a registry titled "COSE Header Parameters" as part of 2262 processing [RFC8152]. The registry has been created to use the 2263 "Expert Review Required" registration procedure [RFC8126]. 2265 IANA is requested to update the reference for entries in the table 2266 from [RFC8152] to this document. This document does not update the 2267 expert review guidelines provided in [RFC8152]. 2269 12.3. COSE Header Algorithm Parameters Registry 2271 IANA created a registry titled "COSE Header Algorithm Parameters" as 2272 part of processing [RFC8152]. The registry has been created to use 2273 the "Expert Review Required" registration procedure [RFC8126]. 2275 IANA is requested to update the references from [RFC8152] to this 2276 document. This document does not update the expert review guidelines 2277 provided in [RFC8152]. 2279 12.4. COSE Key Common Parameters Registry 2281 IANA created a registry titled "COSE Key Common Parameters" as part 2282 of the processing of [RFC8152]. The registry has been created to use 2283 the "Expert Review Required" registration procedure [RFC8126]. 2285 IANA is requested to update the reference for entries in the table 2286 from [RFC8152] to this document. This document does not update the 2287 expert review guidelines provided in [RFC8152]. 2289 12.5. Media Type Registrations 2291 12.5.1. COSE Security Message 2293 This section registers the 'application/cose' media type in the 2294 "Media Types" registry. These media types are used to indicate that 2295 the content is a COSE message. 2297 Type name: application 2299 Subtype name: cose 2301 Required parameters: N/A 2303 Optional parameters: cose-type 2305 Encoding considerations: binary 2307 Security considerations: See the Security Considerations section 2308 of [[This Document]]. 2310 Interoperability considerations: N/A 2312 Published specification: [[this document]] 2314 Applications that use this media type: IoT applications sending 2315 security content over HTTP(S) transports. 2317 Fragment identifier considerations: N/A 2319 Additional information: 2321 - Deprecated alias names for this type: N/A 2323 - Magic number(s): N/A 2325 - File extension(s): cbor 2327 - Macintosh file type code(s): N/A 2329 Person & email address to contact for further information: 2330 iesg@ietf.org 2332 Intended usage: COMMON 2333 Restrictions on usage: N/A 2335 Author: Jim Schaad, ietf@augustcellars.com 2337 Change Controller: IESG 2339 Provisional registration? No 2341 12.5.2. COSE Key Media Type 2343 This section registers the 'application/cose-key' and 'application/ 2344 cose-key-set' media types in the "Media Types" registry. These media 2345 types are used to indicate, respectively, that content is a COSE_Key 2346 or COSE_KeySet object. 2348 The template for registering 'application/cose-key' is: 2350 Type name: application 2352 Subtype name: cose-key 2354 Required parameters: N/A 2356 Optional parameters: N/A 2358 Encoding considerations: binary 2360 Security considerations: See the Security Considerations section 2361 of [[This Document]]. 2363 Interoperability considerations: N/A 2365 Published specification: [[this document]] 2367 Applications that use this media type: Distribution of COSE based 2368 keys for IoT applications. 2370 Fragment identifier considerations: N/A 2372 Additional information: 2374 - Deprecated alias names for this type: N/A 2376 - Magic number(s): N/A 2378 - File extension(s): cbor 2380 - Macintosh file type code(s): N/A 2381 Person & email address to contact for further information: 2382 iesg@ietf.org 2384 Intended usage: COMMON 2386 Restrictions on usage: N/A 2388 Author: Jim Schaad, ietf@augustcellars.com 2390 Change Controller: IESG 2392 Provisional registration? No 2394 The template for registering 'application/cose-key-set' is: 2396 Type name: application 2398 Subtype name: cose-key-set 2400 Required parameters: N/A 2402 Optional parameters: N/A 2404 Encoding considerations: binary 2406 Security considerations: See the Security Considerations section 2407 of [[This Document]]. 2409 Interoperability considerations: N/A 2411 Published specification: [[this document]] 2413 Applications that use this media type: Distribution of COSE based 2414 keys for IoT applications. 2416 Fragment identifier considerations: N/A 2418 Additional information: 2420 - Deprecated alias names for this type: N/A 2422 - Magic number(s): N/A 2424 - File extension(s): cbor 2426 - Macintosh file type code(s): N/A 2427 Person & email address to contact for further information: 2428 iesg@ietf.org 2430 Intended usage: COMMON 2432 Restrictions on usage: N/A 2434 Author: Jim Schaad, ietf@augustcellars.com 2436 Change Controller: IESG 2438 Provisional registration? No 2440 12.6. CoAP Content-Formats Registry 2442 IANA added the following entries to the "CoAP Content-Formats" 2443 registry while processing [RFC8152]. IANA is requested to update the 2444 reference value from [RFC8152] to [[This Document]]. 2446 13. Security Considerations 2448 There are a number of security considerations that need to be taken 2449 into account by implementers of this specification. The security 2450 considerations that are specific to an individual algorithm are 2451 placed next to the description of the algorithm. While some 2452 considerations have been highlighted here, additional considerations 2453 may be found in the documents listed in the references. 2455 Implementations need to protect the private key material for any 2456 individuals. There are some cases that need to be highlighted on 2457 this issue. 2459 * Using the same key for two different algorithms can leak 2460 information about the key. It is therefore recommended that keys 2461 be restricted to a single algorithm. 2463 * Use of 'direct' as a recipient algorithm combined with a second 2464 recipient algorithm exposes the direct key to the second 2465 recipient. 2467 * Several of the algorithms in [I-D.ietf-cose-rfc8152bis-algs] have 2468 limits on the number of times that a key can be used without 2469 leaking information about the key. 2471 The use of ECDH and direct plus KDF (with no key wrap) will not 2472 directly lead to the private key being leaked; the one way function 2473 of the KDF will prevent that. There is, however, a different issue 2474 that needs to be addressed. Having two recipients requires that the 2475 CEK be shared between two recipients. The second recipient therefore 2476 has a CEK that was derived from material that can be used for the 2477 weak proof of origin. The second recipient could create a message 2478 using the same CEK and send it to the first recipient; the first 2479 recipient would, for either static-static ECDH or direct plus KDF, 2480 make an assumption that the CEK could be used for proof of origin 2481 even though it is from the wrong entity. If the key wrap step is 2482 added, then no proof of origin is implied and this is not an issue. 2484 Although it has been mentioned before, the use of a single key for 2485 multiple algorithms has been demonstrated in some cases to leak 2486 information about that key, provide the opportunity for attackers to 2487 forge integrity tags, or gain information about encrypted content. 2488 Binding a key to a single algorithm prevents these problems. Key 2489 creators and key consumers are strongly encouraged not only to create 2490 new keys for each different algorithm, but to include that selection 2491 of algorithm in any distribution of key material and strictly enforce 2492 the matching of algorithms in the key structure to algorithms in the 2493 message structure. In addition to checking that algorithms are 2494 correct, the key form needs to be checked as well. Do not use an 2495 'EC2' key where an 'OKP' key is expected. 2497 Before using a key for transmission, or before acting on information 2498 received, a trust decision on a key needs to be made. Is the data or 2499 action something that the entity associated with the key has a right 2500 to see or a right to request? A number of factors are associated 2501 with this trust decision. Some of the ones that are highlighted here 2502 are: 2504 * What are the permissions associated with the key owner? 2506 * Is the cryptographic algorithm acceptable in the current context? 2508 * Have the restrictions associated with the key, such as algorithm 2509 or freshness, been checked and are they correct? 2511 * Is the request something that is reasonable, given the current 2512 state of the application? 2514 * Have any security considerations that are part of the message been 2515 enforced (as specified by the application or 'crit' header 2516 parameter)? 2518 There are a large number of algorithms presented in 2519 [I-D.ietf-cose-rfc8152bis-algs] that use nonce values. Nonces 2520 generally have some type of restriction on their values. Generally a 2521 nonce needs to be a unique value either for a key or for some other 2522 conditions. In all of these cases, there is no known requirement on 2523 the nonce being both unique and unpredictable; under these 2524 circumstances, it's reasonable to use a counter for creation of the 2525 nonce. In cases where one wants the pattern of the nonce to be 2526 unpredictable as well as unique, one can use a key created for that 2527 purpose and encrypt the counter to produce the nonce value. 2529 One area that has been starting to get exposure is doing traffic 2530 analysis of encrypted messages based on the length of the message. 2531 This specification does not provide for a uniform method of providing 2532 padding as part of the message structure. An observer can 2533 distinguish between two different messages (for example, 'YES' and 2534 'NO') based on the length for all of the content encryption 2535 algorithms that are defined in [I-D.ietf-cose-rfc8152bis-algs] 2536 document. This means that it is up to the applications to document 2537 how content padding is to be done in order to prevent or discourage 2538 such analysis. (For example, the text strings could be defined as 2539 'YES' and 'NO '.) 2541 14. Implementation Status 2543 This section is to be removed before publishing as an RFC. 2545 This section records the status of known implementations of the 2546 protocol defined by this specification at the time of posting of this 2547 Internet-Draft, and is based on a proposal described in [RFC7942]. 2548 The description of implementations in this section is intended to 2549 assist the IETF in its decision processes in progressing drafts to 2550 RFCs. Please note that the listing of any individual implementation 2551 here does not imply endorsement by the IETF. Furthermore, no effort 2552 has been spent to verify the information presented here that was 2553 supplied by IETF contributors. This is not intended as, and must not 2554 be construed to be, a catalog of available implementations or their 2555 features. Readers are advised to note that other implementations may 2556 exist. 2558 According to [RFC7942], "this will allow reviewers and working groups 2559 to assign due consideration to documents that have the benefit of 2560 running code, which may serve as evidence of valuable experimentation 2561 and feedback that have made the implemented protocols more mature. 2562 It is up to the individual working groups to use this information as 2563 they see fit". 2565 14.1. Author's Versions 2567 There are three different implementations that have been created by 2568 the author of the document both to create the examples that are 2569 included in the document and to validate the structures and 2570 methodology used in the design of COSE. 2572 * Implementation Location: https://github.com/cose-wg 2574 * Primary Maintainer: Jim Schaad 2576 * Languages: There are three different languages that are currently 2577 supported: Java, C# and C. 2579 * Cryptography: The Java and C# libraries use Bouncy Castle to 2580 provide the required cryptography. The C version uses OPENSSL 2581 Version 1.0 for the cryptography. 2583 * Coverage: The C version currently does not have full counter sign 2584 support. The other two versions do. They do have support to 2585 allow for implicit algorithm support as they allow for the 2586 application to set attributes that are not to be sent in the 2587 message. 2589 * Testing: All of the examples in the example library are generated 2590 by the C# library and then validated using the Java and C 2591 libraries. All three libraries have tests to allow for the 2592 creating of the same messages that are in the example library 2593 followed by validating them. These are not compared against the 2594 example library. The Java and C# libraries have unit testing 2595 included. Not all of the MUST statements in the document have 2596 been implemented as part of the libraries. One such statement is 2597 the requirement that unique labels be present. 2599 * Licensing: Revised BSD License 2601 14.2. JavaScript Version 2603 * Implementation Location: https://github.com/erdtman/cose-js 2605 * Primary Maintainer: Samuel Erdtman 2607 * Languages: JavaScript 2609 * Cryptography: TBD 2611 * Coverage: Full Encrypt, Signature and MAC objects are supported. 2613 * Testing: Basic testing against the common example library. 2615 * Licensing: Apache License 2.0 2617 14.3. Python Version 2618 * Implementation Location: https://github.com/TimothyClaeys/COSE- 2619 PYTHON 2621 * Primary Maintainer: Timothy Claeys 2623 * Languages: Python 2625 * Cryptography: pyecdsak, crypto python libraries 2627 * Coverage: TBD 2629 * Testing: Basic testing plus running against the common example 2630 library. 2632 * Licensing: BSD 3-Clause License 2634 14.4. COSE Testing Library 2636 * Implementation Location: https://github.com/cose-wg/Examples 2638 * Primary Maintainer: Jim Schaad 2640 * Description: A set of tests for the COSE library is provided as 2641 part of the implementation effort. Both success and fail tests 2642 have been provided. All of the examples in this document are part 2643 of this example set. 2645 * Coverage: An attempt has been made to have test cases for every 2646 message type and algorithm in the document. Currently examples 2647 dealing with counter signatures, and ECDH with Curve24459 and 2648 Goldilocks are missing. 2650 * Licensing: Public Domain 2652 15. References 2654 15.1. Normative References 2656 [COAP.Formats] 2657 IANA, "CoAP Content-Formats", 2658 . 2661 [COSE.Algorithms] 2662 IANA, "COSE Algorithms", 2663 . 2666 [COSE.KeyParameters] 2667 IANA, "COSE Key Parameters", 2668 . 2671 [COSE.KeyTypes] 2672 IANA, "COSE Key Types", 2673 . 2676 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 2677 Requirement Levels", BCP 14, RFC 2119, 2678 DOI 10.17487/RFC2119, March 1997, 2679 . 2681 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 2682 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 2683 October 2013, . 2685 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2686 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 2687 May 2017, . 2689 [DSS] National Institute of Standards and Technology, "Digital 2690 Signature Standard (DSS)", DOI 10.6028/NIST.FIPS.186-4, 2691 FIPS PUB 186-4, July 2013, 2692 . 2695 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 2696 Signature Algorithm (EdDSA)", RFC 8032, 2697 DOI 10.17487/RFC8032, January 2017, 2698 . 2700 [I-D.ietf-cose-rfc8152bis-algs] 2701 Schaad, J., "CBOR Object Signing and Encryption (COSE): 2702 Initial Algorithms", Work in Progress, Internet-Draft, 2703 draft-ietf-cose-rfc8152bis-algs-08, 14 May 2020, 2704 . 2707 15.2. Informative References 2709 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 2710 RFC 8152, DOI 10.17487/RFC8152, July 2017, 2711 . 2713 [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data 2714 Definition Language (CDDL): A Notational Convention to 2715 Express Concise Binary Object Representation (CBOR) and 2716 JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, 2717 June 2019, . 2719 [RFC8018] Moriarty, K., Ed., Kaliski, B., and A. Rusch, "PKCS #5: 2720 Password-Based Cryptography Specification Version 2.1", 2721 RFC 8018, DOI 10.17487/RFC8018, January 2017, 2722 . 2724 [RFC2633] Ramsdell, B., Ed., "S/MIME Version 3 Message 2725 Specification", RFC 2633, DOI 10.17487/RFC2633, June 1999, 2726 . 2728 [RFC4262] Santesson, S., "X.509 Certificate Extension for Secure/ 2729 Multipurpose Internet Mail Extensions (S/MIME) 2730 Capabilities", RFC 4262, DOI 10.17487/RFC4262, December 2731 2005, . 2733 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 2734 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 2735 . 2737 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 2738 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 2739 . 2741 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 2742 RFC 5652, DOI 10.17487/RFC5652, September 2009, 2743 . 2745 [RFC5751] Ramsdell, B. and S. Turner, "Secure/Multipurpose Internet 2746 Mail Extensions (S/MIME) Version 3.2 Message 2747 Specification", RFC 5751, DOI 10.17487/RFC5751, January 2748 2010, . 2750 [RFC5752] Turner, S. and J. Schaad, "Multiple Signatures in 2751 Cryptographic Message Syntax (CMS)", RFC 5752, 2752 DOI 10.17487/RFC5752, January 2010, 2753 . 2755 [RFC5990] Randall, J., Kaliski, B., Brainard, J., and S. Turner, 2756 "Use of the RSA-KEM Key Transport Algorithm in the 2757 Cryptographic Message Syntax (CMS)", RFC 5990, 2758 DOI 10.17487/RFC5990, September 2010, 2759 . 2761 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 2762 Specifications and Registration Procedures", BCP 13, 2763 RFC 6838, DOI 10.17487/RFC6838, January 2013, 2764 . 2766 [RFC8259] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 2767 Interchange Format", STD 90, RFC 8259, 2768 DOI 10.17487/RFC8259, December 2017, 2769 . 2771 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 2772 Application Protocol (CoAP)", RFC 7252, 2773 DOI 10.17487/RFC7252, June 2014, 2774 . 2776 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 2777 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 2778 2015, . 2780 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 2781 RFC 7516, DOI 10.17487/RFC7516, May 2015, 2782 . 2784 [RFC7517] Jones, M., "JSON Web Key (JWK)", RFC 7517, 2785 DOI 10.17487/RFC7517, May 2015, 2786 . 2788 [RFC7518] Jones, M., "JSON Web Algorithms (JWA)", RFC 7518, 2789 DOI 10.17487/RFC7518, May 2015, 2790 . 2792 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 2793 Writing an IANA Considerations Section in RFCs", BCP 26, 2794 RFC 8126, DOI 10.17487/RFC8126, June 2017, 2795 . 2797 [PVSig] Brown, D. and D. Johnson, "Formal Security Proofs for a 2798 Signature Scheme with Partial Message Recovery", 2799 DOI 10.1007/3-540-45353-9_11, LNCS Volume 2020, June 2000, 2800 . 2802 [W3C.WebCrypto] 2803 Watson, M., "Web Cryptography API", W3C Recommendation, 2804 January 2017, . 2806 [RFC8230] Jones, M., "Using RSA Algorithms with CBOR Object Signing 2807 and Encryption (COSE) Messages", RFC 8230, 2808 DOI 10.17487/RFC8230, September 2017, 2809 . 2811 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 2812 Code: The Implementation Status Section", BCP 205, 2813 RFC 7942, DOI 10.17487/RFC7942, July 2016, 2814 . 2816 [RFC4998] Gondrom, T., Brandner, R., and U. Pordesch, "Evidence 2817 Record Syntax (ERS)", RFC 4998, DOI 10.17487/RFC4998, 2818 August 2007, . 2820 [I-D.ietf-cose-hash-algs] 2821 Schaad, J., "CBOR Object Signing and Encryption (COSE): 2822 Hash Algorithms", Work in Progress, Internet-Draft, draft- 2823 ietf-cose-hash-algs-04, 29 May 2020, 2824 . 2827 [I-D.ietf-core-groupcomm-bis] 2828 Dijk, E., Wang, C., and M. Tiloca, "Group Communication 2829 for the Constrained Application Protocol (CoAP)", Work in 2830 Progress, Internet-Draft, draft-ietf-core-groupcomm-bis- 2831 00, 30 March 2020, . 2834 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 2835 "Object Security for Constrained RESTful Environments 2836 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 2837 . 2839 Appendix A. Guidelines for External Data Authentication of Algorithms 2841 During development of COSE, the requirement that the algorithm 2842 identifier be located in the protected attributes was relaxed from a 2843 must to a should. There were two basic reasons that have been 2844 advanced to support this position. First, the resulting message will 2845 be smaller if the algorithm identifier is omitted from the most 2846 common messages in a CoAP environment. Second, there is a potential 2847 bug that will arise if full checking is not done correctly between 2848 the different places that an algorithm identifier could be placed 2849 (the message itself, an application statement, the key structure that 2850 the sender possesses, and the key structure the recipient possesses). 2852 This appendix lays out how such a change can be made and the details 2853 that an application needs to specify in order to use this option. 2854 Two different sets of details are specified: those needed to omit an 2855 algorithm identifier and those needed to use a variant on the counter 2856 signature attribute that contains no attributes about itself. 2858 Three sets of recommendations are laid out. The first set of 2859 recommendations applies to having an implicit algorithm identified 2860 for a single layer of a COSE object. The second set of 2861 recommendations applies to having multiple implicit algorithms 2862 identified for multiple layers of a COSE object. The third set of 2863 recommendations applies to having implicit algorithms for multiple 2864 COSE object constructs. 2866 The key words from [RFC2119] are deliberately not used here. This 2867 specification can provide recommendations, but it cannot enforce 2868 them. 2870 This set of recommendations applies to the case where an application 2871 is distributing a fixed algorithm along with the key information for 2872 use in a single COSE object. This normally applies to the smallest 2873 of the COSE objects, specifically COSE_Sign1, COSE_Mac0, and 2874 COSE_Encrypt0, but could apply to the other structures as well. 2876 The following items should be taken into account: 2878 * Applications need to list the set of COSE structures that implicit 2879 algorithms are to be used in. Applications need to require that 2880 the receipt of an explicit algorithm identifier in one of these 2881 structures will lead to the message being rejected. This 2882 requirement is stated so that there will never be a case where 2883 there is any ambiguity about the question of which algorithm 2884 should be used, the implicit or the explicit one. This applies 2885 even if the transported algorithm identifier is a protected 2886 attribute. This applies even if the transported algorithm is the 2887 same as the implicit algorithm. 2889 * Applications need to define the set of information that is to be 2890 considered to be part of a context when omitting algorithm 2891 identifiers. At a minimum, this would be the key identifier (if 2892 needed), the key, the algorithm, and the COSE structure it is used 2893 with. Applications should restrict the use of a single key to a 2894 single algorithm. As noted for some of the algorithms in 2895 [I-D.ietf-cose-rfc8152bis-algs], the use of the same key in 2896 different related algorithms can lead to leakage of information 2897 about the key, leakage about the data or the ability to perform 2898 forgeries. 2900 * In many cases, applications that make the algorithm identifier 2901 implicit will also want to make the context identifier implicit 2902 for the same reason. That is, omitting the context identifier 2903 will decrease the message size (potentially significantly 2904 depending on the length of the identifier). Applications that do 2905 this will need to describe the circumstances where the context 2906 identifier is to be omitted and how the context identifier is to 2907 be inferred in these cases. (An exhaustive search over all of the 2908 keys would normally not be considered to be acceptable.) An 2909 example of how this can be done is to tie the context to a 2910 transaction identifier. Both would be sent on the original 2911 message, but only the transaction identifier would need to be sent 2912 after that point as the context is tied into the transaction 2913 identifier. Another way would be to associate a context with a 2914 network address. All messages coming from a single network 2915 address can be assumed to be associated with a specific context. 2916 (In this case, the address would normally be distributed as part 2917 of the context.) 2919 * Applications cannot rely on key identifiers being unique unless 2920 they take significant efforts to ensure that they are computed in 2921 such a way as to create this guarantee. Even when an application 2922 does this, the uniqueness might be violated if the application is 2923 run in different contexts (i.e., with a different context 2924 provider) or if the system combines the security contexts from 2925 different applications together into a single store. 2927 * Applications should continue the practice of protecting the 2928 algorithm identifier. Since this is not done by placing it in the 2929 protected attributes field, applications should define an 2930 application-specific external data structure that includes this 2931 value. This external data field can be used as such for content 2932 encryption, MAC, and signature algorithms. It can be used in the 2933 SuppPrivInfo field for those algorithms that use a KDF to derive a 2934 key value. Applications may also want to protect other 2935 information that is part of the context structure as well. It 2936 should be noted that those fields, such as the key or a Base IV, 2937 are protected by virtue of being used in the cryptographic 2938 computation and do not need to be included in the external data 2939 field. 2941 The second case is having multiple implicit algorithm identifiers 2942 specified for a multiple layer COSE object. An example of how this 2943 would work is the encryption context that an application specifies, 2944 which contains a content encryption algorithm, a key wrap algorithm, 2945 a key identifier, and a shared secret. The sender omits sending the 2946 algorithm identifier for both the content layer and the recipient 2947 layer leaving only the key identifier. The receiver then uses the 2948 key identifier to get the implicit algorithm identifiers. 2950 The following additional items need to be taken into consideration: 2952 * Applications that want to support this will need to define a 2953 structure that allows for, and clearly identifies, both the COSE 2954 structure to be used with a given key and the structure and 2955 algorithm to be used for the secondary layer. The key for the 2956 secondary layer is computed as normal from the recipient layer. 2958 The third case is having multiple implicit algorithm identifiers, but 2959 targeted at potentially unrelated layers or different COSE objects. 2960 There are a number of different scenarios where this might be 2961 applicable. Some of these scenarios are: 2963 * Two contexts are distributed as a pair. Each of the contexts is 2964 for use with a COSE_Encrypt message. Each context will consist of 2965 distinct secret keys and IVs and potentially even different 2966 algorithms. One context is for sending messages from party A to 2967 party B, and the second context is for sending messages from party 2968 B to party A. This means that there is no chance for a reflection 2969 attack to occur as each party uses different secret keys to send 2970 its messages; a message that is reflected back to it would fail to 2971 decrypt. 2973 * Two contexts are distributed as a pair. The first context is used 2974 for encryption of the message, and the second context is used to 2975 place a counter signature on the message. The intention is that 2976 the second context can be distributed to other entities 2977 independently of the first context. This allows these entities to 2978 validate that the message came from an individual without being 2979 able to decrypt the message and see the content. 2981 * Two contexts are distributed as a pair. The first context 2982 contains a key for dealing with MACed messages, and the second 2983 context contains a different key for dealing with encrypted 2984 messages. This allows for a unified distribution of keys to 2985 participants for different types of messages that have different 2986 keys, but where the keys may be used in a coordinated manner. 2988 For these cases, the following additional items need to be 2989 considered: 2991 * Applications need to ensure that the multiple contexts stay 2992 associated. If one of the contexts is invalidated for any reason, 2993 all of the contexts associated with it should also be invalidated. 2995 Appendix B. Two Layers of Recipient Information 2997 All of the currently defined recipient algorithm classes only use two 2998 layers of the COSE_Encrypt structure. The first layer is the message 2999 content, and the second layer is the content key encryption. 3000 However, if one uses a recipient algorithm such as the RSA Key 3001 Encapsulation Mechanism (RSA-KEM) (see Appendix A of RSA-KEM 3002 [RFC5990]), then it makes sense to have three layers of the 3003 COSE_Encrypt structure. 3005 These layers would be: 3007 * Layer 0: The content encryption layer. This layer contains the 3008 payload of the message. 3010 * Layer 1: The encryption of the CEK by a KEK. 3012 * Layer 2: The encryption of a long random secret using an RSA key 3013 and a key derivation function to convert that secret into the KEK. 3015 This is an example of what a triple layer message would look like. 3016 The message has the following layers: 3018 * Layer 0: Has a content encrypted with AES-GCM using a 128-bit key. 3020 * Layer 1: Uses the AES Key Wrap algorithm with a 128-bit key. 3022 * Layer 2: Uses ECDH Ephemeral-Static direct to generate the layer 1 3023 key. 3025 In effect, this example is a decomposed version of using the 3026 ECDH-ES+A128KW algorithm. 3028 Size of binary file is 183 bytes 3029 96( 3030 [ 3031 / protected / h'a10101' / { 3032 \ alg \ 1:1 \ AES-GCM 128 \ 3033 } / , 3034 / unprotected / { 3035 / iv / 5:h'02d1f7e6f26c43d4868d87ce' 3036 }, 3037 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0 3038 811139868826e89218a75715b', 3039 / recipients / [ 3040 [ 3041 / protected / h'', 3042 / unprotected / { 3043 / alg / 1:-3 / A128KW / 3044 }, 3045 / ciphertext / h'dbd43c4e9d719c27c6275c67d628d493f090593db82 3046 18f11', 3047 / recipients / [ 3048 [ 3049 / protected / h'a1013818' / { 3050 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3051 } / , 3052 / unprotected / { 3053 / ephemeral / -1:{ 3054 / kty / 1:2, 3055 / crv / -1:1, 3056 / x / -2:h'b2add44368ea6d641f9ca9af308b4079aeb519f11 3057 e9b8a55a600b21233e86e68', 3058 / y / -3:false 3059 }, 3060 / kid / 4:'meriadoc.brandybuck@buckland.example' 3061 }, 3062 / ciphertext / h'' 3063 ] 3064 ] 3065 ] 3066 ] 3067 ] 3068 ) 3070 Appendix C. Examples 3072 This appendix includes a set of examples that show the different 3073 features and message types that have been defined in this document. 3074 To make the examples easier to read, they are presented using the 3075 extended CBOR diagnostic notation (defined in [RFC8610]) rather than 3076 as a binary dump. 3078 A GitHub project has been created at that contains not only the examples presented in this 3080 document, but a more complete set of testing examples as well. Each 3081 example is found in a JSON file that contains the inputs used to 3082 create the example, some of the intermediate values that can be used 3083 in debugging the example and the output of the example presented both 3084 as a hex dump and in CBOR diagnostic notation format. Some of the 3085 examples at the site are designed failure testing cases; these are 3086 clearly marked as such in the JSON file. If errors in the examples 3087 in this document are found, the examples on GitHub will be updated, 3088 and a note to that effect will be placed in the JSON file. 3090 As noted, the examples are presented using the CBOR's diagnostic 3091 notation. A Ruby-based tool exists that can convert between the 3092 diagnostic notation and binary. This tool can be installed with the 3093 command line: 3095 gem install cbor-diag 3097 The diagnostic notation can be converted into binary files using the 3098 following command line: 3100 diag2cbor.rb < inputfile > outputfile 3102 The examples can be extracted from the XML version of this document 3103 via an XPath expression as all of the sourcecode is tagged with the 3104 attribute type='CBORdiag'. (Depending on the XPath evaluator one is 3105 using, it may be necessary to deal with > as an entity.) 3107 //sourcecode[@type='CDDL']/text() 3109 C.1. Examples of Signed Messages 3111 C.1.1. Single Signature 3113 This example uses the following: 3115 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3117 Size of binary file is 103 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 ] 3137 ) 3139 C.1.2. Multiple Signers 3141 This example uses the following: 3143 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3145 * Signature Algorithm: ECDSA w/ SHA-512, Curve P-521 3147 Size of binary file is 277 bytes 3148 98( 3149 [ 3150 / protected / h'', 3151 / unprotected / {}, 3152 / payload / 'This is the content.', 3153 / signatures / [ 3154 [ 3155 / protected / h'a10126' / { 3156 \ alg \ 1:-7 \ ECDSA 256 \ 3157 } / , 3158 / unprotected / { 3159 / kid / 4:'11' 3160 }, 3161 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 3162 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 3163 98f53afd2fa0f30a' 3164 ], 3165 [ 3166 / protected / h'a1013823' / { 3167 \ alg \ 1:-36 3168 } / , 3169 / unprotected / { 3170 / kid / 4:'bilbo.baggins@hobbiton.example' 3171 }, 3172 / signature / h'00a2d28a7c2bdb1587877420f65adf7d0b9a06635dd1 3173 de64bb62974c863f0b160dd2163734034e6ac003b01e8705524c5c4ca479a952f024 3174 7ee8cb0b4fb7397ba08d009e0c8bf482270cc5771aa143966e5a469a09f613488030 3175 c5b07ec6d722e3835adb5b2d8c44e95ffb13877dd2582866883535de3bb03d01753f 3176 83ab87bb4f7a0297' 3177 ] 3178 ] 3179 ] 3180 ) 3182 C.1.3. Counter Signature 3184 This example uses the following: 3186 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3188 * The same header parameters are used for both the signature and the 3189 counter signature. 3191 Size of binary file is 180 bytes 3192 98( 3193 [ 3194 / protected / h'', 3195 / unprotected / { 3196 / countersign / 7:[ 3197 / protected / h'a10126' / { 3198 \ alg \ 1:-7 \ ECDSA 256 \ 3199 } / , 3200 / unprotected / { 3201 / kid / 4:'11' 3202 }, 3203 / signature / h'5ac05e289d5d0e1b0a7f048a5d2b643813ded50bc9e4 3204 9220f4f7278f85f19d4a77d655c9d3b51e805a74b099e1e085aacd97fc29d72f887e 3205 8802bb6650cceb2c' 3206 ] 3207 }, 3208 / payload / 'This is the content.', 3209 / signatures / [ 3210 [ 3211 / protected / h'a10126' / { 3212 \ alg \ 1:-7 \ ECDSA 256 \ 3213 } / , 3214 / unprotected / { 3215 / kid / 4:'11' 3216 }, 3217 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 3218 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 3219 98f53afd2fa0f30a' 3220 ] 3221 ] 3222 ] 3223 ) 3225 C.1.4. Signature with Criticality 3227 This example uses the following: 3229 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3231 * There is a criticality marker on the "reserved" header parameter 3233 Size of binary file is 125 bytes 3234 98( 3235 [ 3236 / protected / h'a2687265736572766564f40281687265736572766564' / 3237 { 3238 "reserved":false, 3239 \ crit \ 2:[ 3240 "reserved" 3241 ] 3242 } / , 3243 / unprotected / {}, 3244 / payload / 'This is the content.', 3245 / signatures / [ 3246 [ 3247 / protected / h'a10126' / { 3248 \ alg \ 1:-7 \ ECDSA 256 \ 3249 } / , 3250 / unprotected / { 3251 / kid / 4:'11' 3252 }, 3253 / signature / h'3fc54702aa56e1b2cb20284294c9106a63f91bac658d 3254 69351210a031d8fc7c5ff3e4be39445b1a3e83e1510d1aca2f2e8a7c081c7645042b 3255 18aba9d1fad1bd9c' 3256 ] 3257 ] 3258 ] 3259 ) 3261 C.2. Single Signer Examples 3263 C.2.1. Single ECDSA Signature 3265 This example uses the following: 3267 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 3269 Size of binary file is 98 bytes 3270 18( 3271 [ 3272 / protected / h'a10126' / { 3273 \ alg \ 1:-7 \ ECDSA 256 \ 3274 } / , 3275 / unprotected / { 3276 / kid / 4:'11' 3277 }, 3278 / payload / 'This is the content.', 3279 / signature / h'8eb33e4ca31d1c465ab05aac34cc6b23d58fef5c083106c4 3280 d25a91aef0b0117e2af9a291aa32e14ab834dc56ed2a223444547e01f11d3b0916e5 3281 a4c345cacb36' 3282 ] 3283 ) 3285 C.3. Examples of Enveloped Messages 3287 C.3.1. Direct ECDH 3289 This example uses the following: 3291 * CEK: AES-GCM w/ 128-bit key 3293 * Recipient class: ECDH Ephemeral-Static, Curve P-256 3295 Size of binary file is 151 bytes 3296 96( 3297 [ 3298 / protected / h'a10101' / { 3299 \ alg \ 1:1 \ AES-GCM 128 \ 3300 } / , 3301 / unprotected / { 3302 / iv / 5:h'c9cf4df2fe6c632bf7886413' 3303 }, 3304 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 3305 c52a357da7a644b8070a151b0', 3306 / recipients / [ 3307 [ 3308 / protected / h'a1013818' / { 3309 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3310 } / , 3311 / unprotected / { 3312 / ephemeral / -1:{ 3313 / kty / 1:2, 3314 / crv / -1:1, 3315 / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbf 3316 bf054e1c7b4d91d6280', 3317 / y / -3:true 3318 }, 3319 / kid / 4:'meriadoc.brandybuck@buckland.example' 3320 }, 3321 / ciphertext / h'' 3322 ] 3323 ] 3324 ] 3325 ) 3327 C.3.2. Direct Plus Key Derivation 3329 This example uses the following: 3331 * CEK: AES-CCM w/ 128-bit key, truncate the tag to 64 bits 3333 * Recipient class: Use HKDF on a shared secret with the following 3334 implicit fields as part of the context. 3336 - salt: "aabbccddeeffgghh" 3338 - PartyU identity: "lighting-client" 3340 - PartyV identity: "lighting-server" 3342 - Supplementary Public Other: "Encryption Example 02" 3344 Size of binary file is 91 bytes 3346 96( 3347 [ 3348 / protected / h'a1010a' / { 3349 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3350 } / , 3351 / unprotected / { 3352 / iv / 5:h'89f52f65a1c580933b5261a76c' 3353 }, 3354 / ciphertext / h'753548a19b1307084ca7b2056924ed95f2e3b17006dfe93 3355 1b687b847', 3356 / recipients / [ 3357 [ 3358 / protected / h'a10129' / { 3359 \ alg \ 1:-10 3360 } / , 3361 / unprotected / { 3362 / salt / -20:'aabbccddeeffgghh', 3363 / kid / 4:'our-secret' 3364 }, 3365 / ciphertext / h'' 3366 ] 3367 ] 3368 ] 3369 ) 3371 C.3.3. Counter Signature on Encrypted Content 3373 This example uses the following: 3375 * CEK: AES-GCM w/ 128-bit key 3377 * Recipient class: ECDH Ephemeral-Static, Curve P-256 3379 Size of binary file is 326 bytes 3380 96( 3381 [ 3382 / protected / h'a10101' / { 3383 \ alg \ 1:1 \ AES-GCM 128 \ 3384 } / , 3385 / unprotected / { 3386 / iv / 5:h'c9cf4df2fe6c632bf7886413', 3387 / countersign / 7:[ 3388 / protected / h'a1013823' / { 3389 \ alg \ 1:-36 3390 } / , 3391 / unprotected / { 3392 / kid / 4:'bilbo.baggins@hobbiton.example' 3393 }, 3394 / signature / h'00929663c8789bb28177ae28467e66377da12302d7f9 3395 594d2999afa5dfa531294f8896f2b6cdf1740014f4c7f1a358e3a6cf57f4ed6fb02f 3396 cf8f7aa989f5dfd07f0700a3a7d8f3c604ba70fa9411bd10c2591b483e1d2c31de00 3397 3183e434d8fba18f17a4c7e3dfa003ac1cf3d30d44d2533c4989d3ac38c38b71481c 3398 c3430c9d65e7ddff' 3399 ] 3400 }, 3401 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 3402 c52a357da7a644b8070a151b0', 3403 / recipients / [ 3404 [ 3405 / protected / h'a1013818' / { 3406 \ alg \ 1:-25 \ ECDH-ES + HKDF-256 \ 3407 } / , 3408 / unprotected / { 3409 / ephemeral / -1:{ 3410 / kty / 1:2, 3411 / crv / -1:1, 3412 / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbf 3413 bf054e1c7b4d91d6280', 3414 / y / -3:true 3415 }, 3416 / kid / 4:'meriadoc.brandybuck@buckland.example' 3417 }, 3418 / ciphertext / h'' 3419 ] 3420 ] 3421 ] 3422 ) 3424 C.3.4. Encrypted Content with External Data 3426 This example uses the following: 3428 * CEK: AES-GCM w/ 128-bit key 3430 * Recipient class: ECDH static-Static, Curve P-256 with AES Key Wrap 3432 * Externally Supplied AAD: h'0011bbcc22dd44ee55ff660077' 3434 Size of binary file is 173 bytes 3436 96( 3437 [ 3438 / protected / h'a10101' / { 3439 \ alg \ 1:1 \ AES-GCM 128 \ 3440 } / , 3441 / unprotected / { 3442 / iv / 5:h'02d1f7e6f26c43d4868d87ce' 3443 }, 3444 / ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e28529d8f5335 3445 e5f0165eee976b4a5f6c6f09d', 3446 / recipients / [ 3447 [ 3448 / protected / h'a101381f' / { 3449 \ alg \ 1:-32 \ ECHD-SS+A128KW \ 3450 } / , 3451 / unprotected / { 3452 / static kid / -3:'peregrin.took@tuckborough.example', 3453 / kid / 4:'meriadoc.brandybuck@buckland.example', 3454 / U nonce / -22:h'0101' 3455 }, 3456 / ciphertext / h'41e0d76f579dbd0d936a662d54d8582037de2e366fd 3457 e1c62' 3458 ] 3459 ] 3460 ] 3461 ) 3463 C.4. Examples of Encrypted Messages 3465 C.4.1. Simple Encrypted Message 3467 This example uses the following: 3469 * CEK: AES-CCM w/ 128-bit key and a 64-bit tag 3471 Size of binary file is 52 bytes 3472 16( 3473 [ 3474 / protected / h'a1010a' / { 3475 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3476 } / , 3477 / unprotected / { 3478 / iv / 5:h'89f52f65a1c580933b5261a78c' 3479 }, 3480 / ciphertext / h'5974e1b99a3a4cc09a659aa2e9e7fff161d38ce71cb45ce 3481 460ffb569' 3482 ] 3483 ) 3485 C.4.2. Encrypted Message with a Partial IV 3487 This example uses the following: 3489 * CEK: AES-CCM w/ 128-bit key and a 64-bit tag 3491 * Prefix for IV is 89F52F65A1C580933B52 3493 Size of binary file is 41 bytes 3495 16( 3496 [ 3497 / protected / h'a1010a' / { 3498 \ alg \ 1:10 \ AES-CCM-16-64-128 \ 3499 } / , 3500 / unprotected / { 3501 / partial iv / 6:h'61a7' 3502 }, 3503 / ciphertext / h'252a8911d465c125b6764739700f0141ed09192de139e05 3504 3bd09abca' 3505 ] 3506 ) 3508 C.5. Examples of MACed Messages 3510 C.5.1. Shared Secret Direct MAC 3512 This example uses the following: 3514 * MAC: AES-CMAC, 256-bit key, truncated to 64 bits 3516 * Recipient class: direct shared secret 3518 Size of binary file is 57 bytes 3519 97( 3520 [ 3521 / protected / h'a1010f' / { 3522 \ alg \ 1:15 \ AES-CBC-MAC-256//64 \ 3523 } / , 3524 / unprotected / {}, 3525 / payload / 'This is the content.', 3526 / tag / h'9e1226ba1f81b848', 3527 / recipients / [ 3528 [ 3529 / protected / h'', 3530 / unprotected / { 3531 / alg / 1:-6 / direct /, 3532 / kid / 4:'our-secret' 3533 }, 3534 / ciphertext / h'' 3535 ] 3536 ] 3537 ] 3538 ) 3540 C.5.2. ECDH Direct MAC 3542 This example uses the following: 3544 * MAC: HMAC w/SHA-256, 256-bit key 3546 * Recipient class: ECDH key agreement, two static keys, HKDF w/ 3547 context structure 3549 Size of binary file is 214 bytes 3550 97( 3551 [ 3552 / protected / h'a10105' / { 3553 \ alg \ 1:5 \ HMAC 256//256 \ 3554 } / , 3555 / unprotected / {}, 3556 / payload / 'This is the content.', 3557 / tag / h'81a03448acd3d305376eaa11fb3fe416a955be2cbe7ec96f012c99 3558 4bc3f16a41', 3559 / recipients / [ 3560 [ 3561 / protected / h'a101381a' / { 3562 \ alg \ 1:-27 \ ECDH-SS + HKDF-256 \ 3563 } / , 3564 / unprotected / { 3565 / static kid / -3:'peregrin.took@tuckborough.example', 3566 / kid / 4:'meriadoc.brandybuck@buckland.example', 3567 / U nonce / -22:h'4d8553e7e74f3c6a3a9dd3ef286a8195cbf8a23d 3568 19558ccfec7d34b824f42d92bd06bd2c7f0271f0214e141fb779ae2856abf585a583 3569 68b017e7f2a9e5ce4db5' 3570 }, 3571 / ciphertext / h'' 3572 ] 3573 ] 3574 ] 3575 ) 3577 C.5.3. Wrapped MAC 3579 This example uses the following: 3581 * MAC: AES-MAC, 128-bit key, truncated to 64 bits 3583 * Recipient class: AES Key Wrap w/ a pre-shared 256-bit key 3585 Size of binary file is 109 bytes 3586 97( 3587 [ 3588 / protected / h'a1010e' / { 3589 \ alg \ 1:14 \ AES-CBC-MAC-128//64 \ 3590 } / , 3591 / unprotected / {}, 3592 / payload / 'This is the content.', 3593 / tag / h'36f5afaf0bab5d43', 3594 / recipients / [ 3595 [ 3596 / protected / h'', 3597 / unprotected / { 3598 / alg / 1:-5 / A256KW /, 3599 / kid / 4:'018c0ae5-4d9b-471b-bfd6-eef314bc7037' 3600 }, 3601 / ciphertext / h'711ab0dc2fc4585dce27effa6781c8093eba906f227 3602 b6eb0' 3603 ] 3604 ] 3605 ] 3606 ) 3608 C.5.4. Multi-Recipient MACed Message 3610 This example uses the following: 3612 * MAC: HMAC w/ SHA-256, 128-bit key 3614 * Recipient class: Uses three different methods 3616 1. ECDH Ephemeral-Static, Curve P-521, AES Key Wrap w/ 128-bit 3617 key 3619 2. AES Key Wrap w/ 256-bit key 3621 Size of binary file is 309 bytes 3622 97( 3623 [ 3624 / protected / h'a10105' / { 3625 \ alg \ 1:5 \ HMAC 256//256 \ 3626 } / , 3627 / unprotected / {}, 3628 / payload / 'This is the content.', 3629 / tag / h'bf48235e809b5c42e995f2b7d5fa13620e7ed834e337f6aa43df16 3630 1e49e9323e', 3631 / recipients / [ 3632 [ 3633 / protected / h'a101381c' / { 3634 \ alg \ 1:-29 \ ECHD-ES+A128KW \ 3635 } / , 3636 / unprotected / { 3637 / ephemeral / -1:{ 3638 / kty / 1:2, 3639 / crv / -1:3, 3640 / x / -2:h'0043b12669acac3fd27898ffba0bcd2e6c366d53bc4db 3641 71f909a759304acfb5e18cdc7ba0b13ff8c7636271a6924b1ac63c02688075b55ef2 3642 d613574e7dc242f79c3', 3643 / y / -3:true 3644 }, 3645 / kid / 4:'bilbo.baggins@hobbiton.example' 3646 }, 3647 / ciphertext / h'339bc4f79984cdc6b3e6ce5f315a4c7d2b0ac466fce 3648 a69e8c07dfbca5bb1f661bc5f8e0df9e3eff5' 3649 ], 3650 [ 3651 / protected / h'', 3652 / unprotected / { 3653 / alg / 1:-5 / A256KW /, 3654 / kid / 4:'018c0ae5-4d9b-471b-bfd6-eef314bc7037' 3655 }, 3656 / ciphertext / h'0b2c7cfce04e98276342d6476a7723c090dfdd15f9a 3657 518e7736549e998370695e6d6a83b4ae507bb' 3658 ] 3659 ] 3660 ] 3661 ) 3663 C.6. Examples of MAC0 Messages 3665 C.6.1. Shared Secret Direct MAC 3667 This example uses the following: 3669 * MAC: AES-CMAC, 256-bit key, truncated to 64 bits 3670 * Recipient class: direct shared secret 3672 Size of binary file is 37 bytes 3674 17( 3675 [ 3676 / protected / h'a1010f' / { 3677 \ alg \ 1:15 \ AES-CBC-MAC-256//64 \ 3678 } / , 3679 / unprotected / {}, 3680 / payload / 'This is the content.', 3681 / tag / h'726043745027214f' 3682 ] 3683 ) 3685 Note that this example uses the same inputs as Appendix C.5.1. 3687 C.7. COSE Keys 3689 C.7.1. Public Keys 3691 This is an example of a COSE Key Set. This example includes the 3692 public keys for all of the previous examples. 3694 In order the keys are: 3696 * An EC key with a kid of "meriadoc.brandybuck@buckland.example" 3698 * An EC key with a kid of "peregrin.took@tuckborough.example" 3700 * An EC key with a kid of "bilbo.baggins@hobbiton.example" 3702 * An EC key with a kid of "11" 3704 Size of binary file is 481 bytes 3706 [ 3707 { 3708 -1:1, 3709 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 3710 8551d', 3711 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 3712 4d19c', 3713 1:2, 3714 2:'meriadoc.brandybuck@buckland.example' 3715 }, 3716 { 3717 -1:1, 3718 -2:h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a 3719 09eff', 3720 -3:h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbf 3721 c117e', 3722 1:2, 3723 2:'11' 3724 }, 3725 { 3726 -1:3, 3727 -2:h'0072992cb3ac08ecf3e5c63dedec0d51a8c1f79ef2f82f94f3c737bf5de 3728 7986671eac625fe8257bbd0394644caaa3aaf8f27a4585fbbcad0f2457620085e5c8 3729 f42ad', 3730 -3:h'01dca6947bce88bc5790485ac97427342bc35f887d86d65a089377e247e 3731 60baa55e4e8501e2ada5724ac51d6909008033ebc10ac999b9d7f5cc2519f3fe1ea1 3732 d9475', 3733 1:2, 3734 2:'bilbo.baggins@hobbiton.example' 3735 }, 3736 { 3737 -1:1, 3738 -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbfbf054e1c7b4d91 3739 d6280', 3740 -3:h'f01400b089867804b8e9fc96c3932161f1934f4223069170d924b7e03bf 3741 822bb', 3742 1:2, 3743 2:'peregrin.took@tuckborough.example' 3744 } 3745 ] 3747 C.7.2. Private Keys 3749 This is an example of a COSE Key Set. This example includes the 3750 private keys for all of the previous examples. 3752 In order the keys are: 3754 * An EC key with a kid of "meriadoc.brandybuck@buckland.example" 3756 * A shared-secret key with a kid of "our-secret" 3758 * An EC key with a kid of "peregrin.took@tuckborough.example" 3760 * A shared-secret key with a kid of "018c0ae5-4d9b-471b- 3761 bfd6-eef314bc7037" 3763 * An EC key with a kid of "bilbo.baggins@hobbiton.example" 3765 * An EC key with a kid of "11" 3767 Size of binary file is 816 bytes 3769 [ 3770 { 3771 1:2, 3772 2:'meriadoc.brandybuck@buckland.example', 3773 -1:1, 3774 -2:h'65eda5a12577c2bae829437fe338701a10aaa375e1bb5b5de108de439c0 3775 8551d', 3776 -3:h'1e52ed75701163f7f9e40ddf9f341b3dc9ba860af7e0ca7ca7e9eecd008 3777 4d19c', 3778 -4:h'aff907c99f9ad3aae6c4cdf21122bce2bd68b5283e6907154ad911840fa 3779 208cf' 3780 }, 3781 { 3782 1:2, 3783 2:'11', 3784 -1:1, 3785 -2:h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a 3786 09eff', 3787 -3:h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbf 3788 c117e', 3789 -4:h'57c92077664146e876760c9520d054aa93c3afb04e306705db609030850 3790 7b4d3' 3791 }, 3792 { 3793 1:2, 3794 2:'bilbo.baggins@hobbiton.example', 3795 -1:3, 3796 -2:h'0072992cb3ac08ecf3e5c63dedec0d51a8c1f79ef2f82f94f3c737bf5de 3797 7986671eac625fe8257bbd0394644caaa3aaf8f27a4585fbbcad0f2457620085e5c8 3798 f42ad', 3799 -3:h'01dca6947bce88bc5790485ac97427342bc35f887d86d65a089377e247e 3800 60baa55e4e8501e2ada5724ac51d6909008033ebc10ac999b9d7f5cc2519f3fe1ea1 3801 d9475', 3802 -4:h'00085138ddabf5ca975f5860f91a08e91d6d5f9a76ad4018766a476680b 3803 55cd339e8ab6c72b5facdb2a2a50ac25bd086647dd3e2e6e99e84ca2c3609fdf177f 3804 eb26d' 3805 }, 3806 { 3807 1:4, 3808 2:'our-secret', 3809 -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4 3810 27188' 3811 }, 3812 { 3813 1:2, 3814 -1:1, 3815 2:'peregrin.took@tuckborough.example', 3816 -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbfbf054e1c7b4d91 3817 d6280', 3818 -3:h'f01400b089867804b8e9fc96c3932161f1934f4223069170d924b7e03bf 3819 822bb', 3820 -4:h'02d1f7e6f26c43d4868d87ceb2353161740aacf1f7163647984b522a848 3821 df1c3' 3822 }, 3823 { 3824 1:4, 3825 2:'our-secret2', 3826 -1:h'849b5786457c1491be3a76dcea6c4271' 3827 }, 3828 { 3829 1:4, 3830 2:'018c0ae5-4d9b-471b-bfd6-eef314bc7037', 3831 -1:h'849b57219dae48de646d07dbb533566e976686457c1491be3a76dcea6c4 3832 27188' 3833 } 3834 ] 3836 Acknowledgments 3838 This document is a product of the COSE working group of the IETF. 3840 The following individuals are to blame for getting me started on this 3841 project in the first place: Richard Barnes, Matt Miller, and Martin 3842 Thomson. 3844 The initial version of the specification was based to some degree on 3845 the outputs of the JOSE and S/MIME working groups. 3847 The following individuals provided input into the final form of the 3848 document: Carsten Bormann, John Bradley, Brain Campbell, Michael B. 3849 Jones, Ilari Liusvaara, Francesca Palombini, Ludwig Seitz, and Goran 3850 Selander. 3852 Author's Address 3854 Jim Schaad 3855 August Cellars 3857 Email: ietf@augustcellars.com