idnits 2.17.00 (12 Aug 2021) /tmp/idnits5274/draft-ietf-ace-cbor-web-token-05.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 (June 5, 2017) is 1810 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-cose-msg has been published as RFC 8152 ** Obsolete normative reference: RFC 7049 (Obsoleted by RFC 8949) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 1 error (**), 0 flaws (~~), 2 warnings (==), 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: December 7, 2017 6 S. Erdtman 7 Spotify AB 8 H. Tschofenig 9 ARM Ltd. 10 June 5, 2017 12 CBOR Web Token (CWT) 13 draft-ietf-ace-cbor-web-token-05 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 December 7, 2017. 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 . . . . . . . . . . . . . . . . . . . . . . . . . 4 63 3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 64 3.1. Claim Names . . . . . . . . . . . . . . . . . . . . . . . 4 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 values, value types, and encoded claim keys . 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 . . . . . . . . . . 9 81 9.1.1. Registration Template . . . . . . . . . . . . . . . . 10 82 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 11 83 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 12 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 . . . . . . . . . . . . . . . . . . 13 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 . . . . . . . . . . . . . . . . . . 18 101 A.6. Example Nested CWT . . . . . . . . . . . . . . . . . . . 19 102 A.7. Example MACed CWT with a floating-point value . . . . . . 20 103 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 21 104 Appendix C. Document History . . . . . . . . . . . . . . . . . . 21 105 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 22 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) [I-D.ietf-cose-msg] 127 specification is used. 129 The suggested pronunciation of CWT is the same as the English word 130 "cot". 132 1.1. CBOR Related Terminology 134 In JSON, maps are called objects and only have one kind of map key: a 135 string. In COSE, we use strings, negative integers, and unsigned 136 integers as map keys. The integers are used for compactness of 137 encoding and easy comparison. The inclusion of strings allows for an 138 additional range of short encoded values to be used as well. 140 2. 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 145 "Key words for use in RFCs to Indicate Requirement Levels" [RFC2119]. 147 This document reuses terminology from JWT [RFC7519] and COSE 148 [I-D.ietf-cose-msg]. 150 StringOrURI: 151 The "StringOrURI" term has the same meaning, syntax, and 152 processing rules as the "StringOrUri" term defined in Section 2 of 153 JWT [RFC7519], except that it uses a CBOR text string instead of a 154 JSON string value. 156 NumericDate: 157 The "NumericDate" term has the same meaning, syntax, and 158 processing rules as the "NumericDate" term defined in Section 2 of 159 JWT [RFC7519], except that the CBOR numeric date representation 160 (from Section 2.4.1 of [RFC7049]) is used. The encoding is 161 modified so that the leading tag (6.1 or 0xC1) MUST be omitted. 163 CBOR encoded claim key: 164 The key used to identify a claim value. 166 CWT Claims Set 167 A CBOR map that contains the claims conveyed by the CWT. 169 3. Claims 171 The set of claims that a CWT must contain to be considered valid is 172 context dependent and is outside the scope of this specification. 173 Specific applications of CWTs will require implementations to 174 understand and process some claims in particular ways. However, in 175 the absence of such requirements, all claims that are not understood 176 by implementations MUST be ignored. 178 To keep CWTs as small as possible, the CBOR encoded claim keys are 179 represented using integers or text strings. Section 4 summarizes all 180 keys used to identify the claims defined in this document. 182 3.1. Claim Names 184 None of the claims defined below are intended to be mandatory to use 185 or implement. They rather provide a starting point for a set of 186 useful, interoperable claims. Applications using CWTs should define 187 which specific claims they use and when they are required or 188 optional. 190 3.1.1. iss (Issuer) Claim 192 The "iss" (issuer) claim has the same meaning, syntax, and processing 193 rules as the "iss" claim defined in Section 4.1.1 of JWT [RFC7519], 194 except that the format MUST be a StringOrURI. The CBOR encoded claim 195 key 1 MUST be used to identify this claim. 197 3.1.2. sub (Subject) Claim 199 The "sub" (subject) claim has the same meaning, syntax, and 200 processing rules as the "sub" claim defined in Section 4.1.2 of JWT 201 [RFC7519], except that the format MUST be a StringOrURI. The CBOR 202 encoded claim key 2 MUST be used to identify this claim. 204 3.1.3. aud (Audience) Claim 206 The "aud" (audience) claim has the same meaning, syntax, and 207 processing rules as the "aud" claim defined in Section 4.1.3 of JWT 208 [RFC7519], except that the format MUST be a StringOrURI. The CBOR 209 encoded claim key 3 MUST be used to identify this claim. 211 3.1.4. exp (Expiration Time) Claim 213 The "exp" (expiration time) claim has the same meaning, syntax, and 214 processing rules as the "exp" claim defined in Section 4.1.4 of JWT 215 [RFC7519], except that the format MUST be a NumericDate. The CBOR 216 encoded claim key 4 MUST be used to identify this claim. 218 3.1.5. nbf (Not Before) Claim 220 The "nbf" (not before) claim has the same meaning, syntax, and 221 processing rules as the "nbf" claim defined in Section 4.1.5 of JWT 222 [RFC7519], except that the format MUST be a NumericDate. The CBOR 223 encoded claim key 5 MUST be used to identify this claim. 225 3.1.6. iat (Issued At) Claim 227 The "iat" (issued at) claim has the same meaning, syntax, and 228 processing rules as the "iat" claim defined in Section 4.1.6 of JWT 229 [RFC7519], except that the format MUST be a NumericDate. The CBOR 230 encoded claim key 6 MUST be used to identify this claim. 232 3.1.7. cti (CWT ID) Claim 234 The "cti" (CWT ID) claim has the same meaning, syntax, and processing 235 rules as the "jti" claim defined in Section 4.1.7 of JWT [RFC7519], 236 except that the format MUST be binary string. The CBOR encoded claim 237 key 7 MUST be used to identify this claim. 239 4. Summary of the values, value types, and encoded claim keys 241 /---------+-----+----------------------------------\ 242 | Name | Key | Value type | 243 |---------+-----+----------------------------------| 244 | iss | 1 | text string | 245 | sub | 2 | text string | 246 | aud | 3 | text string | 247 | exp | 4 | integer or floating-point number | 248 | nbf | 5 | integer or floating-point number | 249 | iat | 6 | integer or floating-point number | 250 | cti | 7 | binary string | 251 \---------+-----+----------------------------------/ 253 Figure 1: Summary of the values, value types, and encoded claim keys 255 5. CBOR Tags and Claim Values 257 The claim values defined in this specification MUST NOT be prefixed 258 with any CBOR tag. For instance, while CBOR tag 6.1 (seconds-since- 259 the-epoch) could logically be prefixed to values of the "exp", "nbf", 260 and "iat" claims, this is unnecessary, since the representation of 261 the claim values is already specified by the claim definitions. 262 Tagging claim values would only take up extra space without adding 263 information. However, this does not prohibit future claim 264 definitions from requiring the use of CBOR tags for those specific 265 claims. 267 6. CWT CBOR Tag 269 How to determine that a CBOR data structure is a CWT is application- 270 dependent. In some cases, this information is known from the 271 application context, such as from the position of the CWT in a data 272 structure at which the value must be a CWT. One method of indicating 273 that a CBOR object is a CWT is the use of the "application/cwt" 274 content type by a transport protocol. 276 This section defines the CWT CBOR tag as another means for 277 applications to declare that a CBOR data structure is a CWT. Its use 278 is optional, and is intended for use in cases in which this 279 information would not otherwise be known. 281 If present, the CWT tag MUST prefix a tagged object using one of the 282 COSE CBOR tags. In this example, the COSE_Mac0 tag is used. The 283 actual COSE_Mac0 object has been excluded from this example. 285 / CWT CBOR tag / 61( 286 / COSE_Mac0 CBOR tag / 17( 287 / COSE_Mac0 object / 288 ) 289 ) 291 Figure 2: Example of a CWT tag usage 293 7. Creating and Validating CWTs 295 7.1. Creating a CWT 297 To create a CWT, the following steps are performed. The order of the 298 steps is not significant in cases where there are no dependencies 299 between the inputs and outputs of the steps. 301 1. Create a CWT Claims Set containing the desired claims. 303 2. Let the Message be the binary representation of the CWT Claims 304 Set. 306 3. Create a COSE Header containing the desired set of Header 307 Parameters. The COSE Header MUST be valid per the 308 [I-D.ietf-cose-msg] specification. 310 4. Depending upon whether the CWT is signed, MACed, or encrypted, 311 there are three cases: 313 * If the CWT is signed, create a COSE_Sign/COSE_Sign1 object 314 using the Message as the COSE_Sign/COSE_Sign1 Payload; all 315 steps specified in [I-D.ietf-cose-msg] for creating a 316 COSE_Sign/COSE_Sign1 object MUST be followed. 318 * Else, if the CWT is MACed, create a COSE_Mac/COSE_Mac0 object 319 using the Message as the COSE_Mac/COSE_Mac0 Payload; all steps 320 specified in [I-D.ietf-cose-msg] for creating a COSE_Mac/ 321 COSE_Mac0 object MUST be followed. 323 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 324 create a COSE_Encrypt/COSE_Encrypt0 using the Message as the 325 plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps 326 specified in [I-D.ietf-cose-msg] for creating a COSE_Encrypt/ 327 COSE_Encrypt0 object MUST be followed. 329 5. If a nested signing, MACing, or encryption operation will be 330 performed, let the Message be the COSE_Sign/COSE_Sign1, COSE_Mac/ 331 COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0, add the matching COSE 332 CBOR tag, and return to Step 3. 334 6. If needed by the application, add the appropriate COSE CBOR tag 335 to the COSE object to indicate the type of the COSE object. If 336 needed by the application, add the CWT CBOR tag to indicate that 337 the COSE object is a CWT. 339 7.2. Validating a CWT 341 When validating a CWT, the following steps are performed. The order 342 of the steps is not significant in cases where there are no 343 dependencies between the inputs and outputs of the steps. If any of 344 the listed steps fail, then the CWT MUST be rejected -- that is, 345 treated by the application as invalid input. 347 1. Verify that the CWT is a valid CBOR object. 349 2. If the object begins with the CWT CBOR tag, remove it and verify 350 that one of the COSE CBOR tags follows it. 352 3. If the object is tagged with one of the COSE CBOR tags, remove it 353 and use it to determine the type of the CWT, COSE_Sign/ 354 COSE_Sign1, COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0. 355 If the object does not have a COSE CBOR tag, the COSE message 356 type is determined from the application context. 358 4. Verify that the resulting COSE Header includes only parameters 359 and values whose syntax and semantics are both understood and 360 supported or that are specified as being ignored when not 361 understood. 363 5. Depending upon whether the CWT is a signed, MACed, or encrypted, 364 there are three cases: 366 * If the CWT is a COSE_Sign/COSE_Sign1, follow the steps 367 specified in [I-D.ietf-cose-msg] Section 4 (Signing Objects) 368 for validating a COSE_Sign/COSE_Sign1 object. Let the Message 369 be the COSE_Sign/COSE_Sign1 payload. 371 * Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps 372 specified in [I-D.ietf-cose-msg] Section 6 (MAC Objects) for 373 validating a COSE_Mac/COSE_Mac0 object. Let the Message be 374 the COSE_Mac/COSE_Mac0 payload. 376 * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, 377 follow the steps specified in [I-D.ietf-cose-msg] Section 5 378 (Encryption Objects) for validating a COSE_Encrypt/ 379 COSE_Encrypt0 object. Let the Message be the resulting 380 plaintext. 382 6. If the Message begins with a COSE CBOR tag, then the Message is a 383 CWT that was the subject of nested signing, MACing, or encryption 384 operations. In this case, return to Step 1, using the Message as 385 the CWT. 387 7. Verify that the Message is a valid CBOR object; let the CWT 388 Claims Set be this CBOR object. 390 8. Security Considerations 392 The security of the CWT relies upon on the protections offered by 393 COSE. Unless the claims in a CWT are protected, an adversary can 394 modify, add, or remove claims. 396 Since the claims conveyed in a CWT may be used to make authorization 397 decisions, it is not only important to protect the CWT in transit but 398 also to ensure that the recipient can authenticate the party that 399 assembled the claims and created the CWT. Without trust of the 400 recipient in the party that created the CWT, no sensible 401 authorization decision can be made. Furthermore, the creator of the 402 CWT needs to carefully evaluate each claim value prior to including 403 it in the CWT so that the recipient can be assured of the validity of 404 the information provided. 406 While syntactically, the signing and encryption operations for Nested 407 CWTs may be applied in any order, if both signing and encryption are 408 necessary, normally producers should sign the message and then 409 encrypt the result (thus encrypting the signature). This prevents 410 attacks in which the signature is stripped, leaving just an encrypted 411 message, as well as providing privacy for the signer. Furthermore, 412 signatures over encrypted text are not considered valid in many 413 jurisdictions. 415 9. IANA Considerations 417 9.1. CBOR Web Token (CWT) Claims Registry 419 This section establishes the IANA "CBOR Web Token (CWT) Claims" 420 registry. 422 Values are registered on a Specification Required [RFC5226] basis 423 after a three-week review period on the cwt-reg-review@ietf.org 424 mailing list, on the advice of one or more Designated Experts. 425 However, to allow for the allocation of values prior to publication, 426 the Designated Experts may approve registration once they are 427 satisfied that such a specification will be published. [[ Note to 428 the RFC Editor: The name of the mailing list should be determined in 429 consultation with the IESG and IANA. Suggested name: cwt-reg- 430 review@ietf.org. ]] 432 Registration requests sent to the mailing list for review should use 433 an appropriate subject (e.g., "Request to register claim: example"). 434 Registration requests that are undetermined for a period longer than 435 21 days can be brought to the IESG's attention (using the 436 iesg@ietf.org mailing list) for resolution. 438 Criteria that should be applied by the Designated Experts includes 439 determining whether the proposed registration duplicates existing 440 functionality, whether it is likely to be of general applicability or 441 whether it is useful only for a single application, and whether the 442 registration description is clear. 444 It is suggested that multiple Designated Experts be appointed who are 445 able to represent the perspectives of different applications using 446 this specification in order to enable broadly informed review of 447 registration decisions. In cases where a registration decision could 448 be perceived as creating a conflict of interest for a particular 449 Expert, that Expert should defer to the judgment of the other 450 Experts. 452 9.1.1. Registration Template 454 Claim Name: 455 The human-readable name requested (e.g., "iss"). 457 Claim Description: 458 Brief description of the claim (e.g., "Issuer"). 460 JWT Claim Name: 461 Claim Name of the equivalent JWT claim, as registered in 462 [IANA.JWT.Claims]. CWT claims should normally have a 463 corresponding JWT claim. If a corresponding JWT claim would not 464 make sense, the Designated Experts can choose to accept 465 registrations for which the JWT Claim Name is listed as "N/A". 467 CBOR Key Value: 468 Integer values between -256 and 255 and strings of length 1 are 469 designated as Standards Track Document required. Integer values 470 from -65536 to 65535 and strings of length 2 are designated as 471 Specification Required. Integer values of greater than 65535 and 472 strings of length greater than 2 are designated as expert review. 473 Integer values less than -65536 are marked as private use. 475 CBOR Major Type: 476 CBOR major type and optional tag for the claim. 478 Change Controller: 479 For Standards Track RFCs, list the "IESG". For others, give the 480 name of the responsible party. Other details (e.g., postal 481 address, email address, home page URI) may also be included. 483 Specification Document(s): 484 Reference to the document or documents that specify the parameter, 485 preferably including URIs that can be used to retrieve copies of 486 the documents. An indication of the relevant sections may also be 487 included but is not required. 489 9.1.2. Initial Registry Contents 491 o Claim Name: N/A 492 o Claim Description: This registration reserves the key value 0. 493 o JWT Claim Name: N/A 494 o CBOR Key Value: 0 495 o CBOR Major Type: N/A 496 o Change Controller: IESG 497 o Specification Document(s): [[ this specification ]] 499 o Claim Name: "iss" 500 o Claim Description: Issuer 501 o JWT Claim Name: "iss" 502 o CBOR Key Value: 1 503 o CBOR Major Type: 3 504 o Change Controller: IESG 505 o Specification Document(s): Section 3.1.1 of [[ this specification 506 ]] 508 o Claim Name: "sub" 509 o Claim Description: Subject 510 o JWT Claim Name: "sub" 511 o CBOR Key Value: 2 512 o CBOR Major Type: 3 513 o Change Controller: IESG 514 o Specification Document(s): Section 3.1.2 of [[ this specification 515 ]] 517 o Claim Name: "aud" 518 o Claim Description: Audience 519 o JWT Claim Name: "aud" 520 o CBOR Key Value: 3 521 o CBOR Major Type: 3 522 o Change Controller: IESG 523 o Specification Document(s): Section 3.1.3 of [[ this specification 524 ]] 526 o Claim Name: "exp" 527 o Claim Description: Expiration Time 528 o JWT Claim Name: "exp" 529 o CBOR Key Value: 4 530 o CBOR Major Type: 0, 1, or 7 with subtypes 25, 26, or 27 531 o Change Controller: IESG 532 o Specification Document(s): Section 3.1.4 of [[ this specification 533 ]] 535 o Claim Name: "nbf" 536 o Claim Description: Not Before 537 o JWT Claim Name: "nbf" 538 o CBOR Key Value: 5 539 o CBOR Major Type: 0, 1, or 7 with subtypes 25, 26, or 27 540 o Change Controller: IESG 541 o Specification Document(s): Section 3.1.5 of [[ this specification 542 ]] 544 o Claim Name: "iat" 545 o Claim Description: Issued At 546 o JWT Claim Name: "iat" 547 o CBOR Key Value: 6 548 o CBOR Major Type: 0, 1, or 7 with subtypes 25, 26, or 27 549 o Change Controller: IESG 550 o Specification Document(s): Section 3.1.6 of [[ this specification 551 ]] 553 o Claim Name: "cti" 554 o Claim Description: CWT ID 555 o JWT Claim Name: "jti" 556 o CBOR Key Value: 7 557 o CBOR Major Type: 2 558 o Change Controller: IESG 559 o Specification Document(s): Section 3.1.7 of [[ this specification 560 ]] 562 9.2. Media Type Registration 564 This section registers the "application/cwt" media type in the "Media 565 Types" registry [IANA.MediaTypes] in the manner described in RFC 6838 566 [RFC6838], which can be used to indicate that the content is a CWT. 568 9.2.1. Registry Contents 570 o Type name: application 571 o Subtype name: cwt 572 o Required parameters: N/A 573 o Optional parameters: N/A 574 o Encoding considerations: binary 575 o Security considerations: See the Security Considerations section 576 of [[ this specification ]] 577 o Interoperability considerations: N/A 578 o Published specification: [[ this specification ]] 579 o Applications that use this media type: IoT applications sending 580 security tokens over HTTP(S) and other transports. 581 o Fragment identifier considerations: N/A 582 o Additional information: 584 Magic number(s): N/A 585 File extension(s): N/A 586 Macintosh file type code(s): N/A 588 o Person & email address to contact for further information: 589 IESG, iesg@ietf.org 590 o Intended usage: COMMON 591 o Restrictions on usage: none 592 o Author: Michael B. Jones, mbj@microsoft.com 593 o Change controller: IESG 594 o Provisional registration? No 596 9.3. CoAP Content-Formats Registration 598 This section registers the CoAP Content-Format ID for the 599 "application/cwt" media type in the "CoAP Content-Formats" registry 600 [IANA.CoAP.Content-Formats]. 602 9.3.1. Registry Contents 604 o Media Type: application/cwt 605 o Encoding: - 606 o Id: TBD (maybe 61) 607 o Reference: [[ this specification ]] 609 9.4. CBOR Tag registration 611 This section registers the CWT CBOR tag in the "CBOR Tags" registry 612 [IANA.CBOR.Tags]. 614 9.4.1. Registry Contents 616 o CBOR Tag: TBD (maybe 61 to use the same value as the Content- 617 Format) 618 o Data Item: CBOR Web Token (CWT) 619 o Semantics: CBOR Web Token (CWT), as defined in [[ this 620 specification ]] 621 o Reference: [[ this specification ]] 622 o Point of Contact: Michael B. Jones, mbj@microsoft.com 624 10. References 626 10.1. Normative References 628 [I-D.ietf-cose-msg] 629 Schaad, J., "CBOR Object Signing and Encryption (COSE)", 630 draft-ietf-cose-msg-24 (work in progress), November 2016. 632 [IANA.CBOR.Tags] 633 IANA, "Concise Binary Object Representation (CBOR) Tags", 634 . 637 [IANA.CoAP.Content-Formats] 638 IANA, "CoAP Content-Formats", 639 . 642 [IANA.MediaTypes] 643 IANA, "Media Types", 644 . 646 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 647 Requirement Levels", BCP 14, RFC 2119, 648 DOI 10.17487/RFC2119, March 1997, 649 . 651 [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object 652 Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, 653 October 2013, . 655 [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 656 (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, 657 . 659 10.2. Informative References 661 [IANA.JWT.Claims] 662 IANA, "JSON Web Token Claims", 663 . 665 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 666 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 667 DOI 10.17487/RFC5226, May 2008, 668 . 670 [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type 671 Specifications and Registration Procedures", BCP 13, 672 RFC 6838, DOI 10.17487/RFC6838, January 2013, 673 . 675 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 676 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 677 2015, . 679 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 680 RFC 7516, DOI 10.17487/RFC7516, May 2015, 681 . 683 Appendix A. Examples 685 This appendix includes a set of CWT examples that show how the CWT 686 Claims Set can be protected. There are examples that are signed, 687 MACed, encrypted, and that use nested signing and encryption. To 688 make the examples easier to read, they are presented both as hex 689 strings and in the extended CBOR diagnostic notation described in 690 Section 6 of [RFC7049]. 692 A.1. Example CWT Claims Set 694 The CWT Claims Set used for the different examples displays usage of 695 all the defined claims. For signed and MACed examples, the CWT 696 Claims Set is the CBOR encoding as a binary string. 698 a70175636f61703a2f2f61732e6578616d706c652e636f6d02656572696b7703 699 7818636f61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0 700 051a5610d9f0061a5610d9f007420b71 702 Figure 3: Example CWT Claims Set as hex string 704 { 705 / iss / 1: "coap://as.example.com", 706 / sub / 2: "erikw", 707 / aud / 3: "coap://light.example.com", 708 / exp / 4: 1444064944, 709 / nbf / 5: 1443944944, 710 / iat / 6: 1443944944, 711 / cti / 7: h'0b71' 712 } 714 Figure 4: Example CWT Claims Set in CBOR diagnostic notation 716 A.2. Example keys 718 This section contains the keys used to sign, MAC, and encrypt the 719 messages in this appendix. Line breaks are for display purposes 720 only. 722 A.2.1. 128-bit Symmetric Key as Hex Encoded String 724 231f4c4d4d3051fdc2ec0a3851d5b383 726 A.2.2. 256-bit Symmetric Key as Hex Encoded String 728 403697de87af64611c1d32a05dab0fe1fcb715a86ab435f1ec99192d79569388 730 A.2.3. ECDSA P-256 256-bit COSE Key 732 a622582060f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db952997 733 1a36e7b92358206c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c 734 67c858bc206c1903260102215820143329cce7868e416927599cf65a34f3ce2f 735 fda55a7eca69ed8919a394d42f0f2001 737 Figure 5: ECDSA 256-bit COSE Key as hex string 739 { 740 / d / -4: h'6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e 741 6c67c858bc206c19', 742 / y / -3: h'60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168 743 db9529971a36e7b9', 744 / x / -2: h'143329cce7868e416927599cf65a34f3ce2ffda55a7eca69 745 ed8919a394d42f0f', 746 / crv / -1: 1 / P-256 / , 747 / kty / 1: 2 / EC2 / , 748 / alg / 3: -7 / ECDSA 256 / 749 } 751 Figure 6: ECDSA 256-bit COSE Key in CBOR diagnostic notation 753 A.3. Example Signed CWT 755 This section shows a signed CWT with a single recipient and a full 756 CWT Claims Set. 758 The signature is generated using the private key listed in 759 Appendix A.2.3 and it can be validated using the public key from 760 Appendix A.2.3. Line breaks are for display purposes only. 762 d28443a10126a05850a70175636f61703a2f2f61732e6578616d706c652e636f6 763 d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c652e63 764 6f6d041a5612aeb0051a5610d9f0061a5610d9f007420b715840b9b2821b6b2c2 765 f9d1d984b11854dcfcee1f219746800ce76112c21f58c45dea1d7f01cec1ab394 766 0f75c459305365210a23a9ed463b4f6fc984c2f1c08e504d90 768 Figure 7: Signed CWT as hex string 770 18( 771 [ 772 / protected / h'a10126' / { 773 / alg / 1: -7 / ECDSA 256 / 774 } / , 775 / unprotected / {}, 776 / payload / h'a70175636f61703a2f2f61732e6578616d706c652e63 777 6f6d02656572696b77037818636f61703a2f2f6c6967 778 68742e6578616d706c652e636f6d041a5612aeb0051a 779 5610d9f0061a5610d9f007420b71' / { 780 / iss / 1: "coap://as.example.com", 781 / sub / 2: "erikw", 782 / aud / 3: "coap://light.example.com", 783 / exp / 4: 1444064944, 784 / nbf / 5: 1443944944, 785 / iat / 6: 1443944944, 786 / cti / 7: h'0b71' 787 } / , 788 / signature / h'b9b2821b6b2c2f9d1d984b11854dcfcee1f2197468 789 00ce76112c21f58c45dea1d7f01cec1ab3940f75c4 790 59305365210a23a9ed463b4f6fc984c2f1c08e504d 791 90' 792 ] 793 ) 795 Figure 8: Signed CWT in CBOR diagnostic notation 797 A.4. Example MACed CWT 799 This section shows a MACed CWT with a single recipient, a full CWT 800 Claims Set, and a CWT tag. 802 The MAC is generated using the 256-bit symmetric key from 803 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 804 purposes only. 806 d83dd18443a10104a05850a70175636f61703a2f2f61732e6578616d706c652e 807 636f6d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c 808 652e636f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7148093101ef 809 6d789200 811 Figure 9: MACed CWT with CWT tag as hex string 813 61( 814 17( 815 [ 816 / protected / h'a10104' / { 817 / alg / 1: 4 / HMAC 256/64 / 818 } / , 819 / unprotected / {}, 820 / payload / h'a70175636f61703a2f2f61732e6578616d706c652e636f 821 6d02656572696b77037818636f61703a2f2f6c69676874 822 2e6578616d706c652e636f6d041a5612aeb0051a5610d9 823 f0061a5610d9f007420b71' / { 824 / iss / 1: "coap://as.example.com", 825 / sub / 2: "erikw", 826 / aud / 3: "coap://light.example.com", 827 / exp / 4: 1444064944, 828 / nbf / 5: 1443944944, 829 / iat / 6: 1443944944, 830 / cti / 7: h'0b71' 831 } / , 832 / tag / h'093101ef6d789200' 833 ] 834 ) 835 ) 837 Figure 10: MACed CWT with CWT tag in CBOR diagnostic notation 839 A.5. Example Encrypted CWT 841 This section shows an encrypted CWT with a single recipient and a 842 full CWT Claims Set. 844 The encryption is done with AES-CCM mode using the 128-bit symmetric 845 key from Appendix A.2.1 with a 64-bit tag and 13-byte nonce, i.e., 846 COSE AES-CCM-16-64-128. Line breaks are for display purposes only. 848 d08343a1010aa1054d3d9624bfb90a612bdcfc5077c45858e06d4b57cf3b3c9d 849 a3a16325dadcb9d2a0748f00ecd728f4b79030b56a292ee9cc8cc75349c120fc 850 1ba5d67ee29affde28df75a20f344812453ff68270ad5f46295660558168e1d1 851 85cb308226cdad0a50417dcd4a8d4b47 853 Figure 11: Encrypted CWT as hex string 855 16( 856 [ 857 / protected / h'a1010a' / { 858 / alg / 1: 10 / AES-CCM-16-64-128 / 859 } /, 860 / unprotected / { 861 / iv / 5: h'3d9624bfb90a612bdcfc5077c4' 862 }, 863 / ciphertext / h'e06d4b57cf3b3c9da3a16325dadcb9d2a0748f00ecd 864 728f4b79030b56a292ee9cc8cc75349c120fc1ba5d6 865 7ee29affde28df75a20f344812453ff68270ad5f462 866 95660558168e1d185cb308226cdad0a50417dcd4a8d 867 4b47' 868 ] 869 ) 871 Figure 12: Encrypted CWT in CBOR diagnostic notation 873 A.6. Example Nested CWT 875 This section shows a Nested CWT, signed and then encrypted, with a 876 single recipient and a full CWT Claims Set. 878 The signature is generated using the private ECDSA key from 879 Appendix A.2.3 and it can be validated using the public ECDSA parts 880 from Appendix A.2.3. The encryption is done with AES-CCM mode using 881 the 128-bit symmetric key from Appendix A.2.1 with a 64-bit tag and 882 13-byte nonce, i.e., COSE AES-CCM-16-64-128. The content type is set 883 to CWT to indicate that there are multiple layers of COSE protection 884 before finding the CWT Claims Set. The decrypted ciphertext will be a 885 COSE_sign1 structure. In this example, it is the same one as in 886 Appendix A.3, i.e., a Signed CWT Claims Set. Note that there is no 887 limitation to the number of layers; this is an example with two 888 layers. Line breaks are for display purposes only. 890 d08343a1010aa1054dd3bdeeb4daaa50625a5b576cc458a3318af5c80a11e081 891 91ca790b0793156451afc144e0f9f892679dff1d01cd52d7fe1e43ac8dabace0 892 f74af095f918197da1550a76d59c2a89db6331e12451fc87fef56f2ff179fb33 893 d6132ca34eb7fa8de0960d5f02a2b625792ccc8e5b3d59c0bede9d7438dc5c4f 894 e0c403c8fc32e874fbb7516c52edddfc09d4444a762dcd0cd486895131c343ae 895 040620cdd4448c6ce0b7803022ff3d7877a83c345c05a57b36105a 897 Figure 13: Signed and Encrypted CWT as hex string 899 16( 900 [ 901 / protected / h'a203183d010a' / { 902 / alg / 1: 10 / AES-CCM-16-64-128 / 903 } / , 904 / unprotected / { 905 / iv / 5: h'd3bdeeb4daaa50625a5b576cc4' 906 }, 907 / ciphertext / h'318af5c80a11e08191ca790b0793156451afc144e0f 908 9f892679dff1d01cd52d7fe1e43ac8dabace0f74af0 909 95f918197da1550a76d59c2a89db6331e12451fc87f 910 ef56f2ff179fb33d6132ca34eb7fa8de0960d5f02a2 911 b625792ccc8e5b3d59c0bede9d7438dc5c4fe0c403c 912 8fc32e874fbb7516c52edddfc09d4444a762dcd0cd4 913 86895131c343ae040620cdd4448c6ce0b7803022ff3 914 d7877a83c345c05a57b36105a' 915 ] 916 ) 918 Figure 14: Signed and Encrypted CWT in CBOR diagnostic notation 920 A.7. Example MACed CWT with a floating-point value 922 This section shows a MACed CWT with a single recipient and a simple 923 CWT Claims Set. The CWT Claims Set with a floating-point 'iat' value. 925 The MAC is generated using the 256-bit symmetric key from 926 Appendix A.2.2 with a 64-bit truncation. Line breaks are for display 927 purposes only. 929 d18443a10104a04ba106fb41d584367c20000048b8816f34c0542892 931 Figure 15: MACed CWT with a floating-point value as hex string 933 17( 934 [ 935 / protected / h'a10104' / { 936 / alg / 1: 4 / HMAC 256/64 / 937 } / , 938 / unprotected / {}, 939 / payload / h'a106fb41d584367c200000' / { 940 / iat / 6: 1443944944.5 941 } / , 942 / tag / h'b8816f34c0542892' 943 ] 944 ) 946 Figure 16: MACed CWT with a floating-point value in CBOR diagnostic 947 notation 949 Appendix B. Acknowledgements 951 This specification is based on JSON Web Token (JWT) [RFC7519], the 952 authors of which also include Nat Sakimura and John Bradley. It also 953 incorporates suggestions made by many people, notably Carsten 954 Bormann, Jim Schaad, Ludwig Seitz, and Goeran Selander. 956 Appendix C. Document History 958 [[ to be removed by the RFC Editor before publication as an RFC ]] 960 -05 962 o Addressed working group last call comments with the following 963 changes: 965 o Say that CWT is derived from JWT, rather than CWT is a profile of 966 JWT. 968 o Used CBOR type names in descriptions, rather than major/minor type 969 numbers. 971 o Clarified the NumericDate and StringOrURI descriptions. 973 o Changed to allow CWT claim names to use values of any legal CBOR 974 map key type. 976 o Changed to use the CWT tag to identify nested CWTs instead of the 977 CWT content type. 979 o Added an example using a floating-point date value. 981 o Acknowledged reviewers. 983 -04 985 o Specified that the use of CBOR tags to prefix any of the claim 986 values defined in this specification is NOT RECOMMENDED. 988 -03 990 o Reworked the examples to include signed, MACed, encrypted, and 991 nested CWTs. 993 o Defined the CWT CBOR tag and explained its usage. 995 -02 997 o Added IANA registration for the application/cwt media type. 999 o Clarified the nested CWT language. 1001 o Corrected nits identified by Ludwig Seitz. 1003 -01 1005 o Added IANA registration for CWT Claims. 1007 o Added IANA registration for the application/cwt CoAP content- 1008 format type. 1010 o Added Samuel Erdtman as an editor. 1012 o Changed Erik's e-mail address. 1014 -00 1016 o Created the initial working group version based on draft- 1017 wahlstroem-ace-cbor-web-token-00. 1019 Authors' Addresses 1021 Michael B. Jones 1022 Microsoft 1024 Email: mbj@microsoft.com 1025 URI: http://self-issued.info/ 1026 Erik Wahlstroem 1027 Sweden 1029 Email: erik@wahlstromstekniska.se 1031 Samuel Erdtman 1032 Spotify AB 1033 Birger Jarlsgatan 61, 4tr 1034 Stockholm 113 56 1035 Sweden 1037 Phone: +46702691499 1038 Email: erdtman@spotify.com 1040 Hannes Tschofenig 1041 ARM Ltd. 1042 Hall in Tirol 6060 1043 Austria 1045 Email: Hannes.Tschofenig@arm.com