idnits 2.17.1 draft-ietf-ace-cbor-web-token-08.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 (August 16, 2017) is 2438 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) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 2 errors (**), 0 flaws (~~), 1 warning (==), 2 comments (--). 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: February 17, 2018 6 S. Erdtman 7 Spotify AB 8 H. Tschofenig 9 ARM Ltd. 10 August 16, 2017 12 CBOR Web Token (CWT) 13 draft-ietf-ace-cbor-web-token-08 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 http://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 February 17, 2018. 43 Copyright Notice 45 Copyright (c) 2017 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 (http://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 . . . . . . . . . . . . . . . . 5 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 . . . . . . . . . . . . . . . . . . . . . 9 80 9.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 10 81 9.1.1. Registration Template . . . . . . . . . . . . . . . . 10 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 . . . . . . . . . . . . 13 86 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 13 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 . . . . . . . . . . . . . . . . . . . . . . 15 93 A.1. Example CWT Claims Set . . . . . . . . . . . . . . . . . 15 94 A.2. Example keys . . . . . . . . . . . . . . . . . . . . . . 16 95 A.2.1. 128-bit Symmetric Key as Hex Encoded String . . . . . 16 96 A.2.2. 256-bit Symmetric Key as Hex Encoded String . . . . . 16 97 A.2.3. ECDSA P-256 256-bit COSE Key . . . . . . . . . . . . 16 98 A.3. Example Signed CWT . . . . . . . . . . . . . . . . . . . 17 99 A.4. Example MACed CWT . . . . . . . . . . . . . . . . . . . . 18 100 A.5. Example Encrypted CWT . . . . . . . . . . . . . . . . . . 19 101 A.6. Example Nested CWT . . . . . . . . . . . . . . . . . . . 20 102 A.7. Example MACed CWT with a floating-point value . . . . . . 21 103 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 22 104 Appendix C. Document History . . . . . . . . . . . . . . . . . . 22 105 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 24 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 144 "Key words for use in RFCs to Indicate Requirement Levels" [RFC2119]. 146 This document reuses terminology from JWT [RFC7519] and COSE 147 [RFC8152]. 149 StringOrURI 150 The "StringOrURI" term has the same meaning, syntax, and 151 processing rules as the "StringOrUri" term defined in Section 2 of 152 JWT [RFC7519], except that it uses a CBOR text string instead of a 153 JSON string value. 155 NumericDate 156 The "NumericDate" term has the same meaning, syntax, and 157 processing rules as the "NumericDate" term defined in Section 2 of 158 JWT [RFC7519], except that the CBOR numeric date representation 159 (from Section 2.4.1 of [RFC7049]) is used. The encoding is 160 modified so that the leading tag 1 (epoch-based date/time) MUST be 161 omitted. 163 Claim Name 164 The human-readable name used to identify a claim. 166 Claim Key 167 The CBOR map key used to identify a claim. 169 Claim Value 170 The CBOR map value representing the value of the claim. 172 CWT Claims Set 173 The CBOR map that contains the claims conveyed by the CWT. 175 3. Claims 177 The set of claims that a CWT must contain to be considered valid is 178 context dependent and is outside the scope of this specification. 179 Specific applications of CWTs will require implementations to 180 understand and process some claims in particular ways. However, in 181 the absence of such requirements, all claims that are not understood 182 by implementations MUST be ignored. 184 To keep CWTs as small as possible, the Claim Keys are represented 185 using integers or text strings. Section 4 summarizes all keys used 186 to identify the claims defined in this document. 188 3.1. Registered Claims 190 None of the claims defined below are intended to be mandatory to use 191 or implement. They rather provide a starting point for a set of 192 useful, interoperable claims. Applications using CWTs should define 193 which specific claims they use and when they are required or 194 optional. 196 3.1.1. iss (Issuer) Claim 198 The "iss" (issuer) claim has the same meaning, syntax, and processing 199 rules as the "iss" claim defined in Section 4.1.1 of JWT [RFC7519], 200 except that the value is of type StringOrURI. The Claim Key 1 is 201 used to identify this claim. 203 3.1.2. sub (Subject) Claim 205 The "sub" (subject) claim has the same meaning, syntax, and 206 processing rules as the "sub" claim defined in Section 4.1.2 of JWT 207 [RFC7519], except that the value is of type StringOrURI. The Claim 208 Key 2 is used to identify this claim. 210 3.1.3. aud (Audience) Claim 212 The "aud" (audience) claim has the same meaning, syntax, and 213 processing rules as the "aud" claim defined in Section 4.1.3 of JWT 214 [RFC7519], except that the value is of type StringOrURI. The Claim 215 Key 3 is used to identify this claim. 217 3.1.4. exp (Expiration Time) Claim 219 The "exp" (expiration time) claim has the same meaning, syntax, and 220 processing rules as the "exp" claim defined in Section 4.1.4 of JWT 221 [RFC7519], except that the value is of type NumericDate. The Claim 222 Key 4 is used to identify this claim. 224 3.1.5. nbf (Not Before) Claim 226 The "nbf" (not before) claim has the same meaning, syntax, and 227 processing rules as the "nbf" claim defined in Section 4.1.5 of JWT 228 [RFC7519], except that the value is of type NumericDate. The Claim 229 Key 5 is used to identify this claim. 231 3.1.6. iat (Issued At) Claim 233 The "iat" (issued at) claim has the same meaning, syntax, and 234 processing rules as the "iat" claim defined in Section 4.1.6 of JWT 236 [RFC7519], except that the value is of type NumericDate. The Claim 237 Key 6 is used to identify this claim. 239 3.1.7. cti (CWT ID) Claim 241 The "cti" (CWT ID) claim has the same meaning, syntax, and processing 242 rules as the "jti" claim defined in Section 4.1.7 of JWT [RFC7519], 243 except that the value is of type binary string. The Claim Key 7 is 244 used to identify this claim. 246 4. Summary of the claim names, keys, and value types 248 /---------+-----+----------------------------------\ 249 | Name | Key | Value type | 250 |---------+-----+----------------------------------| 251 | iss | 1 | text string | 252 | sub | 2 | text string | 253 | aud | 3 | text string | 254 | exp | 4 | integer or floating-point number | 255 | nbf | 5 | integer or floating-point number | 256 | iat | 6 | integer or floating-point number | 257 | cti | 7 | binary string | 258 \---------+-----+----------------------------------/ 260 Figure 1: Summary of the claim names, keys, and value types 262 5. CBOR Tags and Claim Values 264 The claim values defined in this specification MUST NOT be prefixed 265 with any CBOR tag. For instance, while CBOR tag 1 (epoch-based date/ 266 time) could logically be prefixed to values of the "exp", "nbf", and 267 "iat" claims, this is unnecessary, since the representation of the 268 claim values is already specified by the claim definitions. Tagging 269 claim values would only take up extra space without adding 270 information. However, this does not prohibit future claim 271 definitions from requiring the use of CBOR tags for those specific 272 claims. 274 6. CWT CBOR Tag 276 How to determine that a CBOR data structure is a CWT is application- 277 dependent. In some cases, this information is known from the 278 application context, such as from the position of the CWT in a data 279 structure at which the value must be a CWT. One method of indicating 280 that a CBOR object is a CWT is the use of the "application/cwt" 281 content type by a transport protocol. 283 This section defines the CWT CBOR tag as another means for 284 applications to declare that a CBOR data structure is a CWT. Its use 285 is optional, and is intended for use in cases in which this 286 information would not otherwise be known. 288 If present, the CWT tag MUST prefix a tagged object using one of the 289 COSE CBOR tags. In this example, the COSE_Mac0 tag is used. The 290 actual COSE_Mac0 object has been excluded from this example. 292 / CWT CBOR tag / 61( 293 / COSE_Mac0 CBOR tag / 17( 294 / COSE_Mac0 object / 295 ) 296 ) 298 Figure 2: Example of a CWT tag usage 300 7. Creating and Validating CWTs 302 7.1. Creating a CWT 304 To create a CWT, the following steps are performed. The order of the 305 steps is not significant in cases where there are no dependencies 306 between the inputs and outputs of the steps. 308 1. Create a CWT Claims Set containing the desired claims. 310 2. Let the Message be the binary representation of the CWT Claims 311 Set. 313 3. Create a COSE Header containing the desired set of Header 314 Parameters. The COSE Header MUST be valid per the [RFC8152] 315 specification. 317 4. Depending upon whether the CWT is signed, MACed, or encrypted, 318 there are three cases: 320 * If the CWT is signed, create a COSE_Sign/COSE_Sign1 object 321 using the Message as the COSE_Sign/COSE_Sign1 Payload; all 322 steps specified in [RFC8152] for creating a COSE_Sign/ 323 COSE_Sign1 object MUST be followed. 325 * Else, if the CWT is MACed, create a COSE_Mac/COSE_Mac0 object 326 using the Message as the COSE_Mac/COSE_Mac0 Payload; all steps 327 specified in [RFC8152] for creating a COSE_Mac/COSE_Mac0 328 object MUST be followed. 330 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 331 create a COSE_Encrypt/COSE_Encrypt0 using the Message as the 332 plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps 333 specified in [RFC8152] for creating a COSE_Encrypt/ 334 COSE_Encrypt0 object MUST be followed. 336 5. If a nested signing, MACing, or encryption operation will be 337 performed, let the Message be the COSE_Sign/COSE_Sign1, COSE_Mac/ 338 COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0, add the matching COSE 339 CBOR tag, and return to Step 3. 341 6. If needed by the application, add the appropriate COSE CBOR tag 342 to the COSE object to indicate the type of the COSE object. If 343 needed by the application, add the CWT CBOR tag to indicate that 344 the COSE object is a CWT. 346 7.2. Validating a CWT 348 When validating a CWT, the following steps are performed. The order 349 of the steps is not significant in cases where there are no 350 dependencies between the inputs and outputs of the steps. If any of 351 the listed steps fail, then the CWT MUST be rejected -- that is, 352 treated by the application as invalid input. 354 1. Verify that the CWT is a valid CBOR object. 356 2. If the object begins with the CWT CBOR tag, remove it and verify 357 that one of the COSE CBOR tags follows it. 359 3. If the object is tagged with one of the COSE CBOR tags, remove it 360 and use it to determine the type of the CWT, COSE_Sign/ 361 COSE_Sign1, COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0. 362 If the object does not have a COSE CBOR tag, the COSE message 363 type is determined from the application context. 365 4. Verify that the resulting COSE Header includes only parameters 366 and values whose syntax and semantics are both understood and 367 supported or that are specified as being ignored when not 368 understood. 370 5. Depending upon whether the CWT is a signed, MACed, or encrypted, 371 there are three cases: 373 * If the CWT is a COSE_Sign/COSE_Sign1, follow the steps 374 specified in [RFC8152] Section 4 (Signing Objects) for 375 validating a COSE_Sign/COSE_Sign1 object. Let the Message be 376 the COSE_Sign/COSE_Sign1 payload. 378 * Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps 379 specified in [RFC8152] Section 6 (MAC Objects) for validating 380 a COSE_Mac/COSE_Mac0 object. Let the Message be the COSE_Mac/ 381 COSE_Mac0 payload. 383 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 384 follow the steps specified in [RFC8152] Section 5 (Encryption 385 Objects) for validating a COSE_Encrypt/COSE_Encrypt0 object. 386 Let the Message be the resulting plaintext. 388 6. If the Message begins with a COSE CBOR tag, then the Message is a 389 CWT that was the subject of nested signing, MACing, or encryption 390 operations. In this case, return to Step 1, using the Message as 391 the CWT. 393 7. Verify that the Message is a valid CBOR map; let the CWT Claims 394 Set be this CBOR map. 396 8. Security Considerations 398 The security of the CWT relies upon on the protections offered by 399 COSE. Unless the claims in a CWT are protected, an adversary can 400 modify, add, or remove claims. 402 Since the claims conveyed in a CWT may be used to make authorization 403 decisions, it is not only important to protect the CWT in transit but 404 also to ensure that the recipient can authenticate the party that 405 assembled the claims and created the CWT. Without trust of the 406 recipient in the party that created the CWT, no sensible 407 authorization decision can be made. Furthermore, the creator of the 408 CWT needs to carefully evaluate each claim value prior to including 409 it in the CWT so that the recipient can be assured of the validity of 410 the information provided. 412 While syntactically, the signing and encryption operations for Nested 413 CWTs may be applied in any order, if both signing and encryption are 414 necessary, normally producers should sign the message and then 415 encrypt the result (thus encrypting the signature). This prevents 416 attacks in which the signature is stripped, leaving just an encrypted 417 message, as well as providing privacy for the signer. Furthermore, 418 signatures over encrypted text are not considered valid in many 419 jurisdictions. 421 9. IANA Considerations 422 9.1. CBOR Web Token (CWT) Claims Registry 424 This section establishes the IANA "CBOR Web Token (CWT) Claims" 425 registry. 427 Values are registered on a Specification Required [RFC5226] basis 428 after a three-week review period on the cwt-reg-review@ietf.org 429 mailing list, on the advice of one or more Designated Experts. 430 However, to allow for the allocation of values prior to publication, 431 the Designated Experts may approve registration once they are 432 satisfied that such a specification will be published. [[ Note to 433 the RFC Editor: The name of the mailing list should be determined in 434 consultation with the IESG and IANA. Suggested name: cwt-reg- 435 review@ietf.org. ]] 437 Registration requests sent to the mailing list for review should use 438 an appropriate subject (e.g., "Request to register claim: example"). 439 Registration requests that are undetermined for a period longer than 440 21 days can be brought to the IESG's attention (using the 441 iesg@ietf.org mailing list) for resolution. 443 Criteria that should be applied by the Designated Experts includes 444 determining whether the proposed registration duplicates existing 445 functionality, whether it is likely to be of general applicability or 446 whether it is useful only for a single application, and whether the 447 registration description is clear. 449 It is suggested that multiple Designated Experts be appointed who are 450 able to represent the perspectives of different applications using 451 this specification in order to enable broadly informed review of 452 registration decisions. In cases where a registration decision could 453 be perceived as creating a conflict of interest for a particular 454 Expert, that Expert should defer to the judgment of the other 455 Experts. 457 9.1.1. Registration Template 459 Claim Name: 460 The human-readable name requested (e.g., "iss"). 462 Claim Description: 463 Brief description of the claim (e.g., "Issuer"). 465 JWT Claim Name: 466 Claim Name of the equivalent JWT claim, as registered in 467 [IANA.JWT.Claims]. CWT claims should normally have a 468 corresponding JWT claim. If a corresponding JWT claim would not 469 make sense, the Designated Experts can choose to accept 470 registrations for which the JWT Claim Name is listed as "N/A". 472 Claim Key: 473 CBOR map key for the claim. Integer values between -256 and 255 474 and strings of length 1 are designated as Standards Track Document 475 required. Integer values from -65536 to 65535 and strings of 476 length 2 are designated as Specification Required. Integer values 477 of greater than 65535 and strings of length greater than 2 are 478 designated as expert review. Integer values less than -65536 are 479 marked as private use. 481 Claim Value Type(s): 482 CBOR types that can be used for the claim value. 484 Change Controller: 485 For Standards Track RFCs, list the "IESG". For others, give the 486 name of the responsible party. Other details (e.g., postal 487 address, email address, home page URI) may also be included. 489 Specification Document(s): 490 Reference to the document or documents that specify the parameter, 491 preferably including URIs that can be used to retrieve copies of 492 the documents. An indication of the relevant sections may also be 493 included but is not required. 495 9.1.2. Initial Registry Contents 497 o Claim Name: (RESERVED) 498 o Claim Description: This registration reserves the key value 0. 499 o JWT Claim Name: N/A 500 o Claim Key: 0 501 o Claim Value Type(s): N/A 502 o Change Controller: IESG 503 o Specification Document(s): [[ this specification ]] 505 o Claim Name: "iss" 506 o Claim Description: Issuer 507 o JWT Claim Name: "iss" 508 o Claim Key: 1 509 o Claim Value Type(s): text string 510 o Change Controller: IESG 511 o Specification Document(s): Section 3.1.1 of [[ this specification 512 ]] 514 o Claim Name: "sub" 515 o Claim Description: Subject 516 o JWT Claim Name: "sub" 517 o Claim Key: 2 518 o Claim Value Type(s): text string 519 o Change Controller: IESG 520 o Specification Document(s): Section 3.1.2 of [[ this specification 521 ]] 523 o Claim Name: "aud" 524 o Claim Description: Audience 525 o JWT Claim Name: "aud" 526 o Claim Key: 3 527 o Claim Value Type(s): text string 528 o Change Controller: IESG 529 o Specification Document(s): Section 3.1.3 of [[ this specification 530 ]] 532 o Claim Name: "exp" 533 o Claim Description: Expiration Time 534 o JWT Claim Name: "exp" 535 o Claim Key: 4 536 o Claim Value Type(s): integer or floating-point number 537 o Change Controller: IESG 538 o Specification Document(s): Section 3.1.4 of [[ this specification 539 ]] 541 o Claim Name: "nbf" 542 o Claim Description: Not Before 543 o JWT Claim Name: "nbf" 544 o Claim Key: 5 545 o Claim Value Type(s): integer or floating-point number 546 o Change Controller: IESG 547 o Specification Document(s): Section 3.1.5 of [[ this specification 548 ]] 550 o Claim Name: "iat" 551 o Claim Description: Issued At 552 o JWT Claim Name: "iat" 553 o Claim Key: 6 554 o Claim Value Type(s): integer or floating-point number 555 o Change Controller: IESG 556 o Specification Document(s): Section 3.1.6 of [[ this specification 557 ]] 559 o Claim Name: "cti" 560 o Claim Description: CWT ID 561 o JWT Claim Name: "jti" 562 o Claim Key: 7 563 o Claim Value Type(s): binary string 564 o Change Controller: IESG 565 o Specification Document(s): Section 3.1.7 of [[ this specification 566 ]] 568 9.2. Media Type Registration 570 This section registers the "application/cwt" media type in the "Media 571 Types" registry [IANA.MediaTypes] in the manner described in RFC 6838 572 [RFC6838], which can be used to indicate that the content is a CWT. 574 9.2.1. Registry Contents 576 o Type name: application 577 o Subtype name: cwt 578 o Required parameters: N/A 579 o Optional parameters: N/A 580 o Encoding considerations: binary 581 o Security considerations: See the Security Considerations section 582 of [[ this specification ]] 583 o Interoperability considerations: N/A 584 o Published specification: [[ this specification ]] 585 o Applications that use this media type: IoT applications sending 586 security tokens over HTTP(S) and other transports. 587 o Fragment identifier considerations: N/A 588 o Additional information: 590 Magic number(s): N/A 591 File extension(s): N/A 592 Macintosh file type code(s): N/A 594 o Person & email address to contact for further information: 595 IESG, iesg@ietf.org 596 o Intended usage: COMMON 597 o Restrictions on usage: none 598 o Author: Michael B. Jones, mbj@microsoft.com 599 o Change controller: IESG 600 o Provisional registration? No 602 9.3. CoAP Content-Formats Registration 604 This section registers the CoAP Content-Format ID for the 605 "application/cwt" media type in the "CoAP Content-Formats" registry 606 [IANA.CoAP.Content-Formats]. 608 9.3.1. Registry Contents 610 o Media Type: application/cwt 611 o Encoding: - 612 o Id: TBD (maybe 61) 613 o Reference: [[ this specification ]] 615 9.4. CBOR Tag registration 617 This section registers the CWT CBOR tag in the "CBOR Tags" registry 618 [IANA.CBOR.Tags]. 620 9.4.1. Registry Contents 622 o CBOR Tag: TBD (maybe 61 to use the same value as the Content- 623 Format) 624 o Data Item: CBOR Web Token (CWT) 625 o Semantics: CBOR Web Token (CWT), as defined in [[ this 626 specification ]] 627 o Reference: [[ this specification ]] 628 o Point of Contact: Michael B. Jones, mbj@microsoft.com 630 10. References 632 10.1. Normative References 634 [IANA.CBOR.Tags] 635 IANA, "Concise Binary Object Representation (CBOR) Tags", 636 . 639 [IANA.CoAP.Content-Formats] 640 IANA, "CoAP Content-Formats", 641 . 644 [IANA.MediaTypes] 645 IANA, "Media Types", 646 . 648 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 649 Requirement Levels", BCP 14, RFC 2119, 650 DOI 10.17487/RFC2119, March 1997, 651 . 653 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 654 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 655 October 2013, . 657 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 658 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 659 . 661 [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", 662 RFC 8152, DOI 10.17487/RFC8152, July 2017, 663 . 665 10.2. Informative References 667 [IANA.JWT.Claims] 668 IANA, "JSON Web Token Claims", 669 . 671 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 672 IANA Considerations Section in RFCs", RFC 5226, 673 DOI 10.17487/RFC5226, May 2008, 674 . 676 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 677 Specifications and Registration Procedures", BCP 13, 678 RFC 6838, DOI 10.17487/RFC6838, January 2013, 679 . 681 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 682 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 683 2015, . 685 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 686 RFC 7516, DOI 10.17487/RFC7516, May 2015, 687 . 689 Appendix A. Examples 691 This appendix includes a set of CWT examples that show how the CWT 692 Claims Set can be protected. There are examples that are signed, 693 MACed, encrypted, and that use nested signing and encryption. To 694 make the examples easier to read, they are presented both as hex 695 strings and in the extended CBOR diagnostic notation described in 696 Section 6 of [RFC7049]. 698 Where a byte string is to carry an embedded CBOR-encoded item, the 699 diagnostic notation for this CBOR data item can be enclosed in '<<' 700 and '>>' to notate the byte string resulting from encoding the data 701 item, e.g., h'63666F6F' translates to <<"foo">>. 703 A.1. Example CWT Claims Set 705 The CWT Claims Set used for the different examples displays usage of 706 all the defined claims. For signed and MACed examples, the CWT 707 Claims Set is the CBOR encoding as a binary string. 709 a70175636f61703a2f2f61732e6578616d706c652e636f6d02656572696b7703 710 7818636f61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0 711 051a5610d9f0061a5610d9f007420b71 713 Figure 3: Example CWT Claims Set as hex string 715 { 716 / iss / 1: "coap://as.example.com", 717 / sub / 2: "erikw", 718 / aud / 3: "coap://light.example.com", 719 / exp / 4: 1444064944, 720 / nbf / 5: 1443944944, 721 / iat / 6: 1443944944, 722 / cti / 7: h'0b71' 723 } 725 Figure 4: Example CWT Claims Set in CBOR diagnostic notation 727 A.2. Example keys 729 This section contains the keys used to sign, MAC, and encrypt the 730 messages in this appendix. Line breaks are for display purposes 731 only. 733 A.2.1. 128-bit Symmetric Key as Hex Encoded String 735 231f4c4d4d3051fdc2ec0a3851d5b383 737 A.2.2. 256-bit Symmetric Key as Hex Encoded String 739 403697de87af64611c1d32a05dab0fe1fcb715a86ab435f1ec99192d79569388 741 A.2.3. ECDSA P-256 256-bit COSE Key 743 a622582060f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db952997 744 1a36e7b92358206c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c 745 67c858bc206c1903260102215820143329cce7868e416927599cf65a34f3ce2f 746 fda55a7eca69ed8919a394d42f0f2001 748 Figure 5: ECDSA 256-bit COSE Key as hex string 750 { 751 / d / -4: h'6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e 752 6c67c858bc206c19', 753 / y / -3: h'60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168 754 db9529971a36e7b9', 755 / x / -2: h'143329cce7868e416927599cf65a34f3ce2ffda55a7eca69 756 ed8919a394d42f0f', 757 / crv / -1: 1 / P-256 /, 758 / kty / 1: 2 / EC2 /, 759 / alg / 3: -7 / ECDSA 256 / 760 } 762 Figure 6: ECDSA 256-bit COSE Key in CBOR diagnostic notation 764 A.3. Example Signed CWT 766 This section shows a signed CWT with a single recipient and a full 767 CWT Claims Set. 769 The signature is generated using the private key listed in 770 Appendix A.2.3 and it can be validated using the public key from 771 Appendix A.2.3. Line breaks are for display purposes only. 773 d28443a10126a05850a70175636f61703a2f2f61732e6578616d706c652e636f6 774 d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c652e63 775 6f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7158405427c1ff28d23 776 fbad1f29c4c7c6a555e601d6fa29f9179bc3d7438bacaca5acd08c8d4d4f96131 777 680c429a01f85951ecee743a52b9b63632c57209120e1c9e30 779 Figure 7: Signed CWT as hex string 781 18( 782 [ 783 / protected / << { 784 / alg / 1: -7 / ECDSA 256 / 785 } >>, 786 / unprotected / {}, 787 / payload / << { 788 / iss / 1: "coap://as.example.com", 789 / sub / 2: "erikw", 790 / aud / 3: "coap://light.example.com", 791 / exp / 4: 1444064944, 792 / nbf / 5: 1443944944, 793 / iat / 6: 1443944944, 794 / cti / 7: h'0b71' 795 } >>, 796 / signature / h'5427c1ff28d23fbad1f29c4c7c6a555e601d6fa29f 797 9179bc3d7438bacaca5acd08c8d4d4f96131680c42 798 9a01f85951ecee743a52b9b63632c57209120e1c9e 799 30' 800 ] 801 ) 803 Figure 8: Signed CWT in CBOR diagnostic notation 805 A.4. Example MACed CWT 807 This section shows a MACed CWT with a single recipient, a full CWT 808 Claims Set, and a CWT tag. 810 The MAC is generated using the 256-bit symmetric key from 811 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 812 purposes only. 814 d83dd18443a10104a05850a70175636f61703a2f2f61732e6578616d706c652e 815 636f6d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c 816 652e636f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7148093101ef 817 6d789200 819 Figure 9: MACed CWT with CWT tag as hex string 821 61( 822 17( 823 [ 824 / protected / << { 825 / alg / 1: 4 / HMAC-256-64 / 826 } >>, 827 / unprotected / {}, 828 / payload / << { 829 / iss / 1: "coap://as.example.com", 830 / sub / 2: "erikw", 831 / aud / 3: "coap://light.example.com", 832 / exp / 4: 1444064944, 833 / nbf / 5: 1443944944, 834 / iat / 6: 1443944944, 835 / cti / 7: h'0b71' 836 } >>, 837 / tag / h'093101ef6d789200' 838 ] 839 ) 840 ) 842 Figure 10: MACed CWT with CWT tag in CBOR diagnostic notation 844 A.5. Example Encrypted CWT 846 This section shows an encrypted CWT with a single recipient and a 847 full CWT Claims Set. 849 The encryption is done with AES-CCM mode using the 128-bit symmetric 850 key from Appendix A.2.1 with a 64-bit tag and 13-byte nonce, i.e., 851 COSE AES-CCM-16-64-128. Line breaks are for display purposes only. 853 d08343a1010aa1054d99a0d7846e762c49ffe8a63e0b5858b918a11fd81e438b 854 7f973d9e2e119bcb22424ba0f38a80f27562f400ee1d0d6c0fdb559c02421fd3 855 84fc2ebe22d7071378b0ea7428fff157444d45f7e6afcda1aae5f6495830c586 856 27087fc5b4974f319a8707a635dd643b 858 Figure 11: Encrypted CWT as hex string 860 16( 861 [ 862 / protected / << { 863 / alg / 1: 10 / AES-CCM-16-64-128 / 864 } >>, 865 / unprotected / { 866 / iv / 5: h'99a0d7846e762c49ffe8a63e0b' 867 }, 868 / ciphertext / h'b918a11fd81e438b7f973d9e2e119bcb22424ba0f38 869 a80f27562f400ee1d0d6c0fdb559c02421fd384fc2e 870 be22d7071378b0ea7428fff157444d45f7e6afcda1a 871 ae5f6495830c58627087fc5b4974f319a8707a635dd 872 643b' 873 ] 874 ) 876 Figure 12: Encrypted CWT in CBOR diagnostic notation 878 A.6. Example Nested CWT 880 This section shows a Nested CWT, signed and then encrypted, with a 881 single recipient and a full CWT Claims Set. 883 The signature is generated using the private ECDSA key from 884 Appendix A.2.3 and it can be validated using the public ECDSA parts 885 from Appendix A.2.3. The encryption is done with AES-CCM mode using 886 the 128-bit symmetric key from Appendix A.2.1 with a 64-bit tag and 887 13-byte nonce, i.e., COSE AES-CCM-16-64-128. The content type is set 888 to CWT to indicate that there are multiple layers of COSE protection 889 before finding the CWT Claims Set. The decrypted ciphertext will be a 890 COSE_sign1 structure. In this example, it is the same one as in 891 Appendix A.3, i.e., a Signed CWT Claims Set. Note that there is no 892 limitation to the number of layers; this is an example with two 893 layers. Line breaks are for display purposes only. 895 d08343a1010aa1054d86bbd41cc32604396324b7f38058a372439fbff538aa7b 896 601ebfb29454050a3c99fd13b27216d084556496c7355c4bb462510f8e0e8479 897 dbe08722d620e96bcb7764d75140d96220f062679b46b897e7abe0c325dc2c96 898 d8bb2c8334e3b92a42c0078983e753c054e647ad5387ed149f802f52b5a95ebf 899 5f153c4fd64854ab7531e082b7f22721f939d257c94f8bc248e1d9cf04f9dd4e 900 5de7ab62df37842fabec230a657d4abf7162bc786345ebb8eb3af0 902 Figure 13: Signed and Encrypted CWT as hex string 904 16( 905 [ 906 / protected / << { 907 / alg / 1: 10 / AES-CCM-16-64-128 / 908 } >>, 909 / unprotected / { 910 / iv / 5: h'86bbd41cc32604396324b7f380' 911 }, 912 / ciphertext / h'72439fbff538aa7b601ebfb29454050a3c99fd13b27 913 216d084556496c7355c4bb462510f8e0e8479dbe087 914 22d620e96bcb7764d75140d96220f062679b46b897e 915 7abe0c325dc2c96d8bb2c8334e3b92a42c0078983e7 916 53c054e647ad5387ed149f802f52b5a95ebf5f153c4 917 fd64854ab7531e082b7f22721f939d257c94f8bc248 918 e1d9cf04f9dd4e5de7ab62df37842fabec230a657d4 919 abf7162bc786345ebb8eb3af0' 920 ] 921 ) 923 Figure 14: Signed and Encrypted CWT in CBOR diagnostic notation 925 A.7. Example MACed CWT with a floating-point value 927 This section shows a MACed CWT with a single recipient and a simple 928 CWT Claims Set. The CWT Claims Set with a floating-point 'iat' value. 930 The MAC is generated using the 256-bit symmetric key from 931 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 932 purposes only. 934 d18443a10104a04ba106fb41d584367c20000048b8816f34c0542892 936 Figure 15: MACed CWT with a floating-point value as hex string 938 17( 939 [ 940 / protected / << { 941 / alg / 1: 4 / HMAC-256-64 / 942 } >>, 943 / unprotected / {}, 944 / payload / << { 945 / iat / 6: 1443944944.5 946 } >>, 947 / tag / h'b8816f34c0542892' 948 ] 949 ) 951 Figure 16: MACed CWT with a floating-point value in CBOR diagnostic 952 notation 954 Appendix B. Acknowledgements 956 This specification is based on JSON Web Token (JWT) [RFC7519], the 957 authors of which also include Nat Sakimura and John Bradley. It also 958 incorporates suggestions made by many people, notably Carsten 959 Bormann, Jim Schaad, Ludwig Seitz, and Goeran Selander. 961 Appendix C. Document History 963 [[ to be removed by the RFC Editor before publication as an RFC ]] 965 -08 967 o Updated the diagnostic notation for embedded objects in the 968 examples, addressing feedback by Carsten Bormann. 970 -07 972 o Updated examples for signing and encryption. Signatures are now 973 deterministic as recommended by COSE specification. 975 -06 977 o Addressed review comments by Carsten Bormann and Jim Schaad. All 978 changes were editorial in nature. 980 -05 982 o Addressed working group last call comments with the following 983 changes: 985 o Say that CWT is derived from JWT, rather than CWT is a profile of 986 JWT. 988 o Used CBOR type names in descriptions, rather than major/minor type 989 numbers. 991 o Clarified the NumericDate and StringOrURI descriptions. 993 o Changed to allow CWT claim names to use values of any legal CBOR 994 map key type. 996 o Changed to use the CWT tag to identify nested CWTs instead of the 997 CWT content type. 999 o Added an example using a floating-point date value. 1001 o Acknowledged reviewers. 1003 -04 1005 o Specified that the use of CBOR tags to prefix any of the claim 1006 values defined in this specification is NOT RECOMMENDED. 1008 -03 1010 o Reworked the examples to include signed, MACed, encrypted, and 1011 nested CWTs. 1013 o Defined the CWT CBOR tag and explained its usage. 1015 -02 1017 o Added IANA registration for the application/cwt media type. 1019 o Clarified the nested CWT language. 1021 o Corrected nits identified by Ludwig Seitz. 1023 -01 1025 o Added IANA registration for CWT Claims. 1027 o Added IANA registration for the application/cwt CoAP content- 1028 format type. 1030 o Added Samuel Erdtman as an editor. 1032 o Changed Erik's e-mail address. 1034 -00 1036 o Created the initial working group version based on draft- 1037 wahlstroem-ace-cbor-web-token-00. 1039 Authors' Addresses 1041 Michael B. Jones 1042 Microsoft 1044 Email: mbj@microsoft.com 1045 URI: http://self-issued.info/ 1047 Erik Wahlstroem 1048 Sweden 1050 Email: erik@wahlstromstekniska.se 1052 Samuel Erdtman 1053 Spotify AB 1054 Birger Jarlsgatan 61, 4tr 1055 Stockholm 113 56 1056 Sweden 1058 Phone: +46702691499 1059 Email: erdtman@spotify.com 1061 Hannes Tschofenig 1062 ARM Ltd. 1063 Hall in Tirol 6060 1064 Austria 1066 Email: Hannes.Tschofenig@arm.com