idnits 2.17.00 (12 Aug 2021) /tmp/idnits37981/draft-ietf-cose-countersign-00.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** There are 14 instances of too long lines in the document, the longest one being 5 characters in excess of 72. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == Line 792 has weird spacing: '...otected h'a10...' -- The document date (September 4, 2020) is 624 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) == Outdated reference: draft-ietf-cbor-7049bis has been published as RFC 8949 -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-cbor-7049bis' == Outdated reference: A later version (-12) exists of draft-ietf-cose-rfc8152bis-algs-11 ** Downref: Normative reference to an Informational draft: draft-ietf-cose-rfc8152bis-algs (ref. 'I-D.ietf-cose-rfc8152bis-algs') == Outdated reference: A later version (-06) exists of draft-ietf-core-groupcomm-bis-01 == Outdated reference: A later version (-15) exists of draft-ietf-cose-rfc8152bis-struct-12 Summary: 2 errors (**), 0 flaws (~~), 6 warnings (==), 2 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 Intended status: Standards Track September 4, 2020 5 Expires: March 8, 2021 7 CBOR Object Signing and Encryption (COSE): Countersignatures 8 draft-ietf-cose-countersign-00 10 Abstract 12 Concise Binary Object Representation (CBOR) is a data format designed 13 for small code size and small message size. CBOR Object Signing and 14 Encryption (COSE) defines a set of security services for CBOR. This 15 document defines a countersignature algorithm along with the needed 16 header parameters and CBOR tags for COSE. 18 Contributing to this document 20 This note is to be removed before publishing as an RFC. 22 The source for this draft is being maintained in GitHub. Suggested 23 changes should be submitted as pull requests at https://github.com/ 24 cose-wg/cose-rfc8152bis. Instructions are on that page as well. 25 Editorial changes can be managed in GitHub, but any substantial 26 issues need to be discussed on the COSE mailing list. 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at https://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on March 8, 2021. 45 Copyright Notice 47 Copyright (c) 2020 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 52 license-info) in effect on the date of publication of this document. 53 Please review these documents carefully, as they describe your rights 54 and restrictions with respect to this document. Code Components 55 extracted from this document must include Simplified BSD License text 56 as described in Section 4.e of the Trust Legal Provisions and are 57 provided without warranty as described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 62 1.1. Requirements Terminology . . . . . . . . . . . . . . . . 4 63 1.2. CBOR Grammar . . . . . . . . . . . . . . . . . . . . . . 4 64 1.3. Document Terminology . . . . . . . . . . . . . . . . . . 4 65 2. Countersignature Header Parameters . . . . . . . . . . . . . 5 66 3. Version 2 Countersignatures . . . . . . . . . . . . . . . . . 6 67 3.1. Full Countersignatures . . . . . . . . . . . . . . . . . 7 68 3.2. Abbreviated Countersignatures . . . . . . . . . . . . . . 8 69 3.3. Signing and Verification Process . . . . . . . . . . . . 8 70 4. CBOR Encoding Restrictions . . . . . . . . . . . . . . . . . 10 71 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 72 5.1. CBOR Tag Assignment . . . . . . . . . . . . . . . . . . . 10 73 5.2. COSE Header Parameters Registry . . . . . . . . . . . . . 11 74 6. Security Considerations . . . . . . . . . . . . . . . . . . . 11 75 7. Implementation Status . . . . . . . . . . . . . . . . . . . . 13 76 7.1. Author's Versions . . . . . . . . . . . . . . . . . . . . 14 77 7.2. COSE Testing Library . . . . . . . . . . . . . . . . . . 14 78 8. References . . . . . . . . . . . . . . . . . . . . . . . . . 15 79 8.1. Normative References . . . . . . . . . . . . . . . . . . 15 80 8.2. Informative References . . . . . . . . . . . . . . . . . 15 81 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 16 82 A.1. Examples of Signed Messages . . . . . . . . . . . . . . . 17 83 A.1.1. Countersignature . . . . . . . . . . . . . . . . . . 17 84 A.2. Examples of Enveloped Messages . . . . . . . . . . . . . 18 85 A.2.1. Countersignature on Encrypted Content . . . . . . . . 18 86 A.3. Examples of Encrypted Messages . . . . . . . . . . . . . 19 87 A.4. Examples of MACed Messages . . . . . . . . . . . . . . . 19 88 A.5. Examples of MAC0 Messages . . . . . . . . . . . . . . . . 20 89 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 20 90 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 20 92 1. Introduction 94 There has been an increased focus on small, constrained devices that 95 make up the Internet of Things (IoT). One of the standards that has 96 come out of this process is "Concise Binary Object Representation 97 (CBOR)" [I-D.ietf-cbor-7049bis]. CBOR extended the data model of the 98 JavaScript Object Notation (JSON) [STD90] by allowing for binary 99 data, among other changes. CBOR has been adopted by several of the 100 IETF working groups dealing with the IoT world as their encoding of 101 data structures. CBOR was designed specifically both to be small in 102 terms of messages transported and implementation size and to be a 103 schema-free decoder. A need exists to provide message security 104 services for IoT, and using CBOR as the message-encoding format makes 105 sense. 107 During the process of advancing COSE to an Internet Standard, it was 108 noticed the description of the security properties of 109 countersignatures was incorrect for the COSE_Sign1 structure. Since 110 the security properties that were described, those of a true 111 countersignature, were those that the working group desired, the 112 decision was made to remove all of the countersignature text from 113 [I-D.ietf-cose-rfc8152bis-struct] and create a new document to both 114 deprecate the old countersignature algorithm and to define a new one 115 with the desired security properties. 117 The problem with the previous countersignature algorithm was that the 118 cryptographically computed value was not always included. The 119 initial assumption that the cryptographic value was in the third slot 120 of the array was known not to be true at the time, but in the case of 121 the MAC structures this was not deemed to be an issue. The new 122 algorithm is more aggressive about the set of values included in the 123 countersignature computation so that the cryptographic computed 124 values is included. The exception to this is the COSE_Signature 125 structure where there is no cryptographic computed value. 127 The new algorithm is designed to produce the same countersignature 128 value in those cases where the cryptographic computed value was 129 already included. This means that for those structures the only 130 thing that would need to be done is to change the value of the header 131 parameter. 133 This document deprecates the existing pair of header parameters to 134 hold a countersignature value. This document defines two new header 135 parameters to hold countersignature values computed with the new 136 algorithm. This document defines a new countersignature computation 137 algorithm which always includes cryptographic computed values if they 138 exist. 140 1.1. Requirements Terminology 142 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 143 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 144 "OPTIONAL" in this document are to be interpreted as described in BCP 145 14 [RFC2119] [RFC8174] when, and only when, they appear in all 146 capitals, as shown here. 148 1.2. CBOR Grammar 150 CBOR grammar in the document is presented using CBOR Data Definition 151 Language (CDDL) [RFC8610]. 153 The collected CDDL can be extracted from the XML version of this 154 document via the following XPath expression below. (Depending on the 155 XPath evaluator one is using, it may be necessary to deal with > 156 as an entity.) 158 //sourcecode[@type='CDDL']/text() 160 CDDL expects the initial non-terminal symbol to be the first symbol 161 in the file. For this reason, the first fragment of CDDL is 162 presented here. 164 start = COSE_Countersignature_Tagged / Internal_Types 166 ; This is defined to make the tool quieter: 167 Internal_Types = Countersign_structure / COSE_Countersignature0 169 The non-terminal Internal_Types is defined for dealing with the 170 automated validation tools used during the writing of this document. 171 It references those non-terminals that are used for security 172 computations but are not emitted for transport. 174 1.3. Document Terminology 176 In this document, we use the following terminology: 178 Byte is a synonym for octet. 180 Constrained Application Protocol (CoAP) is a specialized web transfer 181 protocol for use in constrained systems. It is defined in [RFC7252]. 183 Context is used throughout the document to represent information that 184 is not part of the COSE message. Information which is part of the 185 context can come from several different sources including: Protocol 186 interactions, associated key structures, and program configuration. 187 The context to use can be implicit, identified using the 'kid 188 context' header parameter defined in [RFC8613], or identified by a 189 protocol-specific identifier. Context should generally be included 190 in the cryptographic construction; for more details see Section 4.3 191 of [I-D.ietf-cose-rfc8152bis-struct]. 193 The term 'byte string' is used for sequences of bytes, while the term 194 'text string' is used for sequences of characters. 196 2. Countersignature Header Parameters 198 This section defines a set of common header parameters. A summary of 199 these header parameters can be found in Table 1. This table should 200 be consulted to determine the value of label and the type of the 201 value. 203 The set of header parameters defined in this section are: 205 V2 countersignature: This header parameter holds one or more 206 countersignature values. Countersignatures provide a method of 207 having a second party sign some data. The countersignature header 208 parameter can occur as an unprotected attribute in any of the 209 following structures: COSE_Sign1, COSE_Signature, COSE_Encrypt, 210 COSE_recipient, COSE_Encrypt0, COSE_Mac, and COSE_Mac0. Details 211 on version 2 countersignatures are found in Section 3. 213 +===========+=====+========================+==========+=============+ 214 | Name |Label| Value Type | Value | Description | 215 | | | | Registry | | 216 +===========+=====+========================+==========+=============+ 217 | counter |TBD10|COSE_Countersignature / | | V2 counter | 218 | signature | |[+ COSE_Countersignature| | signature | 219 | version 2 | | ] | | attribute | 220 +-----------+-----+------------------------+----------+-------------+ 221 | counter |TBD11| COSE_Countersignature0 | | Abbreviated | 222 |signature 0| | | | Counter | 223 | version 2 | | | | signature | 224 | | | | | vesion 2 | 225 +-----------+-----+------------------------+----------+-------------+ 227 Table 1: Common Header Parameters 229 The CDDL fragment that represents the set of header parameters 230 defined in this section is given below. Each of the header 231 parameters is tagged as optional because they do not need to be in 232 every map; header parameters required in specific maps are discussed 233 above. 235 Generic_Headers /= ( 236 ? TBD10 => COSE_Countersignature / [+COSE_Countersignature] 237 ; V2 Countersignature 238 ? TBD11 => COSE_Countersignature0 ; V2 Countersignature0 239 ) 241 3. Version 2 Countersignatures 243 A countersignature is normally defined as a second signature that 244 confirms a primary signature. A normal example of a countersignature 245 is the signature that a notary public places on a document as 246 witnessing that you have signed the document. Thus applying a 247 countersignature to either the COSE_Signature or COSE_Sign1 objects 248 match this traditional definition. This document extends the context 249 of a countersignature to allow it to be applied to all of the 250 security structures defined. It needs to be noted that the 251 countersignature needs to be treated as a separate operation from the 252 initial operation even if it is applied by the same user as is done 253 in [I-D.ietf-core-groupcomm-bis]. 255 COSE supports two different forms for countersignatures. Full 256 countersignatures use the structure COSE_Countersignature. This is 257 same structure as COSE_Signature and thus it can have protected and 258 unprotected attributes, including chained countersignatures. 259 Abbreviated countersignatures use the structure 260 COSE_Countersignature0. This structure only contains the signature 261 value and nothing else. The structures cannot be converted between 262 each other; as the signature computation includes a parameter 263 identifying which structure is being used, the converted structure 264 will fail signature validation. 266 The version 2 countersignature changes the algorithm used for 267 computing the signature from the original version Section 4.5 of 268 [RFC8152]. The new version now includes the cryptographic material 269 generated for all of the structures rather than just for a subset. 271 COSE was designed for uniformity in how the data structures are 272 specified. One result of this is that for COSE one can expand the 273 concept of countersignatures beyond just the idea of signing a 274 signature to being able to sign most of the structures without having 275 to create a new signing layer. When creating a countersignature, one 276 needs to be clear about the security properties that result. When 277 done on a COSE_Signature or COSE_Sign1, the normal countersignature 278 semantics are preserved. That is the countersignature makes a 279 statement about the existence of a signature and, when used as a 280 timestamp, a time point at which the signature exists. When done on 281 a COSE_Sign, this is the same as applying a second signature to the 282 payload and adding a parallel signature as a new COSE_Signature is 283 the preferred method. When done on a COSE_Mac or COSE_Mac0, the 284 payload is included as well as the MAC value. When done on a 285 COSE_Encrypt or COSE_Encrypt0, the existence of the encrypted data is 286 attested to. It should be noted that there is a big difference 287 between attesting to the encrypted data as opposed to attesting to 288 the unencrypted data. If the latter is what is desired, then one 289 needs to apply a signature to the data and then encrypt that. It is 290 always possible to construct cases where the use of two different 291 keys will appear to result in a successful decryption (the tag check 292 success), but which produce two completely different plaintexts. 293 This situation is not detectable by a countersignature on the 294 encrypted data. 296 3.1. Full Countersignatures 298 The COSE_Countersignature structure allows for the same set of 299 capabilities as a COSE_Signature. This means that all of the 300 capabilities of a signature are duplicated with this structure. 301 Specifically, the countersigner does not need to be related to the 302 producer of what is being countersigned as key and algorithm 303 identification can be placed in the countersignature attributes. 304 This also means that the countersignature can itself be 305 countersigned. This is a feature required by protocols such as long- 306 term archiving services. More information on how countersignatures 307 is used can be found in the evidence record syntax described in 308 [RFC4998]. 310 The full countersignature structure can be encoded as either tagged 311 or untagged depending on the context it is used in. A tagged 312 COSE_Countersignature structure is identified by the CBOR tag TBD0. 313 The countersignature structure is the same as that used for a signer 314 on a signed object. The CDDL fragment for full countersignatures is: 316 COSE_Countersignature_Tagged = #6.9999(COSE_Countersignature) 317 COSE_Countersignature = COSE_Signature 319 The details of the fields of a countersignature can be found in 320 Section 4.1 of [I-D.ietf-cose-rfc8152bis-struct]. 322 An example of a countersignature on a signature can be found in 323 Appendix A.1.1. An example of a countersignature in an encryption 324 object can be found in Appendix A.2.1. 326 It should be noted that only a signature algorithm with appendix (see 327 Section 8 of [I-D.ietf-cose-rfc8152bis-struct]) can be used for 328 countersignatures. This is because the body should be able to be 329 processed without having to evaluate the countersignature, and this 330 is not possible for signature schemes with message recovery. 332 3.2. Abbreviated Countersignatures 334 Abbreviated countersignatures were designed primarily to deal with 335 the problem of encrypted group messaging, but where it is required to 336 know who originated the message. The objective was to keep the 337 countersignature as small as possible while still providing the 338 needed security. For abbreviated countersignatures, there is no 339 provision for any protected attributes related to the signing 340 operation. Instead, the parameters for computing or verifying the 341 abbreviated countersignature are provided by the same context used to 342 describe the encryption, signature, or MAC processing. 344 The CDDL fragment for the abbreviated countersignatures is: 346 COSE_Countersignature0 = bstr 348 The byte string representing the signature value is placed in the 349 Countersignature0 attribute. This attribute is then encoded as an 350 unprotected header parameter. The attribute is defined below. 352 3.3. Signing and Verification Process 354 In order to create a signature, a well-defined byte string is needed. 355 The Countersign_structure is used to create the canonical form. This 356 signing and verification process takes in countersignature target 357 structure, the signer information (COSE_Signature), and the 358 application data (external source). A Countersign_structure is a 359 CBOR array. The target structure of the countersignature needs to 360 have all of it's cryptographic functions finalized before the 361 computing the signature. The fields of the Countersign_structure in 362 order are: 364 1. A context text string identifying the context of the signature. 365 The context text string is: 367 "CounterSignature" for signatures using the 368 COSE_Countersignature structure when other_fields is absent. 370 "CounterSignature0" for signatures using the 371 COSE_Countersignature0 structure when other_fields is absent. 373 "CounterSignatureV2" for signatures using the 374 COSE_Countersignature structure when other_fields is present. 376 "CounterSignature0V2" for signatures using the 377 COSE_Countersignature0 structure when other_fields is present. 379 2. The protected attributes from the target structure encoded in a 380 bstr type. If there are no protected attributes, a zero-length 381 byte string is used. 383 3. The protected attributes from the signer structure encoded in a 384 bstr type. If there are no protected attributes, a zero-length 385 byte string is used. This field is omitted for the 386 Countersignature0V2 attribute. 388 4. The externally supplied data from the application encoded in a 389 bstr type. If this field is not supplied, it defaults to a zero- 390 length byte string. (See Section 4.3 of 391 [I-D.ietf-cose-rfc8152bis-struct] for application guidance on 392 constructing this field.) 394 5. The payload to be signed encoded in a bstr type. The payload is 395 placed here independent of how it is transported. 397 6. If there are only two bstr fields in the target structure, this 398 field is omitted. The field is an array of all bstr fields after 399 the second. As an example, this would be an array of one element 400 for the COSE_Sign1 structure containing the signature value. 402 The CDDL fragment that describes the above text is: 404 Countersign_structure = [ 405 context : "CounterSignature" / "CounterSignature0" / 406 "CounterSignatureV2" / "CounterSignature0V2" /, 407 body_protected : empty_or_serialized_map, 408 ? sign_protected : empty_or_serialized_map, 409 external_aad : bstr, 410 payload : bstr, 411 ? other_fields : [ + bstr ] 412 ] 414 How to compute a countersignature: 416 1. Create a Countersign_structure and populate it with the 417 appropriate fields. 419 2. Create the value ToBeSigned by encoding the Countersign_structure 420 to a byte string, using the encoding described in Section 4. 422 3. Call the signature creation algorithm passing in K (the key to 423 sign with), alg (the algorithm to sign with), and ToBeSigned (the 424 value to sign). 426 4. Place the resulting signature value in the correct location. 427 This is the 'signature' field of the COSE_Countersignature 428 structure. This is the value of the Countersignature0 attribute. 430 The steps for verifying a countersignature are: 432 1. Create a Countersign_structure and populate it with the 433 appropriate fields. 435 2. Create the value ToBeSigned by encoding the Countersign_structure 436 to a byte string, using the encoding described in Section 4. 438 3. Call the signature verification algorithm passing in K (the key 439 to verify with), alg (the algorithm used sign with), ToBeSigned 440 (the value to sign), and sig (the signature to be verified). 442 In addition to performing the signature verification, the application 443 performs the appropriate checks to ensure that the key is correctly 444 paired with the signing identity and that the signing identity is 445 authorized before performing actions. 447 4. CBOR Encoding Restrictions 449 In order to always regenerate the same byte string for the "to be 450 signed" value, the deterministic encoding rules defined in 451 Section 4.2 of [I-D.ietf-cbor-7049bis]. These rules match the ones 452 laid out in Section 11 of [I-D.ietf-cose-rfc8152bis-struct]. 454 5. IANA Considerations 456 The registries and registrations listed below were created during 457 processing of RFC 8152 [RFC8152]. The majority of the actions are to 458 update the references to point to this document. 460 5.1. CBOR Tag Assignment 462 IANA is requested to register a new tag for the CounterSignature 463 type. 465 * Tag: TBD0 467 * Data Item: COSE_Countersignature 469 * Semantics: COSE standalone V2 countersignature 471 * Reference: [[this document]] 473 5.2. COSE Header Parameters Registry 475 IANA created a registry titled "COSE Header Parameters" as part of 476 processing [RFC8152]. 478 IANA is requested to register the following new items in the 479 registry. 481 +=================+=====+======================+========+================+ 482 | Name |Label| Value Type | Value | Description | 483 | | | |Registry| | 484 +=================+=====+======================+========+================+ 485 |counter signature|TBD10|COSE_Countersignature | | V2 | 486 | version 2 | | / [+ | |countersignature| 487 | | |COSE_Countersignature | | attribute | 488 | | | ] | | | 489 +-----------------+-----+----------------------+--------+----------------+ 490 |Countersignature0|TBD11|COSE_Countersignature0| | Abbreviated | 491 | version 2 | | | | Counter | 492 | | | | |signature vesion| 493 | | | | | 2 | 494 +-----------------+-----+----------------------+--------+----------------+ 496 Table 2: New Common Header Parameters 498 IANA is requested to modify the Description field for "counter 499 signature" and "CounterSignature0" to include the words "(Deprecated 500 by [[This Document]]". 502 6. Security Considerations 504 TODO - review and trim as needed. 506 There are a number of security considerations that need to be taken 507 into account by implementers of this specification. While some 508 considerations have been highlighted here, additional considerations 509 may be found in the documents listed in the references. 511 Implementations need to protect the private key material for any 512 individuals. There are some cases that need to be highlighted on 513 this issue. 515 * Using the same key for two different algorithms can leak 516 information about the key. It is therefore recommended that keys 517 be restricted to a single algorithm. 519 * Use of 'direct' as a recipient algorithm combined with a second 520 recipient algorithm exposes the direct key to the second 521 recipient. 523 * Several of the algorithms in [I-D.ietf-cose-rfc8152bis-algs] have 524 limits on the number of times that a key can be used without 525 leaking information about the key. 527 The use of ECDH and direct plus KDF (with no key wrap) will not 528 directly lead to the private key being leaked; the one way function 529 of the KDF will prevent that. There is, however, a different issue 530 that needs to be addressed. Having two recipients requires that the 531 CEK be shared between two recipients. The second recipient therefore 532 has a CEK that was derived from material that can be used for the 533 weak proof of origin. The second recipient could create a message 534 using the same CEK and send it to the first recipient; the first 535 recipient would, for either static-static ECDH or direct plus KDF, 536 make an assumption that the CEK could be used for proof of origin 537 even though it is from the wrong entity. If the key wrap step is 538 added, then no proof of origin is implied and this is not an issue. 540 Although it has been mentioned before, the use of a single key for 541 multiple algorithms has been demonstrated in some cases to leak 542 information about that key, provide the opportunity for attackers to 543 forge integrity tags, or gain information about encrypted content. 544 Binding a key to a single algorithm prevents these problems. Key 545 creators and key consumers are strongly encouraged not only to create 546 new keys for each different algorithm, but to include that selection 547 of algorithm in any distribution of key material and strictly enforce 548 the matching of algorithms in the key structure to algorithms in the 549 message structure. In addition to checking that algorithms are 550 correct, the key form needs to be checked as well. Do not use an 551 'EC2' key where an 'OKP' key is expected. 553 Before using a key for transmission, or before acting on information 554 received, a trust decision on a key needs to be made. Is the data or 555 action something that the entity associated with the key has a right 556 to see or a right to request? A number of factors are associated 557 with this trust decision. Some of the ones that are highlighted here 558 are: 560 * What are the permissions associated with the key owner? 562 * Is the cryptographic algorithm acceptable in the current context? 564 * Have the restrictions associated with the key, such as algorithm 565 or freshness, been checked and are they correct? 567 * Is the request something that is reasonable, given the current 568 state of the application? 570 * Have any security considerations that are part of the message been 571 enforced (as specified by the application or 'crit' header 572 parameter)? 574 One area that has been getting exposure is traffic analysis of 575 encrypted messages based on the length of the message. This 576 specification does not provide for a uniform method of providing 577 padding as part of the message structure. An observer can 578 distinguish between two different messages (for example, 'YES' and 579 'NO') based on the length for all of the content encryption 580 algorithms that are defined in [I-D.ietf-cose-rfc8152bis-algs] 581 document. This means that it is up to the applications to document 582 how content padding is to be done in order to prevent or discourage 583 such analysis. (For example, the text strings could be defined as 584 'YES' and 'NO '.) 586 7. Implementation Status 588 This section is to be removed before publishing as an RFC. 590 This section records the status of known implementations of the 591 protocol defined by this specification at the time of posting of this 592 Internet-Draft, and is based on a proposal described in [RFC7942]. 593 The description of implementations in this section is intended to 594 assist the IETF in its decision processes in progressing drafts to 595 RFCs. Please note that the listing of any individual implementation 596 here does not imply endorsement by the IETF. Furthermore, no effort 597 has been spent to verify the information presented here that was 598 supplied by IETF contributors. This is not intended as, and must not 599 be construed to be, a catalog of available implementations or their 600 features. Readers are advised to note that other implementations may 601 exist. 603 According to [RFC7942], "this will allow reviewers and working groups 604 to assign due consideration to documents that have the benefit of 605 running code, which may serve as evidence of valuable experimentation 606 and feedback that have made the implemented protocols more mature. 607 It is up to the individual working groups to use this information as 608 they see fit". 610 7.1. Author's Versions 612 There are three different implementations that have been created by 613 the author of the document both to create the examples that are 614 included in the document and to validate the structures and 615 methodology used in the design of COSE. 617 * Implementation Location: https://github.com/cose-wg 619 * Primary Maintainer: Jim Schaad 621 * Languages: There are three different languages that are currently 622 supported: Java and C#. 624 * Cryptography: The Java and C# libraries use Bouncy Castle to 625 provide the required cryptography. 627 * Coverage: Both implementations can produce and consume both the 628 old and new countersignatures. 630 * Testing: All of the examples in the example library are generated 631 by the C# library and then validated using the Java and C 632 libraries. Both libraries have tests to allow for the creating of 633 the same messages that are in the example library followed by 634 validating them. These are not compared against the example 635 library. The Java and C# libraries have unit testing included. 636 Not all of the MUST statements in the document have been 637 implemented as part of the libraries. One such statement is the 638 requirement that unique labels be present. 640 * Licensing: Revised BSD License 642 7.2. COSE Testing Library 644 * Implementation Location: https://github.com/cose-wg/Examples 646 * Primary Maintainer: Jim Schaad 648 * Description: A set of tests for the COSE library is provided as 649 part of the implementation effort. Both success and fail tests 650 have been provided. All of the examples in this document are part 651 of this example set. 653 * Coverage: An attempt has been made to have test cases for every 654 message type and algorithm in the document. Currently examples 655 dealing with countersignatures, and ECDH with Curve25519 and 656 Goldilocks are missing. 658 * Licensing: Public Domain 660 8. References 662 8.1. Normative References 664 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 665 Requirement Levels", BCP 14, RFC 2119, 666 DOI 10.17487/RFC2119, March 1997, 667 . 669 [I-D.ietf-cbor-7049bis] 670 Bormann, C. and P. Hoffman, "Concise Binary Object 671 Representation (CBOR)", Work in Progress, Internet-Draft, 672 draft-ietf-cbor-7049bis-14, June 16, 2020, 673 . 675 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 676 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 677 May 2017, . 679 [I-D.ietf-cose-rfc8152bis-algs] 680 Schaad, J., "CBOR Object Signing and Encryption (COSE): 681 Initial Algorithms", Work in Progress, Internet-Draft, 682 draft-ietf-cose-rfc8152bis-algs-11, July 1, 2020, 683 . 686 8.2. Informative References 688 [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data 689 Definition Language (CDDL): A Notational Convention to 690 Express Concise Binary Object Representation (CBOR) and 691 JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, 692 June 2019, . 694 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 695 RFC 8152, DOI 10.17487/RFC8152, July 2017, 696 . 698 [STD90] Bray, T., Ed., "The JavaScript Object Notation (JSON) Data 699 Interchange Format", STD 90, RFC 8259, December 2017. 701 703 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 704 Application Protocol (CoAP)", RFC 7252, 705 DOI 10.17487/RFC7252, June 2014, 706 . 708 [RFC7942] Sheffer, Y. and A. Farrel, "Improving Awareness of Running 709 Code: The Implementation Status Section", BCP 205, 710 RFC 7942, DOI 10.17487/RFC7942, July 2016, 711 . 713 [RFC4998] Gondrom, T., Brandner, R., and U. Pordesch, "Evidence 714 Record Syntax (ERS)", RFC 4998, DOI 10.17487/RFC4998, 715 August 2007, . 717 [I-D.ietf-core-groupcomm-bis] 718 Dijk, E., Wang, C., and M. Tiloca, "Group Communication 719 for the Constrained Application Protocol (CoAP)", Work in 720 Progress, Internet-Draft, draft-ietf-core-groupcomm-bis- 721 01, July 13, 2020, . 724 [I-D.ietf-cose-rfc8152bis-struct] 725 Schaad, J., "CBOR Object Signing and Encryption (COSE): 726 Structures and Process", Work in Progress, Internet-Draft, 727 draft-ietf-cose-rfc8152bis-struct-12, August 24, 2020, 728 . 731 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 732 "Object Security for Constrained RESTful Environments 733 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 734 . 736 Appendix A. Examples 738 This appendix includes a set of examples that show the different 739 features and message types that have been defined in this document. 740 To make the examples easier to read, they are presented using the 741 extended CBOR diagnostic notation (defined in [RFC8610]) rather than 742 as a binary dump. 744 A GitHub project has been created at that contains not only the examples presented in this 746 document, but a more complete set of testing examples as well. Each 747 example is found in a JSON file that contains the inputs used to 748 create the example, some of the intermediate values that can be used 749 in debugging the example and the output of the example presented both 750 as a hex dump and in CBOR diagnostic notation format. Some of the 751 examples at the site are designed failure testing cases; these are 752 clearly marked as such in the JSON file. If errors in the examples 753 in this document are found, the examples on GitHub will be updated, 754 and a note to that effect will be placed in the JSON file. 756 As noted, the examples are presented using the CBOR's diagnostic 757 notation. A Ruby-based tool exists that can convert between the 758 diagnostic notation and binary. This tool can be installed with the 759 command line: 761 gem install cbor-diag 763 The diagnostic notation can be converted into binary files using the 764 following command line: 766 diag2cbor.rb < inputfile > outputfile 768 The examples can be extracted from the XML version of this document 769 via an XPath expression as all of the sourcecode is tagged with the 770 attribute type='CBORdiag'. (Depending on the XPath evaluator one is 771 using, it may be necessary to deal with > as an entity.) 773 //sourcecode[@type='CDDL']/text() 775 A.1. Examples of Signed Messages 777 A.1.1. Countersignature 779 This example uses the following: 781 * Signature Algorithm: ECDSA w/ SHA-256, Curve P-256 783 * The same header parameters are used for both the signature and the 784 countersignature. 786 Size of binary file is 180 bytes 787 98( 788 [ 789 / protected / h'', 790 / unprotected / { 791 / countersign / 7:[ 792 / protected h'a10126' / << { 793 / alg / 1:-7 / ECDSA 256 / 794 } >>, 795 / unprotected / { 796 / kid / 4:'11' 797 }, 798 / signature / h'5ac05e289d5d0e1b0a7f048a5d2b643813ded50bc9e4 799 9220f4f7278f85f19d4a77d655c9d3b51e805a74b099e1e085aacd97fc29d72f887e 800 8802bb6650cceb2c' 801 ] 802 }, 803 / payload / 'This is the content.', 804 / signatures / [ 805 [ 806 / protected h'a10126' / << { 807 / alg / 1:-7 / ECDSA 256 / 808 } >>, 809 / unprotected / { 810 / kid / 4:'11' 811 }, 812 / signature / h'e2aeafd40d69d19dfe6e52077c5d7ff4e408282cbefb 813 5d06cbf414af2e19d982ac45ac98b8544c908b4507de1e90b717c3d34816fe926a2b 814 98f53afd2fa0f30a' 815 ] 816 ] 817 ] 818 ) 820 A.2. Examples of Enveloped Messages 822 A.2.1. Countersignature on Encrypted Content 824 This example uses the following: 826 * CEK: AES-GCM w/ 128-bit key 828 * Recipient class: ECDH Ephemeral-Static, Curve P-256 830 Size of binary file is 326 bytes 831 96( 832 [ 833 / protected h'a10101' / << { 834 / alg / 1:1 / AES-GCM 128 / 835 } >>, 836 / unprotected / { 837 / iv / 5:h'c9cf4df2fe6c632bf7886413', 838 / countersign / 7:[ 839 / protected / h'a1013823' / { 840 \ alg \ 1:-36 841 } / , 842 / unprotected / { 843 / kid / 4:'bilbo.baggins@hobbiton.example' 844 }, 845 / signature / h'00929663c8789bb28177ae28467e66377da12302d7f9 846 594d2999afa5dfa531294f8896f2b6cdf1740014f4c7f1a358e3a6cf57f4ed6fb02f 847 cf8f7aa989f5dfd07f0700a3a7d8f3c604ba70fa9411bd10c2591b483e1d2c31de00 848 3183e434d8fba18f17a4c7e3dfa003ac1cf3d30d44d2533c4989d3ac38c38b71481c 849 c3430c9d65e7ddff' 850 ] 851 }, 852 / ciphertext / h'7adbe2709ca818fb415f1e5df66f4e1a51053ba6d65a1a0 853 c52a357da7a644b8070a151b0', 854 / recipients / [ 855 [ 856 / protected h'a1013818' / << { 857 / alg / 1:-25 / ECDH-ES + HKDF-256 / 858 } >> , 859 / unprotected / { 860 / ephemeral / -1:{ 861 / kty / 1:2, 862 / crv / -1:1, 863 / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbf 864 bf054e1c7b4d91d6280', 865 / y / -3:true 866 }, 867 / kid / 4:'meriadoc.brandybuck@buckland.example' 868 }, 869 / ciphertext / h'' 870 ] 871 ] 872 ] 873 ) 875 A.3. Examples of Encrypted Messages 877 A.4. Examples of MACed Messages 878 A.5. Examples of MAC0 Messages 880 Acknowledgments 882 This document is a product of the COSE working group of the IETF. 884 The initial version of the specification was based to some degree on 885 the outputs of the JOSE and S/MIME working groups. 887 Author's Address 889 Jim Schaad 890 August Cellars 892 Email: ietf@augustcellars.com