idnits 2.17.1 draft-ietf-ace-cbor-web-token-15.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 : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (March 19, 2018) is 2228 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) ** Obsolete normative reference: RFC 8152 (Obsoleted by RFC 9052, RFC 9053) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 ACE Working Group M. Jones 3 Internet-Draft Microsoft 4 Intended status: Standards Track E. Wahlstroem 5 Expires: September 20, 2018 6 S. Erdtman 7 Spotify AB 8 H. Tschofenig 9 ARM Ltd. 10 March 19, 2018 12 CBOR Web Token (CWT) 13 draft-ietf-ace-cbor-web-token-15 15 Abstract 17 CBOR Web Token (CWT) is a compact means of representing claims to be 18 transferred between two parties. The claims in a CWT are encoded in 19 the Concise Binary Object Representation (CBOR) and CBOR Object 20 Signing and Encryption (COSE) is used for added application layer 21 security protection. A claim is a piece of information asserted 22 about a subject and is represented as a name/value pair consisting of 23 a claim name and a claim value. CWT is derived from JSON Web Token 24 (JWT) but uses CBOR rather than JSON. 26 Status of This Memo 28 This Internet-Draft is submitted in full conformance with the 29 provisions of BCP 78 and BCP 79. 31 Internet-Drafts are working documents of the Internet Engineering 32 Task Force (IETF). Note that other groups may also distribute 33 working documents as Internet-Drafts. The list of current Internet- 34 Drafts is at https://datatracker.ietf.org/drafts/current/. 36 Internet-Drafts are draft documents valid for a maximum of six months 37 and may be updated, replaced, or obsoleted by other documents at any 38 time. It is inappropriate to use Internet-Drafts as reference 39 material or to cite them other than as "work in progress." 41 This Internet-Draft will expire on September 20, 2018. 43 Copyright Notice 45 Copyright (c) 2018 IETF Trust and the persons identified as the 46 document authors. All rights reserved. 48 This document is subject to BCP 78 and the IETF Trust's Legal 49 Provisions Relating to IETF Documents 50 (https://trustee.ietf.org/license-info) in effect on the date of 51 publication of this document. Please review these documents 52 carefully, as they describe your rights and restrictions with respect 53 to this document. Code Components extracted from this document must 54 include Simplified BSD License text as described in Section 4.e of 55 the Trust Legal Provisions and are provided without warranty as 56 described in the Simplified BSD License. 58 Table of Contents 60 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 61 1.1. CBOR Related Terminology . . . . . . . . . . . . . . . . 3 62 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 63 3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 64 3.1. Registered Claims . . . . . . . . . . . . . . . . . . . . 5 65 3.1.1. iss (Issuer) Claim . . . . . . . . . . . . . . . . . 5 66 3.1.2. sub (Subject) Claim . . . . . . . . . . . . . . . . . 5 67 3.1.3. aud (Audience) Claim . . . . . . . . . . . . . . . . 5 68 3.1.4. exp (Expiration Time) Claim . . . . . . . . . . . . . 5 69 3.1.5. nbf (Not Before) Claim . . . . . . . . . . . . . . . 5 70 3.1.6. iat (Issued At) Claim . . . . . . . . . . . . . . . . 6 71 3.1.7. cti (CWT ID) Claim . . . . . . . . . . . . . . . . . 6 72 4. Summary of the claim names, keys, and value types . . . . . . 6 73 5. CBOR Tags and Claim Values . . . . . . . . . . . . . . . . . 6 74 6. CWT CBOR Tag . . . . . . . . . . . . . . . . . . . . . . . . 6 75 7. Creating and Validating CWTs . . . . . . . . . . . . . . . . 7 76 7.1. Creating a CWT . . . . . . . . . . . . . . . . . . . . . 7 77 7.2. Validating a CWT . . . . . . . . . . . . . . . . . . . . 8 78 8. Security Considerations . . . . . . . . . . . . . . . . . . . 9 79 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 80 9.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 10 81 9.1.1. Registration Template . . . . . . . . . . . . . . . . 11 82 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 11 83 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 13 84 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 13 85 9.3. CoAP Content-Formats Registration . . . . . . . . . . . . 14 86 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 14 87 9.4. CBOR Tag registration . . . . . . . . . . . . . . . . . . 14 88 9.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 14 89 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 14 90 10.1. Normative References . . . . . . . . . . . . . . . . . . 14 91 10.2. Informative References . . . . . . . . . . . . . . . . . 15 92 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 16 93 A.1. Example CWT Claims Set . . . . . . . . . . . . . . . . . 16 94 A.2. Example keys . . . . . . . . . . . . . . . . . . . . . . 16 95 A.2.1. 128-bit Symmetric Key . . . . . . . . . . . . . . . . 17 96 A.2.2. 256-bit Symmetric Key . . . . . . . . . . . . . . . . 17 97 A.2.3. ECDSA P-256 256-bit COSE Key . . . . . . . . . . . . 17 98 A.3. Example Signed CWT . . . . . . . . . . . . . . . . . . . 18 99 A.4. Example MACed CWT . . . . . . . . . . . . . . . . . . . . 19 100 A.5. Example Encrypted CWT . . . . . . . . . . . . . . . . . . 20 101 A.6. Example Nested CWT . . . . . . . . . . . . . . . . . . . 21 102 A.7. Example MACed CWT with a floating-point value . . . . . . 22 103 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 23 104 Appendix C. Document History . . . . . . . . . . . . . . . . . . 23 105 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 27 107 1. Introduction 109 The JSON Web Token (JWT) [RFC7519] is a standardized security token 110 format that has found use in OAuth 2.0 and OpenID Connect 111 deployments, among other applications. JWT uses JSON Web Signature 112 (JWS) [RFC7515] and JSON Web Encryption (JWE) [RFC7516] to secure the 113 contents of the JWT, which is a set of claims represented in JSON. 114 The use of JSON for encoding information is popular for Web and 115 native applications, but it is considered inefficient for some 116 Internet of Things (IoT) systems that use low power radio 117 technologies. 119 An alternative encoding of claims is defined in this document. 120 Instead of using JSON, as provided by JWTs, this specification uses 121 CBOR [RFC7049] and calls this new structure "CBOR Web Token (CWT)", 122 which is a compact means of representing secured claims to be 123 transferred between two parties. CWT is closely related to JWT. It 124 references the JWT claims and both its name and pronunciation are 125 derived from JWT. To protect the claims contained in CWTs, the CBOR 126 Object Signing and Encryption (COSE) [RFC8152] specification is used. 128 The suggested pronunciation of CWT is the same as the English word 129 "cot". 131 1.1. CBOR Related Terminology 133 In JSON, maps are called objects and only have one kind of map key: a 134 string. CBOR uses strings, negative integers, and unsigned integers 135 as map keys. The integers are used for compactness of encoding and 136 easy comparison. The inclusion of strings allows for an additional 137 range of short encoded values to be used. 139 2. Terminology 141 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 142 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 143 "OPTIONAL" in this document are to be interpreted as described in BCP 144 14 [RFC2119] [RFC8174] when, and only when, they appear in all 145 capitals, as shown here. 147 This document reuses terminology from JWT [RFC7519] and COSE 148 [RFC8152]. 150 StringOrURI 151 The "StringOrURI" term in this specification has the same meaning 152 and processing rules as the JWT "StringOrURI" term defined in 153 Section 2 of [RFC7519], except that it is represented as a CBOR 154 text string instead of a JSON text string. 156 NumericDate 157 The "NumericDate" term in this specification has the same meaning 158 and processing rules as the JWT "NumericDate" term defined in 159 Section 2 of [RFC7519], except that it is represented as a CBOR 160 numeric date (from Section 2.4.1 of [RFC7049]) instead of a JSON 161 number. The encoding is modified so that the leading tag 1 162 (epoch-based date/time) MUST be omitted. 164 Claim Name 165 The human-readable name used to identify a claim. 167 Claim Key 168 The CBOR map key used to identify a claim. 170 Claim Value 171 The CBOR map value representing the value of the claim. 173 CWT Claims Set 174 The CBOR map that contains the claims conveyed by the CWT. 176 3. Claims 178 The set of claims that a CWT must contain to be considered valid is 179 context dependent and is outside the scope of this specification. 180 Specific applications of CWTs will require implementations to 181 understand and process some claims in particular ways. However, in 182 the absence of such requirements, all claims that are not understood 183 by implementations MUST be ignored. 185 To keep CWTs as small as possible, the Claim Keys are represented 186 using integers or text strings. Section 4 summarizes all keys used 187 to identify the claims defined in this document. 189 3.1. Registered Claims 191 None of the claims defined below are intended to be mandatory to use 192 or implement. They rather provide a starting point for a set of 193 useful, interoperable claims. Applications using CWTs should define 194 which specific claims they use and when they are required or 195 optional. 197 3.1.1. iss (Issuer) Claim 199 The "iss" (issuer) claim has the same meaning and processing rules as 200 the "iss" claim defined in Section 4.1.1 of [RFC7519], except that 201 the value is a StringOrURI, as defined in Section 2 of this 202 specification. The Claim Key 1 is used to identify this claim. 204 3.1.2. sub (Subject) Claim 206 The "sub" (subject) claim has the same meaning and processing rules 207 as the "sub" claim defined in Section 4.1.2 of [RFC7519], except that 208 the value is a StringOrURI, as defined in Section 2 of this 209 specification. The Claim Key 2 is used to identify this claim. 211 3.1.3. aud (Audience) Claim 213 The "aud" (audience) claim has the same meaning and processing rules 214 as the "aud" claim defined in Section 4.1.3 of [RFC7519], except that 215 the value of the audience claim is a StringOrURI when it is not an 216 array or each of the audience array element values is a StringOrURI 217 when the audience claim value is an array. (StringOrURI is defined 218 in Section 2 of this specification.) The Claim Key 3 is used to 219 identify this claim. 221 3.1.4. exp (Expiration Time) Claim 223 The "exp" (expiration time) claim has the same meaning and processing 224 rules as the "exp" claim defined in Section 4.1.4 of [RFC7519], 225 except that the value is a NumericDate, as defined in Section 2 of 226 this specification. The Claim Key 4 is used to identify this claim. 228 3.1.5. nbf (Not Before) Claim 230 The "nbf" (not before) claim has the same meaning and processing 231 rules as the "nbf" claim defined in Section 4.1.5 of [RFC7519], 232 except that the value is a NumericDate, as defined in Section 2 of 233 this specification. The Claim Key 5 is used to identify this claim. 235 3.1.6. iat (Issued At) Claim 237 The "iat" (issued at) claim has the same meaning and processing rules 238 as the "iat" claim defined in Section 4.1.6 of [RFC7519], except that 239 the value is a NumericDate, as defined in Section 2 of this 240 specification. The Claim Key 6 is used to identify this claim. 242 3.1.7. cti (CWT ID) Claim 244 The "cti" (CWT ID) claim has the same meaning and processing rules as 245 the "jti" claim defined in Section 4.1.7 of [RFC7519], except that 246 the value is a byte string. The Claim Key 7 is used to identify this 247 claim. 249 4. Summary of the claim names, keys, and value types 251 +------+-----+----------------------------------+ 252 | Name | Key | Value type | 253 +------+-----+----------------------------------+ 254 | iss | 1 | text string | 255 | sub | 2 | text string | 256 | aud | 3 | text string | 257 | exp | 4 | integer or floating-point number | 258 | nbf | 5 | integer or floating-point number | 259 | iat | 6 | integer or floating-point number | 260 | cti | 7 | byte string | 261 +------+-----+----------------------------------+ 263 Table 1: Summary of the claim names, keys, and value types 265 5. CBOR Tags and Claim Values 267 The claim values defined in this specification MUST NOT be prefixed 268 with any CBOR tag. For instance, while CBOR tag 1 (epoch-based date/ 269 time) could logically be prefixed to values of the "exp", "nbf", and 270 "iat" claims, this is unnecessary, since the representation of the 271 claim values is already specified by the claim definitions. Tagging 272 claim values would only take up extra space without adding 273 information. However, this does not prohibit future claim 274 definitions from requiring the use of CBOR tags for those specific 275 claims. 277 6. CWT CBOR Tag 279 How to determine that a CBOR data structure is a CWT is application- 280 dependent. In some cases, this information is known from the 281 application context, such as from the position of the CWT in a data 282 structure at which the value must be a CWT. One method of indicating 283 that a CBOR object is a CWT is the use of the "application/cwt" 284 content type by a transport protocol. 286 This section defines the CWT CBOR tag as another means for 287 applications to declare that a CBOR data structure is a CWT. Its use 288 is optional and is intended for use in cases in which this 289 information would not otherwise be known. 291 If present, the CWT tag MUST prefix a tagged object using one of the 292 COSE CBOR tags. In this example, the COSE_Mac0 tag is used. The 293 actual COSE_Mac0 object has been excluded from this example. 295 / CWT CBOR tag / 61( 296 / COSE_Mac0 CBOR tag / 17( 297 / COSE_Mac0 object / 298 ) 299 ) 301 Figure 1: Example of a CWT tag usage 303 7. Creating and Validating CWTs 305 7.1. Creating a CWT 307 To create a CWT, the following steps are performed. The order of the 308 steps is not significant in cases where there are no dependencies 309 between the inputs and outputs of the steps. 311 1. Create a CWT Claims Set containing the desired claims. 313 2. Let the Message be the binary representation of the CWT Claims 314 Set. 316 3. Create a COSE Header containing the desired set of Header 317 Parameters. The COSE Header MUST be valid per the [RFC8152] 318 specification. 320 4. Depending upon whether the CWT is signed, MACed, or encrypted, 321 there are three cases: 323 * If the CWT is signed, create a COSE_Sign/COSE_Sign1 object 324 using the Message as the COSE_Sign/COSE_Sign1 Payload; all 325 steps specified in [RFC8152] for creating a COSE_Sign/ 326 COSE_Sign1 object MUST be followed. 328 * Else, if the CWT is MACed, create a COSE_Mac/COSE_Mac0 object 329 using the Message as the COSE_Mac/COSE_Mac0 Payload; all steps 330 specified in [RFC8152] for creating a COSE_Mac/COSE_Mac0 331 object MUST be followed. 333 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 334 create a COSE_Encrypt/COSE_Encrypt0 using the Message as the 335 plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps 336 specified in [RFC8152] for creating a COSE_Encrypt/ 337 COSE_Encrypt0 object MUST be followed. 339 5. If a nested signing, MACing, or encryption operation will be 340 performed, let the Message be the tagged COSE_Sign/COSE_Sign1, 341 COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0, and return to 342 Step 3. 344 6. If needed by the application, prepend the COSE object with the 345 appropriate COSE CBOR tag to indicate the type of the COSE 346 object. If needed by the application, prepend the COSE object 347 with the CWT CBOR tag to indicate that the COSE object is a CWT. 349 7.2. Validating a CWT 351 When validating a CWT, the following steps are performed. The order 352 of the steps is not significant in cases where there are no 353 dependencies between the inputs and outputs of the steps. If any of 354 the listed steps fail, then the CWT MUST be rejected -- that is, 355 treated by the application as invalid input. 357 1. Verify that the CWT is a valid CBOR object. 359 2. If the object begins with the CWT CBOR tag, remove it and verify 360 that one of the COSE CBOR tags follows it. 362 3. If the object is tagged with one of the COSE CBOR tags, remove it 363 and use it to determine the type of the CWT, COSE_Sign/ 364 COSE_Sign1, COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0. 365 If the object does not have a COSE CBOR tag, the COSE message 366 type is determined from the application context. 368 4. Verify that the resulting COSE Header includes only parameters 369 and values whose syntax and semantics are both understood and 370 supported or that are specified as being ignored when not 371 understood. 373 5. Depending upon whether the CWT is a signed, MACed, or encrypted, 374 there are three cases: 376 * If the CWT is a COSE_Sign/COSE_Sign1, follow the steps 377 specified in [RFC8152] Section 4 (Signing Objects) for 378 validating a COSE_Sign/COSE_Sign1 object. Let the Message be 379 the COSE_Sign/COSE_Sign1 payload. 381 * Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps 382 specified in [RFC8152] Section 6 (MAC Objects) for validating 383 a COSE_Mac/COSE_Mac0 object. Let the Message be the COSE_Mac/ 384 COSE_Mac0 payload. 386 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 387 follow the steps specified in [RFC8152] Section 5 (Encryption 388 Objects) for validating a COSE_Encrypt/COSE_Encrypt0 object. 389 Let the Message be the resulting plaintext. 391 6. If the Message begins with a COSE CBOR tag, then the Message is a 392 CWT that was the subject of nested signing, MACing, or encryption 393 operations. In this case, return to Step 1, using the Message as 394 the CWT. 396 7. Verify that the Message is a valid CBOR map; let the CWT Claims 397 Set be this CBOR map. 399 8. Security Considerations 401 The security of the CWT relies upon on the protections offered by 402 COSE. Unless the claims in a CWT are protected, an adversary can 403 modify, add, or remove claims. 405 Since the claims conveyed in a CWT may be used to make authorization 406 decisions, it is not only important to protect the CWT in transit but 407 also to ensure that the recipient can authenticate the party that 408 assembled the claims and created the CWT. Without trust of the 409 recipient in the party that created the CWT, no sensible 410 authorization decision can be made. Furthermore, the creator of the 411 CWT needs to carefully evaluate each claim value prior to including 412 it in the CWT so that the recipient can be assured of the validity of 413 the information provided. 415 While syntactically the signing and encryption operations for Nested 416 CWTs may be applied in any order, if both signing and encryption are 417 necessary, normally producers should sign the message and then 418 encrypt the result (thus encrypting the signature). This prevents 419 attacks in which the signature is stripped, leaving just an encrypted 420 message, as well as providing privacy for the signer. Furthermore, 421 signatures over encrypted text are not considered valid in many 422 jurisdictions. 424 9. IANA Considerations 426 9.1. CBOR Web Token (CWT) Claims Registry 428 This section establishes the IANA "CBOR Web Token (CWT) Claims" 429 registry. 431 Registration requests are evaluated using the criteria described in 432 the Claim Key instructions in the registration template below after a 433 three-week review period on the cwt-reg-review@ietf.org mailing list, 434 on the advice of one or more Designated Experts. However, to allow 435 for the allocation of values prior to publication, the Designated 436 Experts may approve registration once they are satisfied that such a 437 specification will be published. [[ Note to the RFC Editor: The name 438 of the mailing list should be determined in consultation with the 439 IESG and IANA. Suggested name: cwt-reg-review@ietf.org. ]] 441 Registration requests sent to the mailing list for review should use 442 an appropriate subject (e.g., "Request to register claim: example"). 443 Registration requests that are undetermined for a period longer than 444 21 days can be brought to the IESG's attention (using the 445 iesg@ietf.org mailing list) for resolution. 447 Criteria that should be applied by the Designated Experts includes 448 determining whether the proposed registration duplicates existing 449 functionality, whether it is likely to be of general applicability or 450 whether it is useful only for a single application, and whether the 451 registration description is clear. Registrations for the limited set 452 of values between -256 and 255 and strings of length 1 are to be 453 restricted to claims with general applicability. 455 IANA must only accept registry updates from the Designated Experts 456 and should direct all requests for registration to the review mailing 457 list. 459 It is suggested that multiple Designated Experts be appointed who are 460 able to represent the perspectives of different applications using 461 this specification in order to enable broadly informed review of 462 registration decisions. In cases where a registration decision could 463 be perceived as creating a conflict of interest for a particular 464 Expert, that Expert should defer to the judgment of the other 465 Experts. 467 Since a high degree of overlap is expected between the contents of 468 the "CBOR Web Token (CWT) Claims" registry and the "JSON Web Token 469 Claims" registry, overlap in the corresponding pools of Designated 470 Experts would be useful to help ensure that an appropriate level of 471 coordination between the registries is maintained. 473 9.1.1. Registration Template 475 Claim Name: 476 The human-readable name requested (e.g., "iss"). 478 Claim Description: 479 Brief description of the claim (e.g., "Issuer"). 481 JWT Claim Name: 482 Claim Name of the equivalent JWT claim, as registered in 483 [IANA.JWT.Claims]. CWT claims should normally have a 484 corresponding JWT claim. If a corresponding JWT claim would not 485 make sense, the Designated Experts can choose to accept 486 registrations for which the JWT Claim Name is listed as "N/A". 488 Claim Key: 489 CBOR map key for the claim. Different ranges of values use 490 different registration policies [RFC8126]. Integer values from 491 -256 to 255 and strings of length 1 are designated as Standards 492 Action. Integer values from -65536 to -257 and from 256 to 65535 493 and strings of length 2 are designated as Specification Required. 494 Integer values greater than 65535 and strings of length greater 495 than 2 are designated as Expert Review. Integer values less than 496 -65536 are marked as Private Use. 498 Claim Value Type(s): 499 CBOR types that can be used for the claim value. 501 Change Controller: 502 For Standards Track RFCs, list the "IESG". For others, give the 503 name of the responsible party. Other details (e.g., postal 504 address, email address, home page URI) may also be included. 506 Specification Document(s): 507 Reference to the document or documents that specify the parameter, 508 preferably including URIs that can be used to retrieve copies of 509 the documents. An indication of the relevant sections may also be 510 included but is not required. 512 9.1.2. Initial Registry Contents 514 o Claim Name: (RESERVED) 515 o Claim Description: This registration reserves the key value 0. 516 o JWT Claim Name: N/A 517 o Claim Key: 0 518 o Claim Value Type(s): N/A 519 o Change Controller: IESG 520 o Specification Document(s): [[ this specification ]] 521 o Claim Name: "iss" 522 o Claim Description: Issuer 523 o JWT Claim Name: "iss" 524 o Claim Key: 1 525 o Claim Value Type(s): text string 526 o Change Controller: IESG 527 o Specification Document(s): Section 3.1.1 of [[ this specification 528 ]] 530 o Claim Name: "sub" 531 o Claim Description: Subject 532 o JWT Claim Name: "sub" 533 o Claim Key: 2 534 o Claim Value Type(s): text string 535 o Change Controller: IESG 536 o Specification Document(s): Section 3.1.2 of [[ this specification 537 ]] 539 o Claim Name: "aud" 540 o Claim Description: Audience 541 o JWT Claim Name: "aud" 542 o Claim Key: 3 543 o Claim Value Type(s): text string 544 o Change Controller: IESG 545 o Specification Document(s): Section 3.1.3 of [[ this specification 546 ]] 548 o Claim Name: "exp" 549 o Claim Description: Expiration Time 550 o JWT Claim Name: "exp" 551 o Claim Key: 4 552 o Claim Value Type(s): integer or floating-point number 553 o Change Controller: IESG 554 o Specification Document(s): Section 3.1.4 of [[ this specification 555 ]] 557 o Claim Name: "nbf" 558 o Claim Description: Not Before 559 o JWT Claim Name: "nbf" 560 o Claim Key: 5 561 o Claim Value Type(s): integer or floating-point number 562 o Change Controller: IESG 563 o Specification Document(s): Section 3.1.5 of [[ this specification 564 ]] 566 o Claim Name: "iat" 567 o Claim Description: Issued At 568 o JWT Claim Name: "iat" 569 o Claim Key: 6 570 o Claim Value Type(s): integer or floating-point number 571 o Change Controller: IESG 572 o Specification Document(s): Section 3.1.6 of [[ this specification 573 ]] 575 o Claim Name: "cti" 576 o Claim Description: CWT ID 577 o JWT Claim Name: "jti" 578 o Claim Key: 7 579 o Claim Value Type(s): byte string 580 o Change Controller: IESG 581 o Specification Document(s): Section 3.1.7 of [[ this specification 582 ]] 584 9.2. Media Type Registration 586 This section registers the "application/cwt" media type in the "Media 587 Types" registry [IANA.MediaTypes] in the manner described in RFC 6838 588 [RFC6838], which can be used to indicate that the content is a CWT. 590 9.2.1. Registry Contents 592 o Type name: application 593 o Subtype name: cwt 594 o Required parameters: N/A 595 o Optional parameters: N/A 596 o Encoding considerations: binary 597 o Security considerations: See the Security Considerations section 598 of [[ this specification ]] 599 o Interoperability considerations: N/A 600 o Published specification: [[ this specification ]] 601 o Applications that use this media type: IoT applications sending 602 security tokens over HTTP(S), CoAP(S), and other transports. 603 o Fragment identifier considerations: N/A 604 o Additional information: 606 Magic number(s): N/A 607 File extension(s): N/A 608 Macintosh file type code(s): N/A 610 o Person & email address to contact for further information: 611 IESG, iesg@ietf.org 612 o Intended usage: COMMON 613 o Restrictions on usage: none 614 o Author: Michael B. Jones, mbj@microsoft.com 615 o Change controller: IESG 616 o Provisional registration? No 618 9.3. CoAP Content-Formats Registration 620 This section registers the CoAP Content-Format ID for the 621 "application/cwt" media type in the "CoAP Content-Formats" registry 622 [IANA.CoAP.Content-Formats]. 624 9.3.1. Registry Contents 626 o Media Type: application/cwt 627 o Encoding: - 628 o Id: TBD (maybe 61) 629 o Reference: [[ this specification ]] 631 9.4. CBOR Tag registration 633 This section registers the CWT CBOR tag in the "CBOR Tags" registry 634 [IANA.CBOR.Tags]. 636 9.4.1. Registry Contents 638 o CBOR Tag: TBD (maybe 61 to use the same value as the Content- 639 Format) 640 o Data Item: CBOR Web Token (CWT) 641 o Semantics: CBOR Web Token (CWT), as defined in [[ this 642 specification ]] 643 o Description of Semantics: [[ this specification ]] 644 o Point of Contact: Michael B. Jones, mbj@microsoft.com 646 10. References 648 10.1. Normative References 650 [IANA.CBOR.Tags] 651 IANA, "Concise Binary Object Representation (CBOR) Tags", 652 . 655 [IANA.CoAP.Content-Formats] 656 IANA, "CoAP Content-Formats", 657 . 660 [IANA.MediaTypes] 661 IANA, "Media Types", 662 . 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 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 670 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 671 October 2013, . 673 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 674 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 675 . 677 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 678 RFC 8152, DOI 10.17487/RFC8152, July 2017, 679 . 681 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 682 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 683 May 2017, . 685 10.2. Informative References 687 [IANA.JWT.Claims] 688 IANA, "JSON Web Token Claims", 689 . 691 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 692 Specifications and Registration Procedures", BCP 13, 693 RFC 6838, DOI 10.17487/RFC6838, January 2013, 694 . 696 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 697 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 698 2015, . 700 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 701 RFC 7516, DOI 10.17487/RFC7516, May 2015, 702 . 704 [RFC8126] Cotton, M., Leiba, B., and T. Narten, "Guidelines for 705 Writing an IANA Considerations Section in RFCs", BCP 26, 706 RFC 8126, DOI 10.17487/RFC8126, June 2017, 707 . 709 Appendix A. Examples 711 This appendix includes a set of CWT examples that show how the CWT 712 Claims Set can be protected. There are examples that are signed, 713 MACed, encrypted, and that use nested signing and encryption. To 714 make the examples easier to read, they are presented both as hex 715 strings and in the extended CBOR diagnostic notation described in 716 Section 6 of [RFC7049]. 718 Where a byte string is to carry an embedded CBOR-encoded item, the 719 diagnostic notation for this CBOR data item can be enclosed in '<<' 720 and '>>' to notate the byte string resulting from encoding the data 721 item, e.g., h'63666F6F' translates to <<"foo">>. 723 A.1. Example CWT Claims Set 725 The CWT Claims Set used for the different examples displays usage of 726 all the defined claims. For signed and MACed examples, the CWT 727 Claims Set is the CBOR encoding as a byte string. 729 a70175636f61703a2f2f61732e6578616d706c652e636f6d02656572696b7703 730 7818636f61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0 731 051a5610d9f0061a5610d9f007420b71 733 Figure 2: Example CWT Claims Set as hex string 735 { 736 / iss / 1: "coap://as.example.com", 737 / sub / 2: "erikw", 738 / aud / 3: "coap://light.example.com", 739 / exp / 4: 1444064944, 740 / nbf / 5: 1443944944, 741 / iat / 6: 1443944944, 742 / cti / 7: h'0b71' 743 } 745 Figure 3: Example CWT Claims Set in CBOR diagnostic notation 747 A.2. Example keys 749 This section contains the keys used to sign, MAC, and encrypt the 750 messages in this appendix. Line breaks are for display purposes 751 only. 753 A.2.1. 128-bit Symmetric Key 755 a42050231f4c4d4d3051fdc2ec0a3851d5b3830104024c53796d6d6574726963 756 313238030a 758 Figure 4: 128-bit symmetric COSE_Key as hex string 760 { 761 / k / -1: h'231f4c4d4d3051fdc2ec0a3851d5b383' 762 / kty / 1: 4 / Symmetric /, 763 / kid / 2: h'53796d6d6574726963313238' / 'Symmetric128' /, 764 / alg / 3: 10 / AES-CCM-16-64-128 / 765 } 767 Figure 5: 128-bit symmetric COSE_Key in CBOR diagnostic notation 769 A.2.2. 256-bit Symmetric Key 771 a4205820403697de87af64611c1d32a05dab0fe1fcb715a86ab435f1ec99192d 772 795693880104024c53796d6d6574726963323536030a 774 Figure 6: 256-bit symmetric COSE_Key as hex string 776 { 777 / k / -1: h'403697de87af64611c1d32a05dab0fe1fcb715a86ab435f1 778 ec99192d79569388' 779 / kty / 1: 4 / Symmetric /, 780 / kid / 4: h'53796d6d6574726963323536' / 'Symmetric256' /, 781 / alg / 3: 4 / HMAC 256/64 / 782 } 784 Figure 7: 256-bit symmetric COSE_Key in CBOR diagnostic notation 786 A.2.3. ECDSA P-256 256-bit COSE Key 788 a72358206c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c67c858 789 bc206c1922582060f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db 790 9529971a36e7b9215820143329cce7868e416927599cf65a34f3ce2ffda55a7e 791 ca69ed8919a394d42f0f2001010202524173796d6d6574726963454344534132 792 35360326 794 Figure 8: ECDSA 256-bit COSE Key as hex string 796 { 797 / d / -4: h'6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e 798 6c67c858bc206c19', 799 / y / -3: h'60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168 800 db9529971a36e7b9', 801 / x / -2: h'143329cce7868e416927599cf65a34f3ce2ffda55a7eca69 802 ed8919a394d42f0f', 803 / crv / -1: 1 / P-256 /, 804 / kty / 1: 2 / EC2 /, 805 / kid / 2: h'4173796d6d657472696345434453413 806 23536' / 'AsymmetricECDSA256' /, 807 / alg / 3: -7 / ECDSA 256 / 808 } 810 Figure 9: ECDSA 256-bit COSE Key in CBOR diagnostic notation 812 A.3. Example Signed CWT 814 This section shows a signed CWT with a single recipient and a full 815 CWT Claims Set. 817 The signature is generated using the private key listed in 818 Appendix A.2.3 and it can be validated using the public key from 819 Appendix A.2.3. Line breaks are for display purposes only. 821 d28443a10126a104524173796d6d657472696345434453413235365850a701756 822 36f61703a2f2f61732e6578616d706c652e636f6d02656572696b77037818636f 823 61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0051a5610d 824 9f0061a5610d9f007420b7158405427c1ff28d23fbad1f29c4c7c6a555e601d6f 825 a29f9179bc3d7438bacaca5acd08c8d4d4f96131680c429a01f85951ecee743a5 826 2b9b63632c57209120e1c9e30 828 Figure 10: Signed CWT as hex string 830 18( 831 [ 832 / protected / << { 833 / alg / 1: -7 / ECDSA 256 / 834 } >>, 835 / unprotected / { 836 / kid / 4: h'4173796d6d657472696345434453413 837 23536' / 'AsymmetricECDSA256' / 838 }, 839 / payload / << { 840 / iss / 1: "coap://as.example.com", 841 / sub / 2: "erikw", 842 / aud / 3: "coap://light.example.com", 843 / exp / 4: 1444064944, 844 / nbf / 5: 1443944944, 845 / iat / 6: 1443944944, 846 / cti / 7: h'0b71' 847 } >>, 848 / signature / h'5427c1ff28d23fbad1f29c4c7c6a555e601d6fa29f 849 9179bc3d7438bacaca5acd08c8d4d4f96131680c42 850 9a01f85951ecee743a52b9b63632c57209120e1c9e 851 30' 852 ] 853 ) 855 Figure 11: Signed CWT in CBOR diagnostic notation 857 A.4. Example MACed CWT 859 This section shows a MACed CWT with a single recipient, a full CWT 860 Claims Set, and a CWT tag. 862 The MAC is generated using the 256-bit symmetric key from 863 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 864 purposes only. 866 d83dd18443a10104a1044c53796d6d65747269633235365850a70175636f6170 867 3a2f2f61732e6578616d706c652e636f6d02656572696b77037818636f61703a 868 2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0051a5610d9f006 869 1a5610d9f007420b7148093101ef6d789200 871 Figure 12: MACed CWT with CWT tag as hex string 873 61( 874 17( 875 [ 876 / protected / << { 877 / alg / 1: 4 / HMAC-256-64 / 878 } >>, 879 / unprotected / { 880 / kid / 4: h'53796d6d6574726963323536' / 'Symmetric256' / 881 }, 882 / payload / << { 883 / iss / 1: "coap://as.example.com", 884 / sub / 2: "erikw", 885 / aud / 3: "coap://light.example.com", 886 / exp / 4: 1444064944, 887 / nbf / 5: 1443944944, 888 / iat / 6: 1443944944, 889 / cti / 7: h'0b71' 890 } >>, 891 / tag / h'093101ef6d789200' 892 ] 893 ) 894 ) 896 Figure 13: MACed CWT with CWT tag in CBOR diagnostic notation 898 A.5. Example Encrypted CWT 900 This section shows an encrypted CWT with a single recipient and a 901 full CWT Claims Set. 903 The encryption is done with AES-CCM mode using the 128-bit symmetric 904 key from Appendix A.2.1 with a 64-bit tag and 13-byte nonce, i.e., 905 COSE AES-CCM-16-64-128. Line breaks are for display purposes only. 907 d08343a1010aa2044c53796d6d6574726963313238054d99a0d7846e762c49ff 908 e8a63e0b5858b918a11fd81e438b7f973d9e2e119bcb22424ba0f38a80f27562 909 f400ee1d0d6c0fdb559c02421fd384fc2ebe22d7071378b0ea7428fff157444d 910 45f7e6afcda1aae5f6495830c58627087fc5b4974f319a8707a635dd643b 912 Figure 14: Encrypted CWT as hex string 914 16( 915 [ 916 / protected / << { 917 / alg / 1: 10 / AES-CCM-16-64-128 / 918 } >>, 919 / unprotected / { 920 / kid / 4: h'53796d6d6574726963313238' / 'Symmetric128' /, 921 / iv / 5: h'99a0d7846e762c49ffe8a63e0b' 922 }, 923 / ciphertext / h'b918a11fd81e438b7f973d9e2e119bcb22424ba0f38 924 a80f27562f400ee1d0d6c0fdb559c02421fd384fc2e 925 be22d7071378b0ea7428fff157444d45f7e6afcda1a 926 ae5f6495830c58627087fc5b4974f319a8707a635dd 927 643b' 928 ] 929 ) 931 Figure 15: Encrypted CWT in CBOR diagnostic notation 933 A.6. Example Nested CWT 935 This section shows a Nested CWT, signed and then encrypted, with a 936 single recipient and a full CWT Claims Set. 938 The signature is generated using the private ECDSA key from 939 Appendix A.2.3 and it can be validated using the public ECDSA parts 940 from Appendix A.2.3. The encryption is done with AES-CCM mode using 941 the 128-bit symmetric key from Appendix A.2.1 with a 64-bit tag and 942 13-byte nonce, i.e., COSE AES-CCM-16-64-128. The content type is set 943 to CWT to indicate that there are multiple layers of COSE protection 944 before finding the CWT Claims Set. The decrypted ciphertext will be a 945 COSE_sign1 structure. In this example, it is the same one as in 946 Appendix A.3, i.e., a Signed CWT Claims Set. Note that there is no 947 limitation to the number of layers; this is an example with two 948 layers. Line breaks are for display purposes only. 950 d08343a1010aa2044c53796d6d6574726963313238054d4a0694c0e69ee6b595 951 6655c7b258b7f6b0914f993de822cc47e5e57a188d7960b528a747446fe12f0e 952 7de05650dec74724366763f167a29c002dfd15b34d8993391cf49bc91127f545 953 dba8703d66f5b7f1ae91237503d371e6333df9708d78c4fb8a8386c8ff09dc49 954 af768b23179deab78d96490a66d5724fb33900c60799d9872fac6da3bdb89043 955 d67c2a05414ce331b5b8f1ed8ff7138f45905db2c4d5bc8045ab372bff142631 956 610a7e0f677b7e9b0bc73adefdcee16d9d5d284c616abeab5d8c291ce0 958 Figure 16: Signed and Encrypted CWT as hex string 960 16( 961 [ 962 / protected / << { 963 / alg / 1: 10 / AES-CCM-16-64-128 / 964 } >>, 965 / unprotected / { 966 / kid / 4: h'53796d6d6574726963313238' / 'Symmetric128' /, 967 / iv / 5: h'4a0694c0e69ee6b5956655c7b2' 968 }, 969 / ciphertext / h'f6b0914f993de822cc47e5e57a188d7960b528a7474 970 46fe12f0e7de05650dec74724366763f167a29c002d 971 fd15b34d8993391cf49bc91127f545dba8703d66f5b 972 7f1ae91237503d371e6333df9708d78c4fb8a8386c8 973 ff09dc49af768b23179deab78d96490a66d5724fb33 974 900c60799d9872fac6da3bdb89043d67c2a05414ce3 975 31b5b8f1ed8ff7138f45905db2c4d5bc8045ab372bf 976 f142631610a7e0f677b7e9b0bc73adefdcee16d9d5d 977 284c616abeab5d8c291ce0' 978 ] 979 ) 981 Figure 17: Signed and Encrypted CWT in CBOR diagnostic notation 983 A.7. Example MACed CWT with a floating-point value 985 This section shows a MACed CWT with a single recipient and a simple 986 CWT Claims Set. The CWT Claims Set with a floating-point 'iat' value. 988 The MAC is generated using the 256-bit symmetric key from 989 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 990 purposes only. 992 d18443a10104a1044c53796d6d65747269633235364ba106fb41d584367c2000 993 0048b8816f34c0542892 995 Figure 18: MACed CWT with a floating-point value as hex string 997 17( 998 [ 999 / protected / << { 1000 / alg / 1: 4 / HMAC-256-64 / 1001 } >>, 1002 / unprotected / { 1003 / kid / 4: h'53796d6d6574726963323536' / 'Symmetric256' /, 1004 }, 1005 / payload / << { 1006 / iat / 6: 1443944944.5 1007 } >>, 1008 / tag / h'b8816f34c0542892' 1009 ] 1010 ) 1012 Figure 19: MACed CWT with a floating-point value in CBOR diagnostic 1013 notation 1015 Appendix B. Acknowledgements 1017 This specification is based on JSON Web Token (JWT) [RFC7519], the 1018 authors of which also include Nat Sakimura and John Bradley. It also 1019 incorporates suggestions made by many people, including Carsten 1020 Bormann, Alissa Cooper, Esko Dijk, Benjamin Kaduk, Warren Kumari, 1021 Carlos Martinez, Alexey Melnikov, Kathleen Moriarty, Eric Rescorla, 1022 Dan Romascanu, Adam Roach, Kyle Rose, Jim Schaad, Ludwig Seitz, and 1023 Goeran Selander. 1025 [[ RFC Editor: Is it possible to preserve the non-ASCII spellings of 1026 the names Erik Wahlstroem and Goeran Selander in the final 1027 specification? ]] 1029 Appendix C. Document History 1031 [[ to be removed by the RFC Editor before publication as an RFC ]] 1033 -15 1035 o Added section references when the terms "NumericDate" and 1036 "StringOrURI" are used, as suggested by Adam Roach. 1038 -14 1040 o Cleaned up the descriptions of the numeric ranges of claim keys 1041 being registered in the registration template for the "CBOR Web 1042 Token (CWT) Claims" registry, as suggested by Adam Roach. 1044 o Clarified the relationships between the JWT and CWT "NumericDate" 1045 and "StringOrURI" terms, as suggested by Adam Roach. 1047 o Eliminated unnecessary uses of the word "type", as suggested by 1048 Adam Roach. 1050 o Added the text "IANA must only accept registry updates from the 1051 Designated Experts and should direct all requests for registration 1052 to the review mailing list" from RFC 7519, as suggested by Amanda 1053 Baber of IANA, which is also intended to address Alexey Melnikov's 1054 comment. 1056 o Removed a superfluous comma, as suggested by Warren Kumari. 1058 o Acknowledged additional reviewers. 1060 -13 1062 o Clarified the registration criteria applied to different ranges of 1063 Claim Key values, as suggested by Kathleen Moriarty and Dan 1064 Romascanu. 1066 o No longer describe the syntax of CWT claims as being the same as 1067 that of the corresponding JWT claims, as suggested by Kyle Rose. 1069 o Added guidance about the selection of the Designated Experts, as 1070 suggested by Benjamin Kaduk. 1072 o Acknowledged additional reviewers. 1074 -12 1076 o Updated the RFC 5226 reference to RFC 8126. 1078 o Made the IANA registration criteria consistent across sections. 1080 o Stated that registrations for the limited set of values between 1081 -256 and 255 and strings of length 1 are to be restricted to 1082 claims with general applicability. 1084 o Changed the "Reference" field name to "Description of Semantics" 1085 in the CBOR Tag registration request. 1087 o Asked the RFC Editor whether it is possible to preserve the non- 1088 ASCII spellings of the names Erik Wahlstroem and Goeran Selander 1089 in the final specification. 1091 -11 1092 o Corrected the "iv" value in the signed and encrypted CWT example. 1094 o Mention CoAP in the "application/cwt" media type registration. 1096 o Changed references of the form "Section 4.1.1 of JWT " to "Section 4.1.1 of " 1098 so that rfcmarkup will generate correct external section reference 1099 links. 1101 o Updated Acknowledgements. 1103 -10 1105 o Clarified that the audience claim value can be a single audience 1106 value or an array of audience values, just as is the case for the 1107 JWT "aud" claim. 1109 o Clarified the nested CWT description. 1111 o Changed uses of "binary string" to "byte string". 1113 -09 1115 o Added key ID values to the examples. 1117 o Key values for the examples are now represented in COSE_Key format 1118 using CBOR diagnostic notation. 1120 -08 1122 o Updated the diagnostic notation for embedded objects in the 1123 examples, addressing feedback by Carsten Bormann. 1125 -07 1127 o Updated examples for signing and encryption. Signatures are now 1128 deterministic as recommended by COSE specification. 1130 -06 1132 o Addressed review comments by Carsten Bormann and Jim Schaad. All 1133 changes were editorial in nature. 1135 -05 1137 o Addressed working group last call comments with the following 1138 changes: 1140 o Say that CWT is derived from JWT, rather than CWT is a profile of 1141 JWT. 1143 o Used CBOR type names in descriptions, rather than major/minor type 1144 numbers. 1146 o Clarified the NumericDate and StringOrURI descriptions. 1148 o Changed to allow CWT claim names to use values of any legal CBOR 1149 map key type. 1151 o Changed to use the CWT tag to identify nested CWTs instead of the 1152 CWT content type. 1154 o Added an example using a floating-point date value. 1156 o Acknowledged reviewers. 1158 -04 1160 o Specified that the use of CBOR tags to prefix any of the claim 1161 values defined in this specification is NOT RECOMMENDED. 1163 -03 1165 o Reworked the examples to include signed, MACed, encrypted, and 1166 nested CWTs. 1168 o Defined the CWT CBOR tag and explained its usage. 1170 -02 1172 o Added IANA registration for the application/cwt media type. 1174 o Clarified the nested CWT language. 1176 o Corrected nits identified by Ludwig Seitz. 1178 -01 1180 o Added IANA registration for CWT Claims. 1182 o Added IANA registration for the application/cwt CoAP content- 1183 format type. 1185 o Added Samuel Erdtman as an editor. 1187 o Changed Erik's e-mail address. 1189 -00 1191 o Created the initial working group version based on draft- 1192 wahlstroem-ace-cbor-web-token-00. 1194 Authors' Addresses 1196 Michael B. Jones 1197 Microsoft 1199 Email: mbj@microsoft.com 1200 URI: http://self-issued.info/ 1202 Erik Wahlstroem 1203 Sweden 1205 Email: erik@wahlstromstekniska.se 1207 Samuel Erdtman 1208 Spotify AB 1209 Birger Jarlsgatan 61, 4tr 1210 Stockholm 113 56 1211 Sweden 1213 Phone: +46702691499 1214 Email: erdtman@spotify.com 1216 Hannes Tschofenig 1217 ARM Ltd. 1218 Hall in Tirol 6060 1219 Austria 1221 Email: Hannes.Tschofenig@arm.com