idnits 2.17.1 draft-ietf-jose-json-web-signature-28.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 20, 2014) is 3597 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Looks like a reference, but probably isn't: '123' on line 1737 -- Looks like a reference, but probably isn't: '34' on line 1737 -- Looks like a reference, but probably isn't: '97' on line 1747 -- Looks like a reference, but probably isn't: '108' on line 1747 -- Looks like a reference, but probably isn't: '103' on line 1737 -- Looks like a reference, but probably isn't: '58' on line 1737 -- Looks like a reference, but probably isn't: '82' on line 1491 -- Looks like a reference, but probably isn't: '83' on line 1737 -- Looks like a reference, but probably isn't: '50' on line 1737 -- Looks like a reference, but probably isn't: '53' on line 1737 -- Looks like a reference, but probably isn't: '54' on line 1623 -- Looks like a reference, but probably isn't: '125' on line 1737 -- Looks like a reference, but probably isn't: '69' on line 1737 -- Looks like a reference, but probably isn't: '49' on line 1737 -- Looks like a reference, but probably isn't: '80' on line 1747 -- Looks like a reference, but probably isn't: '121' on line 1747 -- Looks like a reference, but probably isn't: '111' on line 1747 -- Looks like a reference, but probably isn't: '100' on line 1747 -- Looks like a reference, but probably isn't: '0' on line 2056 -- Possible downref: Non-RFC (?) normative reference: ref. 'ECMAScript' -- Possible downref: Non-RFC (?) normative reference: ref. 'ITU.X690.1994' ** Downref: Normative reference to an Historic RFC: RFC 1421 ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) ** Obsolete normative reference: RFC 7159 (Obsoleted by RFC 8259) -- Possible downref: Non-RFC (?) normative reference: ref. 'USASCII' -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 5 errors (**), 0 flaws (~~), 1 warning (==), 25 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 JOSE Working Group M. Jones 3 Internet-Draft Microsoft 4 Intended status: Standards Track J. Bradley 5 Expires: December 22, 2014 Ping Identity 6 N. Sakimura 7 NRI 8 June 20, 2014 10 JSON Web Signature (JWS) 11 draft-ietf-jose-json-web-signature-28 13 Abstract 15 JSON Web Signature (JWS) represents content secured with digital 16 signatures or Message Authentication Codes (MACs) using JavaScript 17 Object Notation (JSON) based data structures. Cryptographic 18 algorithms and identifiers for use with this specification are 19 described in the separate JSON Web Algorithms (JWA) specification and 20 an IANA registry defined by that specification. Related encryption 21 capabilities are described in the separate JSON Web Encryption (JWE) 22 specification. 24 Status of this Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on December 22, 2014. 41 Copyright Notice 43 Copyright (c) 2014 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 59 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 60 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 61 3. JSON Web Signature (JWS) Overview . . . . . . . . . . . . . . 6 62 3.1. Example JWS . . . . . . . . . . . . . . . . . . . . . . . 8 63 4. JWS Header . . . . . . . . . . . . . . . . . . . . . . . . . . 9 64 4.1. Registered Header Parameter Names . . . . . . . . . . . . 9 65 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 10 66 4.1.2. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 10 67 4.1.3. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 10 68 4.1.4. "kid" (Key ID) Header Parameter . . . . . . . . . . . 10 69 4.1.5. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 11 70 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter . . . 11 71 4.1.7. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header 72 Parameter . . . . . . . . . . . . . . . . . . . . . . 11 73 4.1.8. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) 74 Header Parameter . . . . . . . . . . . . . . . . . . . 11 75 4.1.9. "typ" (Type) Header Parameter . . . . . . . . . . . . 12 76 4.1.10. "cty" (Content Type) Header Parameter . . . . . . . . 12 77 4.1.11. "crit" (Critical) Header Parameter . . . . . . . . . . 13 78 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 14 79 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 14 80 5. Producing and Consuming JWSs . . . . . . . . . . . . . . . . . 14 81 5.1. Message Signature or MAC Computation . . . . . . . . . . . 14 82 5.2. Message Signature or MAC Validation . . . . . . . . . . . 15 83 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 16 84 6. Key Identification . . . . . . . . . . . . . . . . . . . . . . 17 85 7. Serializations . . . . . . . . . . . . . . . . . . . . . . . . 17 86 7.1. JWS Compact Serialization . . . . . . . . . . . . . . . . 17 87 7.2. JWS JSON Serialization . . . . . . . . . . . . . . . . . . 18 88 8. TLS Requirements . . . . . . . . . . . . . . . . . . . . . . . 19 89 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 90 9.1. JSON Web Signature and Encryption Header Parameters 91 Registry . . . . . . . . . . . . . . . . . . . . . . . . . 20 92 9.1.1. Registration Template . . . . . . . . . . . . . . . . 21 93 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 21 94 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 23 95 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 23 97 10. Security Considerations . . . . . . . . . . . . . . . . . . . 24 98 10.1. Key Entropy . . . . . . . . . . . . . . . . . . . . . . . 24 99 10.2. Chosen Plaintext Attacks . . . . . . . . . . . . . . . . . 25 100 10.3. Timing Attacks . . . . . . . . . . . . . . . . . . . . . . 25 101 10.4. Differences between Digital Signatures and MACs . . . . . 25 102 10.5. SHA-1 Certificate Thumbprints . . . . . . . . . . . . . . 25 103 10.6. JSON Security Considerations . . . . . . . . . . . . . . . 26 104 10.7. Unicode Comparison Security Considerations . . . . . . . . 26 105 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 27 106 11.1. Normative References . . . . . . . . . . . . . . . . . . . 27 107 11.2. Informative References . . . . . . . . . . . . . . . . . . 28 108 Appendix A. JWS Examples . . . . . . . . . . . . . . . . . . . . 29 109 A.1. Example JWS using HMAC SHA-256 . . . . . . . . . . . . . . 29 110 A.1.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 29 111 A.1.2. Validating . . . . . . . . . . . . . . . . . . . . . . 32 112 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 . . . . . . . . 32 113 A.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 32 114 A.2.2. Validating . . . . . . . . . . . . . . . . . . . . . . 35 115 A.3. Example JWS using ECDSA P-256 SHA-256 . . . . . . . . . . 35 116 A.3.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 35 117 A.3.2. Validating . . . . . . . . . . . . . . . . . . . . . . 37 118 A.4. Example JWS using ECDSA P-521 SHA-512 . . . . . . . . . . 37 119 A.4.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 37 120 A.4.2. Validating . . . . . . . . . . . . . . . . . . . . . . 39 121 A.5. Example Plaintext JWS . . . . . . . . . . . . . . . . . . 40 122 A.6. Example JWS Using JWS JSON Serialization . . . . . . . . . 40 123 A.6.1. JWS Per-Signature Protected Headers . . . . . . . . . 41 124 A.6.2. JWS Per-Signature Unprotected Headers . . . . . . . . 41 125 A.6.3. Complete JWS Header Values . . . . . . . . . . . . . . 41 126 A.6.4. Complete JWS JSON Serialization Representation . . . . 42 127 Appendix B. "x5c" (X.509 Certificate Chain) Example . . . . . . . 42 128 Appendix C. Notes on implementing base64url encoding without 129 padding . . . . . . . . . . . . . . . . . . . . . . . 44 130 Appendix D. Notes on Key Selection . . . . . . . . . . . . . . . 45 131 Appendix E. Negative Test Case for "crit" Header Parameter . . . 47 132 Appendix F. Detached Content . . . . . . . . . . . . . . . . . . 48 133 Appendix G. Acknowledgements . . . . . . . . . . . . . . . . . . 48 134 Appendix H. Document History . . . . . . . . . . . . . . . . . . 49 135 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 57 137 1. Introduction 139 JSON Web Signature (JWS) represents content secured with digital 140 signatures or Message Authentication Codes (MACs) using JavaScript 141 Object Notation (JSON) [RFC7159] based data structures. The JWS 142 cryptographic mechanisms provide integrity protection for an 143 arbitrary sequence of octets. 145 Two closely related serializations for JWS objects are defined. The 146 JWS Compact Serialization is a compact, URL-safe representation 147 intended for space constrained environments such as HTTP 148 Authorization headers and URI query parameters. The JWS JSON 149 Serialization represents JWS objects as JSON objects and enables 150 multiple signatures and/or MACs to be applied to the same content. 151 Both share the same cryptographic underpinnings. 153 Cryptographic algorithms and identifiers for use with this 154 specification are described in the separate JSON Web Algorithms (JWA) 155 [JWA] specification and an IANA registry defined by that 156 specification. Related encryption capabilities are described in the 157 separate JSON Web Encryption (JWE) [JWE] specification. 159 Names defined by this specification are short because a core goal is 160 for the resulting representations to be compact. 162 1.1. Notational Conventions 164 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 165 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 166 "OPTIONAL" in this document are to be interpreted as described in Key 167 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 168 these words are used without being spelled in uppercase then they are 169 to be interpreted with their normal natural language meanings. 171 BASE64URL(OCTETS) denotes the base64url encoding of OCTETS, per 172 Section 2. 174 UTF8(STRING) denotes the octets of the UTF-8 [RFC3629] representation 175 of STRING. 177 ASCII(STRING) denotes the octets of the ASCII [USASCII] 178 representation of STRING. 180 The concatenation of two values A and B is denoted as A || B. 182 2. Terminology 184 JSON Web Signature (JWS) 185 A data structure representing a digitally signed or MACed message. 187 JWS Header 188 JSON object containing the parameters describing the cryptographic 189 operations and parameters employed. The JWS Header members are 190 the union of the members of the JWS Protected Header and the JWS 191 Unprotected Header. The members of the JWS Header are Header 192 Parameters. 194 JWS Payload 195 The sequence of octets to be secured -- a.k.a., the message. The 196 payload can contain an arbitrary sequence of octets. 198 JWS Signature 199 Digital signature or MAC over the JWS Protected Header and the JWS 200 Payload. 202 Header Parameter 203 A name/value pair that is member of the JWS Header. 205 JWS Protected Header 206 JSON object that contains the JWS Header Parameters that are 207 integrity protected by the JWS Signature digital signature or MAC 208 operation. For the JWS Compact Serialization, this comprises the 209 entire JWS Header. For the JWS JSON Serialization, this is one 210 component of the JWS Header. 212 JWS Unprotected Header 213 JSON object that contains the JWS Header Parameters that are not 214 integrity protected. This can only be present when using the JWS 215 JSON Serialization. 217 Base64url Encoding 218 Base64 encoding using the URL- and filename-safe character set 219 defined in Section 5 of RFC 4648 [RFC4648], with all trailing '=' 220 characters omitted (as permitted by Section 3.2) and without the 221 inclusion of any line breaks, white space, or other additional 222 characters. (See Appendix C for notes on implementing base64url 223 encoding without padding.) 225 JWS Signing Input 226 The input to the digital signature or MAC computation. Its value 227 is ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 228 BASE64URL(JWS Payload)). 230 JWS Compact Serialization 231 A representation of the JWS as a compact, URL-safe string. 233 JWS JSON Serialization 234 A representation of the JWS as a JSON object. Unlike the JWS 235 Compact Serialization, the JWS JSON Serialization enables multiple 236 digital signatures and/or MACs to be applied to the same content. 237 This representation is neither optimized for compactness nor URL- 238 safe. 240 Collision-Resistant Name 241 A name in a namespace that enables names to be allocated in a 242 manner such that they are highly unlikely to collide with other 243 names. Examples of collision-resistant namespaces include: Domain 244 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 245 X.670 Recommendation series, and Universally Unique IDentifiers 246 (UUIDs) [RFC4122]. When using an administratively delegated 247 namespace, the definer of a name needs to take reasonable 248 precautions to ensure they are in control of the portion of the 249 namespace they use to define the name. 251 StringOrURI 252 A JSON string value, with the additional requirement that while 253 arbitrary string values MAY be used, any value containing a ":" 254 character MUST be a URI [RFC3986]. StringOrURI values are 255 compared as case-sensitive strings with no transformations or 256 canonicalizations applied. 258 3. JSON Web Signature (JWS) Overview 260 JWS represents digitally signed or MACed content using JSON data 261 structures and base64url encoding. A JWS represents these logical 262 values: 264 JWS Header 265 JSON object containing the parameters describing the cryptographic 266 operations and parameters employed. The JWS Header members are 267 the union of the members of the JWS Protected Header and the JWS 268 Unprotected Header, as described below. 270 JWS Payload 271 The sequence of octets to be secured -- a.k.a., the message. The 272 payload can contain an arbitrary sequence of octets. 274 JWS Signature 275 Digital signature or MAC over the JWS Protected Header and the JWS 276 Payload. 278 The JWS Header represents the combination of these values: 280 JWS Protected Header 281 JSON object that contains the JWS Header Parameters that are 282 integrity protected by the JWS Signature digital signature or MAC 283 operation. 285 JWS Unprotected Header 286 JSON object that contains the JWS Header Parameters that are not 287 integrity protected. 289 This document defines two serializations for JWS objects: a compact, 290 URL-safe serialization called the JWS Compact Serialization and a 291 JSON serialization called the JWS JSON Serialization. In both 292 serializations, the JWS Protected Header, JWS Payload, and JWS 293 Signature are base64url encoded for transmission, since JSON lacks a 294 way to directly represent octet sequences. 296 In the JWS Compact Serialization, no JWS Unprotected Header is used. 297 In this case, the JWS Header and the JWS Protected Header are the 298 same. 300 In the JWS Compact Serialization, a JWS object is represented as the 301 combination of these three string values, 302 BASE64URL(UTF8(JWS Protected Header)), 303 BASE64URL(JWS Payload), and 304 BASE64URL(JWS Signature), 305 concatenated in that order, with the three strings being separated by 306 two period ('.') characters. 308 In the JWS JSON Serialization, one or both of the JWS Protected 309 Header and JWS Unprotected Header MUST be present. In this case, the 310 members of the JWS Header are the combination of the members of the 311 JWS Protected Header and the JWS Unprotected Header values that are 312 present. 314 In the JWS JSON Serialization, a JWS object is represented as the 315 combination of these four values, 316 BASE64URL(UTF8(JWS Protected Header)), 317 JWS Unprotected Header, 318 BASE64URL(JWS Payload), and 319 BASE64URL(JWS Signature), 320 with the three base64url encoding result strings and the JWS 321 Unprotected Header value being represented as members within a JSON 322 object. The inclusion of some of these values is OPTIONAL. The JWS 323 JSON Serialization can also represent multiple signature and/or MAC 324 values, rather than just one. See Section 7.2 for more information 325 about the JWS JSON Serialization. 327 3.1. Example JWS 329 This section provides an example of a JWS. Its computation is 330 described in more detail in Appendix A.1, including specifying the 331 exact octet sequences representing the JSON values used and the key 332 value used. 334 The following example JWS Protected Header declares that the encoded 335 object is a JSON Web Token (JWT) [JWT] and the JWS Protected Header 336 and the JWS Payload are secured using the HMAC SHA-256 algorithm: 338 {"typ":"JWT", 339 "alg":"HS256"} 341 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 342 Header)) gives this value: 344 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 346 The UTF-8 representation of following JSON object is used as the JWS 347 Payload. (Note that the payload can be any content, and need not be 348 a representation of a JSON object.) 350 {"iss":"joe", 351 "exp":1300819380, 352 "http://example.com/is_root":true} 354 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value 355 (with line breaks for display purposes only): 357 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 358 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 360 Computing the HMAC of the JWS Signing Input ASCII(BASE64URL(UTF8(JWS 361 Protected Header)) || '.' || BASE64URL(JWS Payload)) with the HMAC 362 SHA-256 algorithm using the key specified in Appendix A.1 and 363 base64url encoding the result yields this BASE64URL(JWS Signature) 364 value: 366 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 368 Concatenating these values in the order Header.Payload.Signature with 369 period ('.') characters between the parts yields this complete JWS 370 representation using the JWS Compact Serialization (with line breaks 371 for display purposes only): 373 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 374 . 375 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 376 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 377 . 378 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 380 See Appendix A for additional examples. 382 4. JWS Header 384 The members of the JSON object(s) representing the JWS Header 385 describe the digital signature or MAC applied to the JWS Protected 386 Header and the JWS Payload and optionally additional properties of 387 the JWS. The Header Parameter names within the JWS Header MUST be 388 unique; recipients MUST either reject JWSs with duplicate Header 389 Parameter names or use a JSON parser that returns only the lexically 390 last duplicate member name, as specified in Section 15.12 (The JSON 391 Object) of ECMAScript 5.1 [ECMAScript]. 393 Implementations are required to understand the specific Header 394 Parameters defined by this specification that are designated as "MUST 395 be understood" and process them in the manner defined in this 396 specification. All other Header Parameters defined by this 397 specification that are not so designated MUST be ignored when not 398 understood. Unless listed as a critical Header Parameter, per 399 Section 4.1.11, all Header Parameters not defined by this 400 specification MUST be ignored when not understood. 402 There are three classes of Header Parameter names: Registered Header 403 Parameter names, Public Header Parameter names, and Private Header 404 Parameter names. 406 4.1. Registered Header Parameter Names 408 The following Header Parameter names are registered in the IANA JSON 409 Web Signature and Encryption Header Parameters registry defined in 410 Section 9.1, with meanings as defined below. 412 As indicated by the common registry, JWSs and JWEs share a common 413 Header Parameter space; when a parameter is used by both 414 specifications, its usage must be compatible between the 415 specifications. 417 4.1.1. "alg" (Algorithm) Header Parameter 419 The "alg" (algorithm) Header Parameter identifies the cryptographic 420 algorithm used to secure the JWS. The signature, MAC, or plaintext 421 value is not valid if the "alg" value does not represent a supported 422 algorithm, or if there is not a key for use with that algorithm 423 associated with the party that digitally signed or MACed the content. 424 "alg" values should either be registered in the IANA JSON Web 425 Signature and Encryption Algorithms registry defined in [JWA] or be a 426 value that contains a Collision-Resistant Name. The "alg" value is a 427 case-sensitive string containing a StringOrURI value. This Header 428 Parameter MUST be present and MUST be understood and processed by 429 implementations. 431 A list of defined "alg" values for this use can be found in the IANA 432 JSON Web Signature and Encryption Algorithms registry defined in 433 [JWA]; the initial contents of this registry are the values defined 434 in Section 3.1 of the JSON Web Algorithms (JWA) [JWA] specification. 436 4.1.2. "jku" (JWK Set URL) Header Parameter 438 The "jku" (JWK Set URL) Header Parameter is a URI [RFC3986] that 439 refers to a resource for a set of JSON-encoded public keys, one of 440 which corresponds to the key used to digitally sign the JWS. The 441 keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The 442 protocol used to acquire the resource MUST provide integrity 443 protection; an HTTP GET request to retrieve the JWK Set MUST use TLS 444 [RFC2818] [RFC5246]; the identity of the server MUST be validated, as 445 per Section 6 of RFC 6125 [RFC6125]. Use of this Header Parameter is 446 OPTIONAL. 448 4.1.3. "jwk" (JSON Web Key) Header Parameter 450 The "jwk" (JSON Web Key) Header Parameter is the public key that 451 corresponds to the key used to digitally sign the JWS. This key is 452 represented as a JSON Web Key [JWK]. Use of this Header Parameter is 453 OPTIONAL. 455 4.1.4. "kid" (Key ID) Header Parameter 457 The "kid" (key ID) Header Parameter is a hint indicating which key 458 was used to secure the JWS. This parameter allows originators to 459 explicitly signal a change of key to recipients. The structure of 460 the "kid" value is unspecified. Its value MUST be a string. Use of 461 this Header Parameter is OPTIONAL. 463 When used with a JWK, the "kid" value is used to match a JWK "kid" 464 parameter value. 466 4.1.5. "x5u" (X.509 URL) Header Parameter 468 The "x5u" (X.509 URL) Header Parameter is a URI [RFC3986] that refers 469 to a resource for the X.509 public key certificate or certificate 470 chain [RFC5280] corresponding to the key used to digitally sign the 471 JWS. The identified resource MUST provide a representation of the 472 certificate or certificate chain that conforms to RFC 5280 [RFC5280] 473 in PEM encoded form [RFC1421]. The certificate containing the public 474 key corresponding to the key used to digitally sign the JWS MUST be 475 the first certificate. This MAY be followed by additional 476 certificates, with each subsequent certificate being the one used to 477 certify the previous one. The protocol used to acquire the resource 478 MUST provide integrity protection; an HTTP GET request to retrieve 479 the certificate MUST use TLS [RFC2818] [RFC5246]; the identity of the 480 server MUST be validated, as per Section 6 of RFC 6125 [RFC6125]. 481 Use of this Header Parameter is OPTIONAL. 483 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter 485 The "x5c" (X.509 Certificate Chain) Header Parameter contains the 486 X.509 public key certificate or certificate chain [RFC5280] 487 corresponding to the key used to digitally sign the JWS. The 488 certificate or certificate chain is represented as a JSON array of 489 certificate value strings. Each string in the array is a base64 490 encoded ([RFC4648] Section 4 -- not base64url encoded) DER 491 [ITU.X690.1994] PKIX certificate value. The certificate containing 492 the public key corresponding to the key used to digitally sign the 493 JWS MUST be the first certificate. This MAY be followed by 494 additional certificates, with each subsequent certificate being the 495 one used to certify the previous one. The recipient MUST validate 496 the certificate chain according to [RFC5280] and reject the signature 497 if any validation failure occurs. Use of this Header Parameter is 498 OPTIONAL. 500 See Appendix B for an example "x5c" value. 502 4.1.7. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter 504 The "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter is a 505 base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER 506 encoding of the X.509 certificate [RFC5280] corresponding to the key 507 used to digitally sign the JWS. Use of this Header Parameter is 508 OPTIONAL. 510 4.1.8. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 511 Parameter 513 The "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 514 Parameter is a base64url encoded SHA-256 thumbprint (a.k.a. digest) 515 of the DER encoding of the X.509 certificate [RFC5280] corresponding 516 to the key used to digitally sign the JWS. Use of this Header 517 Parameter is OPTIONAL. 519 4.1.9. "typ" (Type) Header Parameter 521 The "typ" (type) Header Parameter is used by JWS applications to 522 declare the MIME Media Type [IANA.MediaTypes] of this complete JWS 523 object. This is intended for use by the application when more than 524 one kind of object could be present in an application data structure 525 that can contain a JWS object; the application can use this value to 526 disambiguate among the different kinds of objects that might be 527 present. It will typically not be used by applications when the kind 528 of object is already known. This parameter has no effect upon the 529 JWS processing. Use of this Header Parameter is OPTIONAL. 531 Per [RFC2045], all media type values, subtype values, and parameter 532 names are case-insensitive. However, parameter values are case- 533 sensitive unless otherwise specified for the specific parameter. 535 To keep messages compact in common situations, it is RECOMMENDED that 536 senders omit an "application/" prefix of a media type value in a 537 "typ" Header Parameter when no other '/' appears in the media type 538 value. A recipient using the media type value MUST treat it as if 539 "application/" were prepended to any "typ" value not containing a 540 '/'. For instance, a "typ" value of "example" SHOULD be used to 541 represent the "application/example" media type; whereas, the media 542 type "application/example;part="1/2"" cannot be shortened to 543 "example;part="1/2"". 545 The "typ" value "JOSE" can be used by applications to indicate that 546 this object is a JWS or JWE using the JWS Compact Serialization or 547 the JWE Compact Serialization. The "typ" value "JOSE+JSON" can be 548 used by applications to indicate that this object is a JWS or JWE 549 using the JWS JSON Serialization or the JWE JSON Serialization. 550 Other type values can also be used by applications. 552 4.1.10. "cty" (Content Type) Header Parameter 554 The "cty" (content type) Header Parameter is used by JWS applications 555 to declare the MIME Media Type [IANA.MediaTypes] of the secured 556 content (the payload). This is intended for use by the application 557 when more than one kind of object could be present in the JWS 558 payload; the application can use this value to disambiguate among the 559 different kinds of objects that might be present. It will typically 560 not be used by applications when the kind of object is already known. 561 This parameter has no effect upon the JWS processing. Use of this 562 Header Parameter is OPTIONAL. 564 Per [RFC2045], all media type values, subtype values, and parameter 565 names are case-insensitive. However, parameter values are case- 566 sensitive unless otherwise specified for the specific parameter. 568 To keep messages compact in common situations, it is RECOMMENDED that 569 senders omit an "application/" prefix of a media type value in a 570 "cty" Header Parameter when no other '/' appears in the media type 571 value. A recipient using the media type value MUST treat it as if 572 "application/" were prepended to any "cty" value not containing a 573 '/'. For instance, a "cty" value of "example" SHOULD be used to 574 represent the "application/example" media type; whereas, the media 575 type "application/example;part="1/2"" cannot be shortened to 576 "example;part="1/2"". 578 4.1.11. "crit" (Critical) Header Parameter 580 The "crit" (critical) Header Parameter indicates that extensions to 581 the initial RFC versions of [[ this specification ]] and [JWA] are 582 being used that MUST be understood and processed. Its value is an 583 array listing the Header Parameter names present in the JWS Header 584 that use those extensions. If any of the listed extension Header 585 Parameters are not understood and supported by the receiver, it MUST 586 reject the JWS. Senders MUST NOT include Header Parameter names 587 defined by the initial RFC versions of [[ this specification ]] or 588 [JWA] for use with JWS, duplicate names, or names that do not occur 589 as Header Parameter names within the JWS Header in the "crit" list. 590 Senders MUST NOT use the empty list "[]" as the "crit" value. 591 Recipients MAY reject the JWS if the critical list contains any 592 Header Parameter names defined by the initial RFC versions of [[ this 593 specification ]] or [JWA] for use with JWS, or any other constraints 594 on its use are violated. This Header Parameter MUST be integrity 595 protected, and therefore MUST occur only within the JWS Protected 596 Header, when used. Use of this Header Parameter is OPTIONAL. This 597 Header Parameter MUST be understood and processed by implementations. 599 An example use, along with a hypothetical "exp" (expiration-time) 600 field is: 602 {"alg":"ES256", 603 "crit":["exp"], 604 "exp":1363284000 605 } 607 4.2. Public Header Parameter Names 609 Additional Header Parameter names can be defined by those using JWSs. 610 However, in order to prevent collisions, any new Header Parameter 611 name should either be registered in the IANA JSON Web Signature and 612 Encryption Header Parameters registry defined in Section 9.1 or be a 613 Public Name: a value that contains a Collision-Resistant Name. In 614 each case, the definer of the name or value needs to take reasonable 615 precautions to make sure they are in control of the part of the 616 namespace they use to define the Header Parameter name. 618 New Header Parameters should be introduced sparingly, as they can 619 result in non-interoperable JWSs. 621 4.3. Private Header Parameter Names 623 A producer and consumer of a JWS may agree to use Header Parameter 624 names that are Private Names: names that are not Registered Header 625 Parameter names Section 4.1 or Public Header Parameter names 626 Section 4.2. Unlike Public Header Parameter names, Private Header 627 Parameter names are subject to collision and should be used with 628 caution. 630 5. Producing and Consuming JWSs 632 5.1. Message Signature or MAC Computation 634 To create a JWS, one MUST perform these steps. The order of the 635 steps is not significant in cases where there are no dependencies 636 between the inputs and outputs of the steps. 637 1. Create the content to be used as the JWS Payload. 638 2. Compute the encoded payload value BASE64URL(JWS Payload). 639 3. Create the JSON object(s) containing the desired set of Header 640 Parameters, which together comprise the JWS Header: the JWS 641 Protected Header, and if the JWS JSON Serialization is being 642 used, the JWS Unprotected Header. 643 4. Compute the encoded header value BASE64URL(UTF8(JWS Protected 644 Header)). If the JWS Protected Header is not present (which can 645 only happen when using the JWS JSON Serialization and no 646 "protected" member is present), let this value be the empty 647 string. 648 5. Compute the JWS Signature in the manner defined for the 649 particular algorithm being used over the JWS Signing Input 650 ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 651 BASE64URL(JWS Payload)). The "alg" (algorithm) Header Parameter 652 MUST be present in the JWS Header, with the algorithm value 653 accurately representing the algorithm used to construct the JWS 654 Signature. 655 6. Compute the encoded signature value BASE64URL(JWS Signature). 656 7. These three encoded values are used in both the JWS Compact 657 Serialization and the JWS JSON Serialization representations. 658 8. If the JWS JSON Serialization is being used, repeat this process 659 (steps 3-7) for each digital signature or MAC operation being 660 performed. 661 9. Create the desired serialized output. The JWS Compact 662 Serialization of this result is BASE64URL(UTF8(JWS Protected 663 Header)) || '.' || BASE64URL(JWS Payload) || '.' || BASE64URL(JWS 664 Signature). The JWS JSON Serialization is described in 665 Section 7.2. 667 5.2. Message Signature or MAC Validation 669 When validating a JWS, the following steps MUST be taken. The order 670 of the steps is not significant in cases where there are no 671 dependencies between the inputs and outputs of the steps. If any of 672 the listed steps fails, then the signature or MAC cannot be 673 validated. 675 It is an application decision which signatures, MACs, or plaintext 676 values must successfully validate for the JWS to be accepted. In 677 some cases, all must successfully validate or the JWS will be 678 rejected. In other cases, only a specific signature, MAC, or 679 plaintext value needs to be successfully validated. However, in all 680 cases, at least one signature, MAC, or plaintext value MUST 681 successfully validate or the JWS MUST be rejected. 683 1. Parse the JWS representation to extract the serialized values 684 for the components of the JWS -- when using the JWS Compact 685 Serialization, the base64url encoded representations of the JWS 686 Protected Header, the JWS Payload, and the JWS Signature, and 687 when using the JWS JSON Serialization, also the unencoded JWS 688 Unprotected Header value. When using the JWS Compact 689 Serialization, the JWS Protected Header, the JWS Payload, and 690 the JWS Signature are represented as base64url encoded values in 691 that order, separated by two period ('.') characters. The JWS 692 JSON Serialization is described in Section 7.2. 693 2. The encoded representation of the JWS Protected Header MUST be 694 successfully base64url decoded following the restriction that no 695 padding characters have been used. 696 3. The resulting octet sequence MUST be a UTF-8 encoded 697 representation of a completely valid JSON object conforming to 698 [RFC7159], which is the JWS Protected Header. 699 4. If using the JWS Compact Serialization, let the JWS Header be 700 the JWS Protected Header; otherwise, when using the JWS JSON 701 Serialization, let the JWS Header be the union of the members of 702 the corresponding JWS Protected Header and JWS Unprotected 703 Header, all of which must be completely valid JSON objects. 704 5. The resulting JWS Header MUST NOT contain duplicate Header 705 Parameter names. When using the JWS JSON Serialization, this 706 restriction includes that the same Header Parameter name also 707 MUST NOT occur in distinct JSON object values that together 708 comprise the JWS Header. 709 6. Verify that the implementation understands and can process all 710 fields that it is required to support, whether required by this 711 specification, by the algorithm being used, or by the "crit" 712 Header Parameter value, and that the values of those parameters 713 are also understood and supported. 714 7. The encoded representation of the JWS Payload MUST be 715 successfully base64url decoded following the restriction that no 716 padding characters have been used. 717 8. The encoded representation of the JWS Signature MUST be 718 successfully base64url decoded following the restriction that no 719 padding characters have been used. 720 9. The JWS Signature MUST be successfully validated against the JWS 721 Signing Input ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' 722 || BASE64URL(JWS Payload)) in the manner defined for the 723 algorithm being used, which MUST be accurately represented by 724 the value of the "alg" (algorithm) Header Parameter, which MUST 725 be present. 726 10. If the JWS JSON Serialization is being used, repeat this process 727 (steps 4-9) for each digital signature or MAC value contained in 728 the representation. 730 5.3. String Comparison Rules 732 Processing a JWS inevitably requires comparing known strings to 733 members and values in a JSON object. For example, in checking what 734 the algorithm is, the Unicode string "alg" will be checked against 735 the member names in the JWS Header to see if there is a matching 736 Header Parameter name. The same process is then used to determine if 737 the value of the "alg" Header Parameter represents a supported 738 algorithm. 740 Since the only string comparison operations that are performed are 741 equality and inequality, the same rules can be used for comparing 742 both member names and member values against known strings. The JSON 743 rules for doing member name comparison are described in Section 8.3 744 of [RFC7159]. 746 Also, see the JSON security considerations in Section 10.6 and the 747 Unicode security considerations in Section 10.7. 749 6. Key Identification 751 It is necessary for the recipient of a JWS to be able to determine 752 the key that was employed for the digital signature or MAC operation. 753 The key employed can be identified using the Header Parameter methods 754 described in Section 4.1 or can be identified using methods that are 755 outside the scope of this specification. Specifically, the Header 756 Parameters "jku", "jwk", "kid", "x5u", "x5c", "x5t", and "x5t#S256" 757 can be used to identify the key used. These Header Parameters MUST 758 be integrity protected if the information that they convey is to be 759 utilized in a trust decision. 761 The sender SHOULD include sufficient information in the Header 762 Parameters to identify the key used, unless the application uses 763 another means or convention to determine the key used. Validation of 764 the signature or MAC fails when the algorithm used requires a key 765 (which is true of all algorithms except for "none") and the key used 766 cannot be determined. 768 The means of exchanging any shared symmetric keys used is outside the 769 scope of this specification. 771 Also, see Appendix D for notes on possible key selection algorithms. 773 7. Serializations 775 JWS objects use one of two serializations, the JWS Compact 776 Serialization or the JWS JSON Serialization. Applications using this 777 specification need to specify what serialization and serialization 778 features are used for that application. For instance, applications 779 might specify that only the JWS JSON Serialization is used, that only 780 JWS JSON Serialization support for a single signature or MAC value is 781 used, or that support for multiple signatures and/or MAC values is 782 used. JWS implementations only need to implement the features needed 783 for the applications they are designed to support. 785 7.1. JWS Compact Serialization 787 The JWS Compact Serialization represents digitally signed or MACed 788 content as a compact URL-safe string. This string is 789 BASE64URL(UTF8(JWS Protected Header)) || '.' || BASE64URL(JWS 790 Payload) || '.' || BASE64URL(JWS Signature). Only one signature/MAC 791 is supported by the JWS Compact Serialization and it provides no 792 syntax to represent a JWS Unprotected Header value. 794 7.2. JWS JSON Serialization 796 The JWS JSON Serialization represents digitally signed or MACed 797 content as a JSON object. Content using the JWS JSON Serialization 798 can be secured with more than one digital signature and/or MAC 799 operation. This representation is neither optimized for compactness 800 nor URL-safe. 802 The following members are defined for use in top-level JSON objects 803 used for the JWS JSON Serialization: 804 payload 805 The "payload" member MUST be present and contain the value 806 BASE64URL(JWS Payload). 807 signatures 808 The "signatures" member value MUST be an array of JSON objects. 809 Each object represents a signature or MAC over the JWS Payload and 810 the JWS Protected Header. 812 The following members are defined for use in the JSON objects that 813 are elements of the "signatures" array: 814 protected 815 The "protected" member MUST be present and contain the value 816 BASE64URL(UTF8(JWS Protected Header)) when the JWS Protected 817 Header value is non-empty; otherwise, it MUST be absent. These 818 Header Parameter values are integrity protected. 819 header 820 The "header" member MUST be present and contain the value JWS 821 Unprotected Header when the JWS Unprotected Header value is non- 822 empty; otherwise, it MUST be absent. This value is represented as 823 an unencoded JSON object, rather than as a string. These Header 824 Parameter values are not integrity protected. 825 signature 826 The "signature" member MUST be present and contain the value 827 BASE64URL(JWS Signature). 829 At least one of the "protected" and "header" members MUST be present 830 for each signature/MAC computation so that an "alg" Header Parameter 831 value is conveyed. 833 Additional members can be present in both the JSON objects defined 834 above; if not understood by implementations encountering them, they 835 MUST be ignored. 837 The Header Parameter values used when creating or validating 838 individual signature or MAC values are the union of the two sets of 839 Header Parameter values that may be present: (1) the JWS Protected 840 Header represented in the "protected" member of the signature/MAC's 841 array element, and (2) the JWS Unprotected Header in the "header" 842 member of the signature/MAC's array element. The union of these sets 843 of Header Parameters comprises the JWS Header. The Header Parameter 844 names in the two locations MUST be disjoint. 846 Each JWS Signature value is computed using the parameters of the 847 corresponding JWS Header value in the same manner as for the JWS 848 Compact Serialization. This has the desirable property that each JWS 849 Signature value represented in the "signatures" array is identical to 850 the value that would have been computed for the same parameter in the 851 JWS Compact Serialization, provided that the JWS Protected Header 852 value for that signature/MAC computation (which represents the 853 integrity-protected Header Parameter values) matches that used in the 854 JWS Compact Serialization. 856 In summary, the syntax of a JWS using the JWS JSON Serialization is 857 as follows: 859 { 860 "payload":"", 861 "signatures":[ 862 {"protected":"", 863 "header":, 864 "signature":""}, 865 ... 866 {"protected":"", 867 "header":, 868 "signature":""}] 869 } 871 See Appendix A.6 for an example of computing a JWS using the JWS JSON 872 Serialization. 874 8. TLS Requirements 876 Implementations MUST support TLS. Which version(s) ought to be 877 implemented will vary over time, and depend on the widespread 878 deployment and known security vulnerabilities at the time of 879 implementation. At the time of this writing, TLS version 1.2 880 [RFC5246] is the most recent version. 882 To protect against information disclosure and tampering, 883 confidentiality protection MUST be applied using TLS with a 884 ciphersuite that provides confidentiality and integrity protection. 886 Whenever TLS is used, the identity of the service provider encoded in 887 the TLS server certificate MUST be verified using the procedures 888 described in Section 6 of RFC 6125 [RFC6125]. 890 9. IANA Considerations 892 The following registration procedure is used for all the registries 893 established by this specification. 895 Values are registered with a Specification Required [RFC5226] after a 896 two-week review period on the [TBD]@ietf.org mailing list, on the 897 advice of one or more Designated Experts. However, to allow for the 898 allocation of values prior to publication, the Designated Expert(s) 899 may approve registration once they are satisfied that such a 900 specification will be published. 902 Registration requests must be sent to the [TBD]@ietf.org mailing list 903 for review and comment, with an appropriate subject (e.g., "Request 904 for access token type: example"). [[ Note to the RFC Editor: The name 905 of the mailing list should be determined in consultation with the 906 IESG and IANA. Suggested name: jose-reg-review. ]] 908 Within the review period, the Designated Expert(s) will either 909 approve or deny the registration request, communicating this decision 910 to the review list and IANA. Denials should include an explanation 911 and, if applicable, suggestions as to how to make the request 912 successful. Registration requests that are undetermined for a period 913 longer than 21 days can be brought to the IESG's attention (using the 914 iesg@iesg.org mailing list) for resolution. 916 Criteria that should be applied by the Designated Expert(s) includes 917 determining whether the proposed registration duplicates existing 918 functionality, determining whether it is likely to be of general 919 applicability or whether it is useful only for a single application, 920 and whether the registration makes sense. 922 IANA must only accept registry updates from the Designated Expert(s) 923 and should direct all requests for registration to the review mailing 924 list. 926 It is suggested that multiple Designated Experts be appointed who are 927 able to represent the perspectives of different applications using 928 this specification, in order to enable broadly-informed review of 929 registration decisions. In cases where a registration decision could 930 be perceived as creating a conflict of interest for a particular 931 Expert, that Expert should defer to the judgment of the other 932 Expert(s). 934 9.1. JSON Web Signature and Encryption Header Parameters Registry 936 This specification establishes the IANA JSON Web Signature and 937 Encryption Header Parameters registry for JWS and JWE Header 938 Parameter names. The registry records the Header Parameter name and 939 a reference to the specification that defines it. The same Header 940 Parameter name can be registered multiple times, provided that the 941 parameter usage is compatible between the specifications. Different 942 registrations of the same Header Parameter name will typically use 943 different Header Parameter Usage Location(s) values. 945 9.1.1. Registration Template 947 Header Parameter Name: 948 The name requested (e.g., "example"). Because a core goal of this 949 specification is for the resulting representations to be compact, 950 it is RECOMMENDED that the name be short -- not to exceed 8 951 characters without a compelling reason to do so. This name is 952 case-sensitive. Names may not match other registered names in a 953 case-insensitive manner unless the Designated Expert(s) state that 954 there is a compelling reason to allow an exception in this 955 particular case. 956 Header Parameter Description: 957 Brief description of the Header Parameter (e.g., "Example 958 description"). 959 Header Parameter Usage Location(s): 960 The Header Parameter usage locations, which should be one or more 961 of the values "JWS" or "JWE". 962 Change Controller: 963 For Standards Track RFCs, state "IESG". For others, give the name 964 of the responsible party. Other details (e.g., postal address, 965 email address, home page URI) may also be included. 966 Specification Document(s): 967 Reference to the document(s) that specify the parameter, 968 preferably including URI(s) that can be used to retrieve copies of 969 the document(s). An indication of the relevant sections may also 970 be included but is not required. 972 9.1.2. Initial Registry Contents 974 This specification registers the Header Parameter names defined in 975 Section 4.1 in this registry. 977 o Header Parameter Name: "alg" 978 o Header Parameter Description: Algorithm 979 o Header Parameter Usage Location(s): JWS 980 o Change Controller: IESG 981 o Specification Document(s): Section 4.1.1 of [[ this document ]] 983 o Header Parameter Name: "jku" 984 o Header Parameter Description: JWK Set URL 985 o Header Parameter Usage Location(s): JWS 986 o Change Controller: IESG 987 o Specification Document(s): Section 4.1.2 of [[ this document ]] 989 o Header Parameter Name: "jwk" 990 o Header Parameter Description: JSON Web Key 991 o Header Parameter Usage Location(s): JWS 992 o Change Controller: IESG 993 o Specification document(s): Section 4.1.3 of [[ this document ]] 995 o Header Parameter Name: "kid" 996 o Header Parameter Description: Key ID 997 o Header Parameter Usage Location(s): JWS 998 o Change Controller: IESG 999 o Specification Document(s): Section 4.1.4 of [[ this document ]] 1001 o Header Parameter Name: "x5u" 1002 o Header Parameter Description: X.509 URL 1003 o Header Parameter Usage Location(s): JWS 1004 o Change Controller: IESG 1005 o Specification Document(s): Section 4.1.5 of [[ this document ]] 1007 o Header Parameter Name: "x5c" 1008 o Header Parameter Description: X.509 Certificate Chain 1009 o Header Parameter Usage Location(s): JWS 1010 o Change Controller: IESG 1011 o Specification Document(s): Section 4.1.6 of [[ this document ]] 1013 o Header Parameter Name: "x5t" 1014 o Header Parameter Description: X.509 Certificate SHA-1 Thumbprint 1015 o Header Parameter Usage Location(s): JWS 1016 o Change Controller: IESG 1017 o Specification Document(s): Section 4.1.7 of [[ this document ]] 1019 o Header Parameter Name: "x5t#S256" 1020 o Header Parameter Description: X.509 Certificate SHA-256 Thumbprint 1021 o Header Parameter Usage Location(s): JWS 1022 o Change Controller: IESG 1023 o Specification Document(s): Section 4.1.8 of [[ this document ]] 1025 o Header Parameter Name: "typ" 1026 o Header Parameter Description: Type 1027 o Header Parameter Usage Location(s): JWS 1028 o Change Controller: IESG 1029 o Specification Document(s): Section 4.1.9 of [[ this document ]] 1030 o Header Parameter Name: "cty" 1031 o Header Parameter Description: Content Type 1032 o Header Parameter Usage Location(s): JWS 1033 o Change Controller: IESG 1034 o Specification Document(s): Section 4.1.10 of [[ this document ]] 1036 o Header Parameter Name: "crit" 1037 o Header Parameter Description: Critical 1038 o Header Parameter Usage Location(s): JWS 1039 o Change Controller: IESG 1040 o Specification Document(s): Section 4.1.11 of [[ this document ]] 1042 9.2. Media Type Registration 1044 9.2.1. Registry Contents 1046 This specification registers the "application/jose" Media Type 1047 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes], which 1048 can be used to indicate that the content is a JWS or JWE object using 1049 the JWS Compact Serialization or the JWE Compact Serialization and 1050 the "application/jose+json" Media Type in the MIME Media Types 1051 registry, which can be used to indicate that the content is a JWS or 1052 JWE object using the JWS JSON Serialization or the JWE JSON 1053 Serialization. 1055 o Type name: application 1056 o Subtype name: jose 1057 o Required parameters: n/a 1058 o Optional parameters: n/a 1059 o Encoding considerations: 8bit; application/jose values are encoded 1060 as a series of base64url encoded values (some of which may be the 1061 empty string) separated by period ('.') characters. 1062 o Security considerations: See the Security Considerations section 1063 of [[ this document ]] 1064 o Interoperability considerations: n/a 1065 o Published specification: [[ this document ]] 1066 o Applications that use this media type: OpenID Connect, Mozilla 1067 Persona, Salesforce, Google, Android, Windows Azure, Xbox One, and 1068 numerous others that use JWTs 1069 o Additional information: Magic number(s): n/a, File extension(s): 1070 n/a, Macintosh file type code(s): n/a 1071 o Person & email address to contact for further information: Michael 1072 B. Jones, mbj@microsoft.com 1073 o Intended usage: COMMON 1074 o Restrictions on usage: none 1075 o Author: Michael B. Jones, mbj@microsoft.com 1076 o Change Controller: IESG 1078 o Type name: application 1079 o Subtype name: jose+json 1080 o Required parameters: n/a 1081 o Optional parameters: n/a 1082 o Encoding considerations: 8bit; application/jose+json values are 1083 represented as a JSON Object; UTF-8 encoding SHOULD be employed 1084 for the JSON object. 1085 o Security considerations: See the Security Considerations section 1086 of [[ this document ]] 1087 o Interoperability considerations: n/a 1088 o Published specification: [[ this document ]] 1089 o Applications that use this media type: TBD 1090 o Additional information: Magic number(s): n/a, File extension(s): 1091 n/a, Macintosh file type code(s): n/a 1092 o Person & email address to contact for further information: Michael 1093 B. Jones, mbj@microsoft.com 1094 o Intended usage: COMMON 1095 o Restrictions on usage: none 1096 o Author: Michael B. Jones, mbj@microsoft.com 1097 o Change Controller: IESG 1099 10. Security Considerations 1101 All of the security issues faced by any cryptographic application 1102 must be faced by a JWS/JWE/JWK agent. Among these issues are 1103 protecting the user's asymmetric private and symmetric secret keys, 1104 preventing various attacks, and helping avoid mistakes such as 1105 inadvertently encrypting a message to the wrong recipient. The 1106 entire list of security considerations is beyond the scope of this 1107 document, but some significant concerns are listed here. 1109 All the security considerations in XML DSIG 2.0 1110 [W3C.NOTE-xmldsig-core2-20130411], also apply to this specification, 1111 other than those that are XML specific. Likewise, many of the best 1112 practices documented in XML Signature Best Practices 1113 [W3C.NOTE-xmldsig-bestpractices-20130411] also apply to this 1114 specification, other than those that are XML specific. 1116 10.1. Key Entropy 1118 Keys are only as strong as the amount of entropy used to generate 1119 them. A minimum of 128 bits of entropy should be used for all keys, 1120 and depending upon the application context, more may be required. In 1121 particular, it may be difficult to generate sufficiently random 1122 values in some browsers and application environments. 1124 10.2. Chosen Plaintext Attacks 1126 Creators of JWSs should not allow third parties to insert arbitrary 1127 content into the message without adding entropy not controlled by the 1128 third party. 1130 10.3. Timing Attacks 1132 When cryptographic algorithms are implemented in such a way that 1133 successful operations take a different amount of time than 1134 unsuccessful operations, attackers may be able to use the time 1135 difference to obtain information about the keys employed. Therefore, 1136 such timing differences must be avoided. 1138 10.4. Differences between Digital Signatures and MACs 1140 While MACs and digital signatures can both be used for integrity 1141 checking, there are some significant differences between the security 1142 properties that each of them provides. These need to be taken into 1143 consideration when designing protocols and selecting the algorithms 1144 to be used in protocols. 1146 Both signatures and MACs provide for integrity checking -- verifying 1147 that the message has not been modified since the integrity value was 1148 computed. However, MACs provide for origination identification only 1149 under specific circumstances. It can normally be assumed that a 1150 private key used for a signature is only in the hands of a single 1151 entity (although perhaps a distributed entity, in the case of 1152 replicated servers); however, a MAC key needs to be in the hands of 1153 all the entities that use it for integrity computation and checking. 1154 This means that origination can only be determined if a MAC key is 1155 known only to two entities and the receiver knows that it did not 1156 create the message. MAC validation cannot be used to prove 1157 origination to a third party. 1159 10.5. SHA-1 Certificate Thumbprints 1161 A SHA-1 hash is used when computing "x5t" (X.509 Certificate SHA-1 1162 Thumbprint) values, for compatibility reasons. Should an effective 1163 means of producing SHA-1 hash collisions be developed, and should an 1164 attacker wish to interfere with the use of a known certificate on a 1165 given system, this could be accomplished by creating another 1166 certificate whose SHA-1 hash value is the same and adding it to the 1167 certificate store used by the intended victim. A prerequisite to 1168 this attack succeeding is the attacker having write access to the 1169 intended victim's certificate store. 1171 Alternatively, the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) 1172 Header Parameter could be used instead of "x5t". However, at the 1173 time of this writing, no development platform is known to support 1174 SHA-256 certificate thumbprints. 1176 10.6. JSON Security Considerations 1178 Strict JSON [RFC7159] validation is a security requirement. If 1179 malformed JSON is received, then the intent of the sender is 1180 impossible to reliably discern. Ambiguous and potentially 1181 exploitable situations could arise if the JSON parser used does not 1182 reject malformed JSON syntax. In particular, any JSON inputs not 1183 conforming to the JSON-text syntax defined in RFC 7159 input MUST be 1184 rejected in their entirety. 1186 Section 4 of the JSON Data Interchange Format specification [RFC7159] 1187 states "The names within an object SHOULD be unique", whereas this 1188 specification states that "Header Parameter names within this object 1189 MUST be unique; recipients MUST either reject JWSs with duplicate 1190 Header Parameter names or use a JSON parser that returns only the 1191 lexically last duplicate member name, as specified in Section 15.12 1192 (The JSON Object) of ECMAScript 5.1 [ECMAScript]". Thus, this 1193 specification requires that the Section 4 "SHOULD" be treated as a 1194 "MUST" by senders and that it be either treated as a "MUST" or in the 1195 manner specified in ECMAScript 5.1 by receivers. Ambiguous and 1196 potentially exploitable situations could arise if the JSON parser 1197 used does not enforce the uniqueness of member names or returns an 1198 unpredictable value for duplicate member names. 1200 Some JSON parsers might not reject input that contains extra 1201 significant characters after a valid input. For instance, the input 1202 "{"tag":"value"}ABCD" contains a valid JSON-text object followed by 1203 the extra characters "ABCD". Such input MUST be rejected in its 1204 entirety. 1206 10.7. Unicode Comparison Security Considerations 1208 Header Parameter names and algorithm names are Unicode strings. For 1209 security reasons, the representations of these names must be compared 1210 verbatim after performing any escape processing (as per Section 8.3 1211 of [RFC7159]). This means, for instance, that these JSON strings 1212 must compare as being equal ("sig", "\u0073ig"), whereas these must 1213 all compare as being not equal to the first set or to each other 1214 ("SIG", "Sig", "si\u0047"). 1216 JSON strings can contain characters outside the Unicode Basic 1217 Multilingual Plane. For instance, the G clef character (U+1D11E) may 1218 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWS 1219 implementations SHOULD ensure that characters outside the Basic 1220 Multilingual Plane are preserved and compared correctly; 1221 alternatively, if this is not possible due to these characters 1222 exercising limitations present in the underlying JSON implementation, 1223 then input containing them MUST be rejected. 1225 11. References 1227 11.1. Normative References 1229 [ECMAScript] 1230 Ecma International, "ECMAScript Language Specification, 1231 5.1 Edition", ECMA 262, June 2011. 1233 [IANA.MediaTypes] 1234 Internet Assigned Numbers Authority (IANA), "MIME Media 1235 Types", 2005. 1237 [ITU.X690.1994] 1238 International Telecommunications Union, "Information 1239 Technology - ASN.1 encoding rules: Specification of Basic 1240 Encoding Rules (BER), Canonical Encoding Rules (CER) and 1241 Distinguished Encoding Rules (DER)", ITU-T Recommendation 1242 X.690, 1994. 1244 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 1245 draft-ietf-jose-json-web-algorithms (work in progress), 1246 June 2014. 1248 [JWK] Jones, M., "JSON Web Key (JWK)", 1249 draft-ietf-jose-json-web-key (work in progress), 1250 June 2014. 1252 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 1253 Mail: Part I: Message Encryption and Authentication 1254 Procedures", RFC 1421, February 1993. 1256 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1257 Extensions (MIME) Part One: Format of Internet Message 1258 Bodies", RFC 2045, November 1996. 1260 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1261 Extensions (MIME) Part Two: Media Types", RFC 2046, 1262 November 1996. 1264 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1265 Requirement Levels", BCP 14, RFC 2119, March 1997. 1267 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1269 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1270 10646", STD 63, RFC 3629, November 2003. 1272 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1273 Resource Identifier (URI): Generic Syntax", STD 66, 1274 RFC 3986, January 2005. 1276 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1277 Encodings", RFC 4648, October 2006. 1279 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1280 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1282 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1283 Housley, R., and W. Polk, "Internet X.509 Public Key 1284 Infrastructure Certificate and Certificate Revocation List 1285 (CRL) Profile", RFC 5280, May 2008. 1287 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 1288 Verification of Domain-Based Application Service Identity 1289 within Internet Public Key Infrastructure Using X.509 1290 (PKIX) Certificates in the Context of Transport Layer 1291 Security (TLS)", RFC 6125, March 2011. 1293 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 1294 Interchange Format", RFC 7159, March 2014. 1296 [USASCII] American National Standards Institute, "Coded Character 1297 Set -- 7-bit American Standard Code for Information 1298 Interchange", ANSI X3.4, 1986. 1300 11.2. Informative References 1302 [CanvasApp] 1303 Facebook, "Canvas Applications", 2010. 1305 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 1306 September 2010. 1308 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 1309 draft-ietf-jose-json-web-encryption (work in progress), 1310 June 2014. 1312 [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 1313 (JWT)", draft-ietf-oauth-json-web-token (work in 1314 progress), June 2014. 1316 [MagicSignatures] 1317 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 1318 Signatures", January 2011. 1320 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 1321 Unique IDentifier (UUID) URN Namespace", RFC 4122, 1322 July 2005. 1324 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1325 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1326 May 2008. 1328 [W3C.NOTE-xmldsig-bestpractices-20130411] 1329 Hirsch, F. and P. Datta, "XML Signature Best Practices", 1330 World Wide Web Consortium Note NOTE-xmldsig-bestpractices- 1331 20130411, April 2013, . 1334 [W3C.NOTE-xmldsig-core2-20130411] 1335 Eastlake, D., Reagle, J., Solo, D., Hirsch, F., Roessler, 1336 T., Yiu, K., Datta, P., and S. Cantor, "XML Signature 1337 Syntax and Processing Version 2.0", World Wide Web 1338 Consortium Note NOTE-xmldsig-core2-20130411, April 2013, 1339 . 1341 Appendix A. JWS Examples 1343 This section provides several examples of JWSs. While the first 1344 three examples all represent JSON Web Tokens (JWTs) [JWT], the 1345 payload can be any octet sequence, as shown in Appendix A.4. 1347 A.1. Example JWS using HMAC SHA-256 1349 A.1.1. Encoding 1351 The following example JWS Protected Header declares that the data 1352 structure is a JSON Web Token (JWT) [JWT] and the JWS Signing Input 1353 is secured using the HMAC SHA-256 algorithm. 1355 {"typ":"JWT", 1356 "alg":"HS256"} 1358 To remove potential ambiguities in the representation of the JSON 1359 object above, the actual octet sequence representing UTF8(JWS 1360 Protected Header) used in this example is also included below. (Note 1361 that ambiguities can arise due to differing platform representations 1362 of line breaks (CRLF versus LF), differing spacing at the beginning 1363 and ends of lines, whether the last line has a terminating line break 1364 or not, and other causes. In the representation used in this 1365 example, the first line has no leading or trailing spaces, a CRLF 1366 line break (13, 10) occurs between the first and second lines, the 1367 second line has one leading space (32) and no trailing spaces, and 1368 the last line does not have a terminating line break.) The octets 1369 representing UTF8(JWS Protected Header) in this example (using JSON 1370 array notation) are: 1372 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 1373 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 1375 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1376 Header)) gives this value: 1378 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1380 The JWS Payload used in this example is the octets of the UTF-8 1381 representation of the JSON object below. (Note that the payload can 1382 be any base64url encoded octet sequence, and need not be a base64url 1383 encoded JSON object.) 1385 {"iss":"joe", 1386 "exp":1300819380, 1387 "http://example.com/is_root":true} 1389 The following octet sequence, which is the UTF-8 representation used 1390 in this example for the JSON object above, is the JWS Payload: 1392 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 1393 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 1394 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 1395 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 1396 111, 116, 34, 58, 116, 114, 117, 101, 125] 1398 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1399 Header)) gives this value (with line breaks for display purposes 1400 only): 1402 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1403 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1405 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1406 BASE64URL(JWS Payload) gives this string (with line breaks for 1407 display purposes only): 1409 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1410 . 1411 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1412 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1414 The resulting JWS Signing Input value, which is the ASCII 1415 representation of above string, is the following octet sequence 1416 (using JSON array notation): 1418 [101, 121, 74, 48, 101, 88, 65, 105, 79, 105, 74, 75, 86, 49, 81, 1419 105, 76, 65, 48, 75, 73, 67, 74, 104, 98, 71, 99, 105, 79, 105, 74, 1420 73, 85, 122, 73, 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 1421 77, 105, 79, 105, 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 1422 74, 108, 101, 72, 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 1423 107, 122, 79, 68, 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 1424 72, 65, 54, 76, 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 1425 109, 78, 118, 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 1426 106, 112, 48, 99, 110, 86, 108, 102, 81] 1428 HMACs are generated using keys. This example uses the symmetric key 1429 represented in JSON Web Key [JWK] format below (with line breaks for 1430 display purposes only): 1432 {"kty":"oct", 1433 "k":"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75 1434 aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" 1435 } 1437 Running the HMAC SHA-256 algorithm on the JWS Signing Input with this 1438 key yields this JWS Signature octet sequence: 1440 [116, 24, 223, 180, 151, 153, 224, 37, 79, 250, 96, 125, 216, 173, 1441 187, 186, 22, 212, 37, 77, 105, 214, 191, 240, 91, 88, 5, 88, 83, 1442 132, 141, 121] 1444 Encoding this JWS Signature as BASE64URL(JWS Signature) gives this 1445 value: 1447 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1449 Concatenating these values in the order Header.Payload.Signature with 1450 period ('.') characters between the parts yields this complete JWS 1451 representation using the JWS Compact Serialization (with line breaks 1452 for display purposes only): 1454 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1455 . 1456 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1457 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1458 . 1459 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1461 A.1.2. Validating 1463 Since the "alg" Header Parameter is "HS256", we validate the HMAC 1464 SHA-256 value contained in the JWS Signature. 1466 To validate the HMAC value, we repeat the previous process of using 1467 the correct key and the JWS Signing Input (which is the initial 1468 substring of the JWS Compact Serialization representation up until 1469 but not including the second period character) as input to the HMAC 1470 SHA-256 function and then taking the output and determining if it 1471 matches the JWS Signature (which is base64url decoded from the value 1472 encoded in the JWS representation). If it matches exactly, the HMAC 1473 has been validated. 1475 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 1477 A.2.1. Encoding 1479 The JWS Protected Header in this example is different from the 1480 previous example in two ways: First, because a different algorithm is 1481 being used, the "alg" value is different. Second, for illustration 1482 purposes only, the optional "typ" parameter is not used. (This 1483 difference is not related to the algorithm employed.) The JWS 1484 Protected Header used is: 1486 {"alg":"RS256"} 1488 The octets representing UTF8(JWS Protected Header) in this example 1489 (using JSON array notation) are: 1491 [123, 34, 97, 108, 103, 34, 58, 34, 82, 83, 50, 53, 54, 34, 125] 1493 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1494 Header)) gives this value: 1496 eyJhbGciOiJSUzI1NiJ9 1498 The JWS Payload used in this example, which follows, is the same as 1499 in the previous example. Since the BASE64URL(JWS Payload) value will 1500 therefore be the same, its computation is not repeated here. 1502 {"iss":"joe", 1503 "exp":1300819380, 1504 "http://example.com/is_root":true} 1506 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1507 BASE64URL(JWS Payload) gives this string (with line breaks for 1508 display purposes only): 1510 eyJhbGciOiJSUzI1NiJ9 1511 . 1512 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1513 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1515 The resulting JWS Signing Input value, which is the ASCII 1516 representation of above string, is the following octet sequence: 1518 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 122, 73, 1519 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1520 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1521 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1522 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1523 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1524 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1525 99, 110, 86, 108, 102, 81] 1527 This example uses the RSA key represented in JSON Web Key [JWK] 1528 format below (with line breaks for display purposes only): 1530 {"kty":"RSA", 1531 "n":"ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddx 1532 HmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMs 1533 D1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSH 1534 SXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdV 1535 MTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8 1536 NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ", 1537 "e":"AQAB", 1538 "d":"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97I 1539 jlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0 1540 BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn 1541 439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYT 1542 CBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLh 1543 BOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ" 1544 } 1546 The RSA private key is then passed to the RSA signing function, which 1547 also takes the hash type, SHA-256, and the JWS Signing Input as 1548 inputs. The result of the digital signature is an octet sequence, 1549 which represents a big endian integer. In this example, it is: 1551 [112, 46, 33, 137, 67, 232, 143, 209, 30, 181, 216, 45, 191, 120, 69, 1552 243, 65, 6, 174, 27, 129, 255, 247, 115, 17, 22, 173, 209, 113, 125, 1553 131, 101, 109, 66, 10, 253, 60, 150, 238, 221, 115, 162, 102, 62, 81, 1554 102, 104, 123, 0, 11, 135, 34, 110, 1, 135, 237, 16, 115, 249, 69, 1555 229, 130, 173, 252, 239, 22, 216, 90, 121, 142, 232, 198, 109, 219, 1556 61, 184, 151, 91, 23, 208, 148, 2, 190, 237, 213, 217, 217, 112, 7, 1557 16, 141, 178, 129, 96, 213, 248, 4, 12, 167, 68, 87, 98, 184, 31, 1558 190, 127, 249, 217, 46, 10, 231, 111, 36, 242, 91, 51, 187, 230, 244, 1559 74, 230, 30, 177, 4, 10, 203, 32, 4, 77, 62, 249, 18, 142, 212, 1, 1560 48, 121, 91, 212, 189, 59, 65, 238, 202, 208, 102, 171, 101, 25, 129, 1561 253, 228, 141, 247, 127, 55, 45, 195, 139, 159, 175, 221, 59, 239, 1562 177, 139, 93, 163, 204, 60, 46, 176, 47, 158, 58, 65, 214, 18, 202, 1563 173, 21, 145, 18, 115, 160, 95, 35, 185, 232, 56, 250, 175, 132, 157, 1564 105, 132, 41, 239, 90, 30, 136, 121, 130, 54, 195, 212, 14, 96, 69, 1565 34, 165, 68, 200, 242, 122, 122, 45, 184, 6, 99, 209, 108, 247, 202, 1566 234, 86, 222, 64, 92, 178, 33, 90, 69, 178, 194, 85, 102, 181, 90, 1567 193, 167, 72, 160, 112, 223, 200, 163, 42, 70, 149, 67, 208, 25, 238, 1568 251, 71] 1570 Encoding the signature as BASE64URL(JWS Signature) produces this 1571 value (with line breaks for display purposes only): 1573 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1574 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1575 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1576 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1577 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1578 p0igcN_IoypGlUPQGe77Rw 1580 Concatenating these values in the order Header.Payload.Signature with 1581 period ('.') characters between the parts yields this complete JWS 1582 representation using the JWS Compact Serialization (with line breaks 1583 for display purposes only): 1585 eyJhbGciOiJSUzI1NiJ9 1586 . 1587 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1588 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1589 . 1590 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1591 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1592 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1593 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1594 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1595 p0igcN_IoypGlUPQGe77Rw 1597 A.2.2. Validating 1599 Since the "alg" Header Parameter is "RS256", we validate the RSASSA- 1600 PKCS-v1_5 SHA-256 digital signature contained in the JWS Signature. 1602 Validating the JWS Signature is a bit different from the previous 1603 example. We pass the public key (n, e), the JWS Signature (which is 1604 base64url decoded from the value encoded in the JWS representation), 1605 and the JWS Signing Input (which is the initial substring of the JWS 1606 Compact Serialization representation up until but not including the 1607 second period character) to an RSASSA-PKCS-v1_5 signature verifier 1608 that has been configured to use the SHA-256 hash function. 1610 A.3. Example JWS using ECDSA P-256 SHA-256 1612 A.3.1. Encoding 1614 The JWS Protected Header for this example differs from the previous 1615 example because a different algorithm is being used. The JWS 1616 Protected Header used is: 1618 {"alg":"ES256"} 1620 The octets representing UTF8(JWS Protected Header) in this example 1621 (using JSON array notation) are: 1623 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 50, 53, 54, 34, 125] 1625 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1626 Header)) gives this value: 1628 eyJhbGciOiJFUzI1NiJ9 1630 The JWS Payload used in this example, which follows, is the same as 1631 in the previous examples. Since the BASE64URL(JWS Payload) value 1632 will therefore be the same, its computation is not repeated here. 1634 {"iss":"joe", 1635 "exp":1300819380, 1636 "http://example.com/is_root":true} 1638 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1639 BASE64URL(JWS Payload) gives this string (with line breaks for 1640 display purposes only): 1642 eyJhbGciOiJFUzI1NiJ9 1643 . 1644 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1645 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1647 The resulting JWS Signing Input value, which is the ASCII 1648 representation of above string, is the following octet sequence: 1650 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 73, 1651 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1652 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1653 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1654 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1655 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1656 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1657 99, 110, 86, 108, 102, 81] 1659 This example uses the elliptic curve key represented in JSON Web Key 1660 [JWK] format below: 1662 {"kty":"EC", 1663 "crv":"P-256", 1664 "x":"f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", 1665 "y":"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0", 1666 "d":"jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI" 1667 } 1669 The ECDSA private part d is then passed to an ECDSA signing function, 1670 which also takes the curve type, P-256, the hash type, SHA-256, and 1671 the JWS Signing Input as inputs. The result of the digital signature 1672 is the EC point (R, S), where R and S are unsigned integers. In this 1673 example, the R and S values, given as octet sequences representing 1674 big endian integers are: 1676 +--------+----------------------------------------------------------+ 1677 | Result | Value | 1678 | Name | | 1679 +--------+----------------------------------------------------------+ 1680 | R | [14, 209, 33, 83, 121, 99, 108, 72, 60, 47, 127, 21, 88, | 1681 | | 7, 212, 2, 163, 178, 40, 3, 58, 249, 124, 126, 23, 129, | 1682 | | 154, 195, 22, 158, 166, 101] | 1683 | S | [197, 10, 7, 211, 140, 60, 112, 229, 216, 241, 45, 175, | 1684 | | 8, 74, 84, 128, 166, 101, 144, 197, 242, 147, 80, 154, | 1685 | | 143, 63, 127, 138, 131, 163, 84, 213] | 1686 +--------+----------------------------------------------------------+ 1688 The JWS Signature is the value R || S. Encoding the signature as 1689 BASE64URL(JWS Signature) produces this value (with line breaks for 1690 display purposes only): 1692 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1693 pmWQxfKTUJqPP3-Kg6NU1Q 1695 Concatenating these values in the order Header.Payload.Signature with 1696 period ('.') characters between the parts yields this complete JWS 1697 representation using the JWS Compact Serialization (with line breaks 1698 for display purposes only): 1700 eyJhbGciOiJFUzI1NiJ9 1701 . 1702 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1703 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1704 . 1705 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1706 pmWQxfKTUJqPP3-Kg6NU1Q 1708 A.3.2. Validating 1710 Since the "alg" Header Parameter is "ES256", we validate the ECDSA 1711 P-256 SHA-256 digital signature contained in the JWS Signature. 1713 Validating the JWS Signature is a bit different from the previous 1714 examples. We need to split the 64 member octet sequence of the JWS 1715 Signature (which is base64url decoded from the value encoded in the 1716 JWS representation) into two 32 octet sequences, the first 1717 representing R and the second S. We then pass the public key (x, y), 1718 the signature (R, S), and the JWS Signing Input (which is the initial 1719 substring of the JWS Compact Serialization representation up until 1720 but not including the second period character) to an ECDSA signature 1721 verifier that has been configured to use the P-256 curve with the 1722 SHA-256 hash function. 1724 A.4. Example JWS using ECDSA P-521 SHA-512 1726 A.4.1. Encoding 1728 The JWS Protected Header for this example differs from the previous 1729 example because different ECDSA curves and hash functions are used. 1730 The JWS Protected Header used is: 1732 {"alg":"ES512"} 1734 The octets representing UTF8(JWS Protected Header) in this example 1735 (using JSON array notation) are: 1737 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 53, 49, 50, 34, 125] 1739 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1740 Header)) gives this value: 1742 eyJhbGciOiJFUzUxMiJ9 1744 The JWS Payload used in this example, is the ASCII string "Payload". 1745 The representation of this string is the octet sequence: 1747 [80, 97, 121, 108, 111, 97, 100] 1749 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value: 1751 UGF5bG9hZA 1753 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1754 BASE64URL(JWS Payload) gives this string (with line breaks for 1755 display purposes only): 1757 eyJhbGciOiJFUzUxMiJ9.UGF5bG9hZA 1759 The resulting JWS Signing Input value, which is the ASCII 1760 representation of above string, is the following octet sequence: 1762 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 85, 1763 120, 77, 105, 74, 57, 46, 85, 71, 70, 53, 98, 71, 57, 104, 90, 65] 1765 This example uses the elliptic curve key represented in JSON Web Key 1766 [JWK] format below (with line breaks for display purposes only): 1768 {"kty":"EC", 1769 "crv":"P-521", 1770 "x":"AekpBQ8ST8a8VcfVOTNl353vSrDCLLJXmPk06wTjxrrjcBpXp5EOnYG_ 1771 NjFZ6OvLFV1jSfS9tsz4qUxcWceqwQGk", 1772 "y":"ADSmRA43Z1DSNx_RvcLI87cdL07l6jQyyBXMoxVg_l2Th-x3S1WDhjDl 1773 y79ajL4Kkd0AZMaZmh9ubmf63e3kyMj2", 1774 "d":"AY5pb7A0UFiB3RELSD64fTLOSV_jazdF7fLYyuTw8lOfRhWg6Y6rUrPA 1775 xerEzgdRhajnu0ferB0d53vM9mE15j2C" 1776 } 1778 The ECDSA private part d is then passed to an ECDSA signing function, 1779 which also takes the curve type, P-521, the hash type, SHA-512, and 1780 the JWS Signing Input as inputs. The result of the digital signature 1781 is the EC point (R, S), where R and S are unsigned integers. In this 1782 example, the R and S values, given as octet sequences representing 1783 big endian integers are: 1785 +--------+----------------------------------------------------------+ 1786 | Result | Value | 1787 | Name | | 1788 +--------+----------------------------------------------------------+ 1789 | R | [1, 220, 12, 129, 231, 171, 194, 209, 232, 135, 233, | 1790 | | 117, 247, 105, 122, 210, 26, 125, 192, 1, 217, 21, 82, | 1791 | | 91, 45, 240, 255, 83, 19, 34, 239, 71, 48, 157, 147, | 1792 | | 152, 105, 18, 53, 108, 163, 214, 68, 231, 62, 153, 150, | 1793 | | 106, 194, 164, 246, 72, 143, 138, 24, 50, 129, 223, 133, | 1794 | | 206, 209, 172, 63, 237, 119, 109] | 1795 | S | [0, 111, 6, 105, 44, 5, 41, 208, 128, 61, 152, 40, 92, | 1796 | | 61, 152, 4, 150, 66, 60, 69, 247, 196, 170, 81, 193, | 1797 | | 199, 78, 59, 194, 169, 16, 124, 9, 143, 42, 142, 131, | 1798 | | 48, 206, 238, 34, 175, 83, 203, 220, 159, 3, 107, 155, | 1799 | | 22, 27, 73, 111, 68, 68, 21, 238, 144, 229, 232, 148, | 1800 | | 188, 222, 59, 242, 103] | 1801 +--------+----------------------------------------------------------+ 1803 The JWS Signature is the value R || S. Encoding the signature as 1804 BASE64URL(JWS Signature) produces this value (with line breaks for 1805 display purposes only): 1807 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1808 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1809 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1811 Concatenating these values in the order Header.Payload.Signature with 1812 period ('.') characters between the parts yields this complete JWS 1813 representation using the JWS Compact Serialization (with line breaks 1814 for display purposes only): 1816 eyJhbGciOiJFUzUxMiJ9 1817 . 1818 UGF5bG9hZA 1819 . 1820 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1821 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1822 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1824 A.4.2. Validating 1826 Since the "alg" Header Parameter is "ES512", we validate the ECDSA 1827 P-521 SHA-512 digital signature contained in the JWS Signature. 1829 Validating this JWS Signature is very similar to the previous 1830 example. We need to split the 132 member octet sequence of the JWS 1831 Signature into two 66 octet sequences, the first representing R and 1832 the second S. We then pass the public key (x, y), the signature (R, 1833 S), and the JWS Signing Input to an ECDSA signature verifier that has 1834 been configured to use the P-521 curve with the SHA-512 hash 1835 function. 1837 A.5. Example Plaintext JWS 1839 The following example JWS Protected Header declares that the encoded 1840 object is a Plaintext JWS: 1842 {"alg":"none"} 1844 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1845 Header)) gives this value: 1847 eyJhbGciOiJub25lIn0 1849 The JWS Payload used in this example, which follows, is the same as 1850 in the previous examples. Since the BASE64URL(JWS Payload) value 1851 will therefore be the same, its computation is not repeated here. 1853 {"iss":"joe", 1854 "exp":1300819380, 1855 "http://example.com/is_root":true} 1857 The JWS Signature is the empty octet string and BASE64URL(JWS 1858 Signature) is the empty string. 1860 Concatenating these parts in the order Header.Payload.Signature with 1861 period ('.') characters between the parts yields this complete JWS 1862 (with line breaks for display purposes only): 1864 eyJhbGciOiJub25lIn0 1865 . 1866 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1867 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1868 . 1870 A.6. Example JWS Using JWS JSON Serialization 1872 This section contains an example using the JWS JSON Serialization. 1873 This example demonstrates the capability for conveying multiple 1874 digital signatures and/or MACs for the same payload. 1876 The JWS Payload used in this example is the same as that used in the 1877 examples in Appendix A.2 and Appendix A.3 (with line breaks for 1878 display purposes only): 1880 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1881 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1883 Two digital signatures are used in this example: the first using 1884 RSASSA-PKCS-v1_5 SHA-256 and the second using ECDSA P-256 SHA-256. 1885 For the first, the JWS Protected Header and key are the same as in 1886 Appendix A.2, resulting in the same JWS Signature value; therefore, 1887 its computation is not repeated here. For the second, the JWS 1888 Protected Header and key are the same as in Appendix A.3, resulting 1889 in the same JWS Signature value; therefore, its computation is not 1890 repeated here. 1892 A.6.1. JWS Per-Signature Protected Headers 1894 The JWS Protected Header value used for the first signature is: 1896 {"alg":"RS256"} 1898 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1899 Header)) gives this value: 1901 eyJhbGciOiJSUzI1NiJ9 1903 The JWS Protected Header value used for the second signature is: 1905 {"alg":"ES256"} 1907 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1908 Header)) gives this value: 1910 eyJhbGciOiJFUzI1NiJ9 1912 A.6.2. JWS Per-Signature Unprotected Headers 1914 Key ID values are supplied for both keys using per-signature Header 1915 Parameters. The two values used to represent these Key IDs are: 1917 {"kid":"2010-12-29"} 1919 and 1921 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 1923 A.6.3. Complete JWS Header Values 1925 Combining the protected and unprotected header values supplied, the 1926 JWS Header values used for the first and second signatures 1927 respectively are: 1929 {"alg":"RS256", 1930 "kid":"2010-12-29"} 1932 and 1934 {"alg":"ES256", 1935 "kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 1937 A.6.4. Complete JWS JSON Serialization Representation 1939 The complete JSON Web Signature JSON Serialization for these values 1940 is as follows (with line breaks for display purposes only): 1942 {"payload": 1943 "eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGF 1944 tcGxlLmNvbS9pc19yb290Ijp0cnVlfQ", 1945 "signatures":[ 1946 {"protected":"eyJhbGciOiJSUzI1NiJ9", 1947 "header": 1948 {"kid":"2010-12-29"}, 1949 "signature": 1950 "cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZ 1951 mh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjb 1952 KBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHl 1953 b1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZES 1954 c6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AX 1955 LIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw"}, 1956 {"protected":"eyJhbGciOiJFUzI1NiJ9", 1957 "header": 1958 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"}, 1959 "signature": 1960 "DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8IS 1961 lSApmWQxfKTUJqPP3-Kg6NU1Q"}] 1962 } 1964 Appendix B. "x5c" (X.509 Certificate Chain) Example 1966 The JSON array below is an example of a certificate chain that could 1967 be used as the value of an "x5c" (X.509 Certificate Chain) Header 1968 Parameter, per Section 4.1.6. Note that since these strings contain 1969 base64 encoded (not base64url encoded) values, they are allowed to 1970 contain white space and line breaks. 1972 ["MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVM 1973 xITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR2 1974 8gRGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExM 1975 TYwMTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UE 1976 CBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWR 1977 keS5jb20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYW 1978 RkeS5jb20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlc 1979 nRpZmljYXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJ 1980 KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTt 1981 wY6vj3D3HKrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqV 1982 Tr9vcyOdQmVZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aL 1983 GbqGmu75RpRSgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo 1984 7RJlbmr2EkRTcDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgW 1985 JCJjPOq8lh8BJ6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAw 1986 EAAaOCATIwggEuMB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVH 1987 SMEGDAWgBTSxLDSkdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEA 1988 MDMGCCsGAQUFBwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWR 1989 keS5jb20wRgYDVR0fBD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2 1990 RhZGR5LmNvbS9yZXBvc2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVH 1991 SAAMDgwNgYIKwYBBQUHAgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j 1992 b20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggE 1993 BANKGwOy9+aG2Z+5mC6IGOgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPI 1994 UyIXvJxwqoJKSQ3kbTJSMUA2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL 1995 5CkKSkB2XIsKd83ASe8T+5o0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9 1996 p0iRFEUOOjZv2kWzRaJBydTXRE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsx 1997 uxN89txJx9OjxUUAiKEngHUuHqDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZ 1998 EjYx8WnM25sgVjOuH0aBsXBTWVU+4=", 1999 "MIIE+zCCBGSgAwIBAgICAQ0wDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1Z 2000 hbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIE 2001 luYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb 2002 24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8x 2003 IDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTA0MDYyOTE3MDY 2004 yMFoXDTI0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRoZS 2005 BHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgM 2006 iBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN 2007 ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XC 2008 APVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux 2009 6wwdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLO 2010 tXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWo 2011 riMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZ 2012 Eewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjggHhMIIB3TAdBgNVHQ 2013 4EFgQU0sSw0pHUTBFxs2HLPaH+3ahq1OMwgdIGA1UdIwSByjCBx6GBwaSBvjCBu 2014 zEkMCIGA1UEBxMbVmFsaUNlcnQgVmFsaWRhdGlvbiBOZXR3b3JrMRcwFQYDVQQK 2015 Ew5WYWxpQ2VydCwgSW5jLjE1MDMGA1UECxMsVmFsaUNlcnQgQ2xhc3MgMiBQb2x 2016 pY3kgVmFsaWRhdGlvbiBBdXRob3JpdHkxITAfBgNVBAMTGGh0dHA6Ly93d3cudm 2017 FsaWNlcnQuY29tLzEgMB4GCSqGSIb3DQEJARYRaW5mb0B2YWxpY2VydC5jb22CA 2018 QEwDwYDVR0TAQH/BAUwAwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGG 2019 F2h0dHA6Ly9vY3NwLmdvZGFkZHkuY29tMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA 2020 6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS9yb290LmNybD 2021 BLBgNVHSAERDBCMEAGBFUdIAAwODA2BggrBgEFBQcCARYqaHR0cDovL2NlcnRpZ 2022 mljYXRlcy5nb2RhZGR5LmNvbS9yZXBvc2l0b3J5MA4GA1UdDwEB/wQEAwIBBjAN 2023 BgkqhkiG9w0BAQUFAAOBgQC1QPmnHfbq/qQaQlpE9xXUhUaJwL6e4+PrxeNYiY+ 2024 Sn1eocSxI0YGyeR+sBjUZsE4OWBsUs5iB0QQeyAfJg594RAoYC5jcdnplDQ1tgM 2025 QLARzLrUc+cb53S8wGd9D0VmsfSxOaFIqII6hR8INMqzW/Rn453HWkrugp++85j 2026 09VZw==", 2027 "MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ 2028 0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNT 2029 AzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0a 2030 G9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkq 2031 hkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE 2032 5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTm 2033 V0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZ 2034 XJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQD 2035 ExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9 2036 AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5a 2037 vIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zf 2038 N1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwb 2039 P7RfZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQU 2040 AA4GBADt/UG9vUJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQ 2041 C1u+mNr0HZDzTuIYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMM 2042 j4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd"] 2044 Appendix C. Notes on implementing base64url encoding without padding 2046 This appendix describes how to implement base64url encoding and 2047 decoding functions without padding based upon standard base64 2048 encoding and decoding functions that do use padding. 2050 To be concrete, example C# code implementing these functions is shown 2051 below. Similar code could be used in other languages. 2053 static string base64urlencode(byte [] arg) 2054 { 2055 string s = Convert.ToBase64String(arg); // Regular base64 encoder 2056 s = s.Split('=')[0]; // Remove any trailing '='s 2057 s = s.Replace('+', '-'); // 62nd char of encoding 2058 s = s.Replace('/', '_'); // 63rd char of encoding 2059 return s; 2060 } 2062 static byte [] base64urldecode(string arg) 2063 { 2064 string s = arg; 2065 s = s.Replace('-', '+'); // 62nd char of encoding 2066 s = s.Replace('_', '/'); // 63rd char of encoding 2067 switch (s.Length % 4) // Pad with trailing '='s 2068 { 2069 case 0: break; // No pad chars in this case 2070 case 2: s += "=="; break; // Two pad chars 2071 case 3: s += "="; break; // One pad char 2072 default: throw new System.Exception( 2073 "Illegal base64url string!"); 2074 } 2075 return Convert.FromBase64String(s); // Standard base64 decoder 2076 } 2078 As per the example code above, the number of '=' padding characters 2079 that needs to be added to the end of a base64url encoded string 2080 without padding to turn it into one with padding is a deterministic 2081 function of the length of the encoded string. Specifically, if the 2082 length mod 4 is 0, no padding is added; if the length mod 4 is 2, two 2083 '=' padding characters are added; if the length mod 4 is 3, one '=' 2084 padding character is added; if the length mod 4 is 1, the input is 2085 malformed. 2087 An example correspondence between unencoded and encoded values 2088 follows. The octet sequence below encodes into the string below, 2089 which when decoded, reproduces the octet sequence. 2090 3 236 255 224 193 2091 A-z_4ME 2093 Appendix D. Notes on Key Selection 2095 This appendix describes a set of possible algorithms for selecting 2096 the key to be used to validate the digital signature or MAC of a JWS 2097 object or for selecting the key to be used to decrypt a JWE object. 2098 This guidance describes a family of possible algorithms, rather than 2099 a single algorithm, because in different contexts, not all the 2100 sources of keys will be used, they can be tried in different orders, 2101 and sometimes not all the collected keys will be tried; hence, 2102 different algorithms will be used in different application contexts. 2104 The steps below are described for illustration purposes only; 2105 specific applications can and are likely to use different algorithms 2106 or perform some of the steps in different orders. Specific 2107 applications will frequently have a much simpler method of 2108 determining the keys to use, as there may be one or two key selection 2109 methods that are profiled for the application's use. This appendix 2110 supplements the normative information on key location in Section 6. 2112 These algorithms include the following steps. Note that the steps 2113 can be performed in any order and do not need to be treated as 2114 distinct. For example, keys can be tried as soon as they are found, 2115 rather than collecting all the keys before trying any. 2117 1. Collect the set of potentially applicable keys. Sources of keys 2118 may include: 2120 * Keys supplied by the application protocol being used. 2122 * Keys referenced by the "jku" (JWK Set URL) Header Parameter. 2124 * The key provided by the "jwk" (JSON Web Key) Header Parameter. 2126 * The key referenced by the "x5u" (X.509 URL) Header Parameter. 2128 * The key provided by the "x5c" (X.509 Certificate Chain) Header 2129 Parameter. 2131 * Other applicable keys available to the application. 2133 The order for collecting and trying keys from different key 2134 sources is typically application dependent. For example, 2135 frequently all keys from a one set of locations, such as local 2136 caches, will be tried before collecting and trying keys from 2137 other locations. 2139 2. Filter the set of collected keys. For instance, some 2140 applications will use only keys referenced by "kid" (key ID) or 2141 "x5t" (X.509 certificate SHA-1 thumbprint) parameters. If the 2142 application uses the "alg" (algorithm), "use" (public key use), 2143 or "key_ops" (key operations) parameters, keys with keys with 2144 inappropriate values of those parameters would be excluded. 2145 Additionally, keys might be filtered to include or exclude keys 2146 with certain other member values in an application specific 2147 manner. For some applications, no filtering will be applied. 2149 3. Order the set of collected keys. For instance, keys referenced 2150 by "kid" (Key ID) or "x5t" (X.509 Certificate SHA-1 Thumbprint) 2151 parameters might be tried before keys with neither of these 2152 values. Likewise, keys with certain member values might be 2153 ordered before keys with other member values. For some 2154 applications, no ordering will be applied. 2156 4. Make trust decisions about the keys. Signatures made with keys 2157 not meeting the application's trust criteria would not be 2158 accepted. Such criteria might include, but is not limited to the 2159 source of the key, whether the TLS certificate validates for keys 2160 retrieved from URLs, whether a key in an X.509 certificate is 2161 backed by a valid certificate chain, and other information known 2162 by the application. 2164 5. Attempt signature or MAC validation for a JWS object or 2165 decryption of a JWE object with some or all of the collected and 2166 possibly filtered and/or ordered keys. A limit on the number of 2167 keys to be tried might be applied. This process will normally 2168 terminate following a successful validation or decryption. 2170 Note that it is reasonable for some applications to perform signature 2171 or MAC validation prior to making a trust decision about a key, since 2172 keys for which the validation fails need no trust decision. 2174 Appendix E. Negative Test Case for "crit" Header Parameter 2176 Conforming implementations must reject input containing critical 2177 extensions that are not understood or cannot be processed. The 2178 following JWS must be rejected by all implementations, because it 2179 uses an extension Header Parameter name 2180 "http://example.invalid/UNDEFINED" that they do not understand. Any 2181 other similar input, in which the use of the value 2182 "http://example.invalid/UNDEFINED" is substituted for any other 2183 Header Parameter name not understood by the implementation, must also 2184 be rejected. 2186 The JWS Protected Header value for this JWS is: 2188 {"alg":"none", 2189 "crit":["http://example.invalid/UNDEFINED"], 2190 "http://example.invalid/UNDEFINED":true 2191 } 2193 The complete JWS that must be rejected is as follows (with line 2194 breaks for display purposes only): 2196 eyJhbGciOiJub25lIiwNCiAiY3JpdCI6WyJodHRwOi8vZXhhbXBsZS5jb20vVU5ERU 2197 ZJTkVEIl0sDQogImh0dHA6Ly9leGFtcGxlLmNvbS9VTkRFRklORUQiOnRydWUNCn0. 2198 RkFJTA. 2200 Appendix F. Detached Content 2202 In some contexts, it is useful integrity protect content that is not 2203 itself contained in a JWS object. One way to do this is create a JWS 2204 object in the normal fashion using a representation of the content as 2205 the payload, but then delete the payload representation from the JWS, 2206 and send this modified object to the recipient, rather than the JWS. 2207 When using the JWS Compact Serialization, the deletion is 2208 accomplished by replacing the second field (which contains 2209 BASE64URL(JWS Payload)) value with the empty string; when using the 2210 JWS JSON Serialization, the deletion is accomplished by deleting the 2211 "payload" member. This method assumes that the recipient can 2212 reconstruct the exact payload used in the JWS. To use the modified 2213 object, the recipient reconstructs the JWS by re-inserting the 2214 payload representation into the modified object, and uses the 2215 resulting JWS in the usual manner. Note that this method needs no 2216 support from JWS libraries, as applications can use this method by 2217 modifying the inputs and outputs of standard JWS libraries. 2219 Appendix G. Acknowledgements 2221 Solutions for signing JSON content were previously explored by Magic 2222 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 2223 Applications [CanvasApp], all of which influenced this draft. 2225 Thanks to Axel Nennker for his early implementation and feedback on 2226 the JWS and JWE specifications. 2228 This specification is the work of the JOSE Working Group, which 2229 includes dozens of active and dedicated participants. In particular, 2230 the following individuals contributed ideas, feedback, and wording 2231 that influenced this specification: 2233 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 2234 Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben 2235 Laurie, James Manger, Matt Miller, Tony Nadalin, Hideki Nara, Axel 2236 Nennker, John Panzer, Emmanuel Raviart, Eric Rescorla, Jim Schaad, 2237 Paul Tarjan, Hannes Tschofenig, and Sean Turner. 2239 Jim Schaad and Karen O'Donoghue chaired the JOSE working group and 2240 Sean Turner, Stephen Farrell, and Kathleen Moriarty served as 2241 Security area directors during the creation of this specification. 2243 Appendix H. Document History 2245 [[ to be removed by the RFC Editor before publication as an RFC ]] 2247 -28 2249 o Revised the introduction to the Security Considerations section. 2250 Also introduced additional subsection headings for security 2251 considerations items and also moved a security consideration item 2252 here from the JWA draft. 2254 o Added text about when applications typically would and would not 2255 use "typ" and "cty" header parameters. 2257 -27 2259 o Added the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) header 2260 parameter. 2262 o Stated that any JSON inputs not conforming to the JSON-text syntax 2263 defined in RFC 7159 input MUST be rejected in their entirety. 2265 o Simplified the TLS requirements. 2267 -26 2269 o Referenced Section 6 of RFC 6125 for TLS server certificate 2270 identity validation. 2272 o Described potential sources of ambiguity in representing the JSON 2273 objects used in the examples. The octets of the actual UTF-8 2274 representations of the JSON objects used in the examples are 2275 included to remove these ambiguities. 2277 o Added a small amount of additional explanatory text to the 2278 signature validation examples to aid implementers. 2280 o Noted that octet sequences are depicted using JSON array notation. 2282 o Updated references, including to W3C specifications. 2284 -25 2285 o No changes were made, other than to the version number and date. 2287 -24 2289 o Updated the JSON reference to RFC 7159. 2291 -23 2293 o Clarified that the base64url encoding includes no line breaks, 2294 white space, or other additional characters. 2296 -22 2298 o Corrected RFC 2119 terminology usage. 2300 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 2302 -21 2304 o Applied review comments to the appendix "Notes on Key Selection", 2305 addressing issue #93. 2307 o Changed some references from being normative to informative, 2308 addressing issue #90. 2310 o Applied review comments to the JSON Serialization section, 2311 addressing issue #121. 2313 -20 2315 o Made terminology definitions more consistent, addressing issue 2316 #165. 2318 o Restructured the JSON Serialization section to call out the 2319 parameters used in hanging lists, addressing issue #121. 2321 o Described key filtering and refined other aspects of the text in 2322 the appendix "Notes on Key Selection", addressing issue #93. 2324 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis, 2325 addressing issue #90. 2327 -19 2329 o Added the appendix "Notes on Validation Key Selection", addressing 2330 issue #93. 2332 o Reordered the key selection parameters. 2334 -18 2336 o Updated the mandatory-to-implement (MTI) language to say that 2337 applications using this specification need to specify what 2338 serialization and serialization features are used for that 2339 application, addressing issue #119. 2341 o Changes to address editorial and minor issues #25, #89, #97, #110, 2342 #114, #115, #116, #117, #120, and #184. 2344 o Added and used Header Parameter Description registry field. 2346 -17 2348 o Refined the "typ" and "cty" definitions to always be MIME Media 2349 Types, with the omission of "application/" prefixes recommended 2350 for brevity, addressing issue #50. 2352 o Updated the mandatory-to-implement (MTI) language to say that 2353 general-purpose implementations must implement the single 2354 signature/MAC value case for both serializations whereas special- 2355 purpose implementations can implement just one serialization if 2356 that meets the needs of the use cases the implementation is 2357 designed for, addressing issue #119. 2359 o Explicitly named all the logical components of a JWS and defined 2360 the processing rules and serializations in terms of those 2361 components, addressing issues #60, #61, and #62. 2363 o Replaced verbose repetitive phases such as "base64url encode the 2364 octets of the UTF-8 representation of X" with mathematical 2365 notation such as "BASE64URL(UTF8(X))". 2367 o Terms used in multiple documents are now defined in one place and 2368 incorporated by reference. Some lightly used or obvious terms 2369 were also removed. This addresses issue #58. 2371 -16 2373 o Changes to address editorial and minor issues #50, #98, #99, #102, 2374 #104, #106, #107, #111, and #112. 2376 -15 2378 o Clarified that it is an application decision which signatures, 2379 MACs, or plaintext values must successfully validate for the JWS 2380 to be accepted, addressing issue #35. 2382 o Corrected editorial error in "ES512" example. 2384 o Changes to address editorial and minor issues #34, #96, #100, 2385 #101, #104, #105, and #106. 2387 -14 2389 o Stated that the "signature" parameter is to be omitted in the JWS 2390 JSON Serialization when its value would be empty (which is only 2391 the case for a Plaintext JWS). 2393 -13 2395 o Made all header parameter values be per-signature/MAC, addressing 2396 issue #24. 2398 -12 2400 o Clarified that the "typ" and "cty" header parameters are used in 2401 an application-specific manner and have no effect upon the JWS 2402 processing. 2404 o Replaced the MIME types "application/jws+json" and 2405 "application/jws" with "application/jose+json" and 2406 "application/jose". 2408 o Stated that recipients MUST either reject JWSs with duplicate 2409 Header Parameter Names or use a JSON parser that returns only the 2410 lexically last duplicate member name. 2412 o Added a Serializations section with parallel treatment of the JWS 2413 Compact Serialization and the JWS JSON Serialization and also 2414 moved the former Implementation Considerations content there. 2416 -11 2418 o Added Key Identification section. 2420 o For the JWS JSON Serialization, enable header parameter values to 2421 be specified in any of three parameters: the "protected" member 2422 that is integrity protected and shared among all recipients, the 2423 "unprotected" member that is not integrity protected and shared 2424 among all recipients, and the "header" member that is not 2425 integrity protected and specific to a particular recipient. (This 2426 does not affect the JWS Compact Serialization, in which all header 2427 parameter values are in a single integrity protected JWE Header 2428 value.) 2430 o Removed suggested compact serialization for multiple digital 2431 signatures and/or MACs. 2433 o Changed the MIME type name "application/jws-js" to 2434 "application/jws+json", addressing issue #22. 2436 o Tightened the description of the "crit" (critical) header 2437 parameter. 2439 o Added a negative test case for the "crit" header parameter 2441 -10 2443 o Added an appendix suggesting a possible compact serialization for 2444 JWSs with multiple digital signatures and/or MACs. 2446 -09 2448 o Added JWS JSON Serialization, as specified by 2449 draft-jones-jose-jws-json-serialization-04. 2451 o Registered "application/jws-js" MIME type and "JWS-JS" typ header 2452 parameter value. 2454 o Defined that the default action for header parameters that are not 2455 understood is to ignore them unless specifically designated as 2456 "MUST be understood" or included in the new "crit" (critical) 2457 header parameter list. This addressed issue #6. 2459 o Changed term "JWS Secured Input" to "JWS Signing Input". 2461 o Changed from using the term "byte" to "octet" when referring to 8 2462 bit values. 2464 o Changed member name from "recipients" to "signatures" in the JWS 2465 JSON Serialization. 2467 o Added complete values using the JWS Compact Serialization for all 2468 examples. 2470 -08 2472 o Applied editorial improvements suggested by Jeff Hodges and Hannes 2473 Tschofenig. Many of these simplified the terminology used. 2475 o Clarified statements of the form "This header parameter is 2476 OPTIONAL" to "Use of this header parameter is OPTIONAL". 2478 o Added a Header Parameter Usage Location(s) field to the IANA JSON 2479 Web Signature and Encryption Header Parameters registry. 2481 o Added seriesInfo information to Internet Draft references. 2483 -07 2485 o Updated references. 2487 -06 2489 o Changed "x5c" (X.509 Certificate Chain) representation from being 2490 a single string to being an array of strings, each containing a 2491 single base64 encoded DER certificate value, representing elements 2492 of the certificate chain. 2494 o Applied changes made by the RFC Editor to RFC 6749's registry 2495 language to this specification. 2497 -05 2499 o Added statement that "StringOrURI values are compared as case- 2500 sensitive strings with no transformations or canonicalizations 2501 applied". 2503 o Indented artwork elements to better distinguish them from the body 2504 text. 2506 -04 2508 o Completed JSON Security Considerations section, including 2509 considerations about rejecting input with duplicate member names. 2511 o Completed security considerations on the use of a SHA-1 hash when 2512 computing "x5t" (x.509 certificate thumbprint) values. 2514 o Refer to the registries as the primary sources of defined values 2515 and then secondarily reference the sections defining the initial 2516 contents of the registries. 2518 o Normatively reference XML DSIG 2.0 for its security 2519 considerations. 2521 o Added this language to Registration Templates: "This name is case 2522 sensitive. Names that match other registered names in a case 2523 insensitive manner SHOULD NOT be accepted." 2525 o Reference draft-jones-jose-jws-json-serialization instead of 2526 draft-jones-json-web-signature-json-serialization. 2528 o Described additional open issues. 2530 o Applied editorial suggestions. 2532 -03 2534 o Added the "cty" (content type) header parameter for declaring type 2535 information about the secured content, as opposed to the "typ" 2536 (type) header parameter, which declares type information about 2537 this object. 2539 o Added "Collision Resistant Namespace" to the terminology section. 2541 o Reference ITU.X690.1994 for DER encoding. 2543 o Added an example JWS using ECDSA P-521 SHA-512. This has 2544 particular illustrative value because of the use of the 521 bit 2545 integers in the key and signature values. This is also an example 2546 in which the payload is not a base64url encoded JSON object. 2548 o Added an example "x5c" value. 2550 o No longer say "the UTF-8 representation of the JWS Secured Input 2551 (which is the same as the ASCII representation)". Just call it 2552 "the ASCII representation of the JWS Secured Input". 2554 o Added Registration Template sections for defined registries. 2556 o Added Registry Contents sections to populate registry values. 2558 o Changed name of the JSON Web Signature and Encryption "typ" Values 2559 registry to be the JSON Web Signature and Encryption Type Values 2560 registry, since it is used for more than just values of the "typ" 2561 parameter. 2563 o Moved registries JSON Web Signature and Encryption Header 2564 Parameters and JSON Web Signature and Encryption Type Values to 2565 the JWS specification. 2567 o Numerous editorial improvements. 2569 -02 2570 o Clarified that it is an error when a "kid" value is included and 2571 no matching key is found. 2573 o Removed assumption that "kid" (key ID) can only refer to an 2574 asymmetric key. 2576 o Clarified that JWSs with duplicate Header Parameter Names MUST be 2577 rejected. 2579 o Clarified the relationship between "typ" header parameter values 2580 and MIME types. 2582 o Registered application/jws MIME type and "JWS" typ header 2583 parameter value. 2585 o Simplified JWK terminology to get replace the "JWK Key Object" and 2586 "JWK Container Object" terms with simply "JSON Web Key (JWK)" and 2587 "JSON Web Key Set (JWK Set)" and to eliminate potential confusion 2588 between single keys and sets of keys. As part of this change, the 2589 Header Parameter Name for a public key value was changed from 2590 "jpk" (JSON Public Key) to "jwk" (JSON Web Key). 2592 o Added suggestion on defining additional header parameters such as 2593 "x5t#S256" in the future for certificate thumbprints using hash 2594 algorithms other than SHA-1. 2596 o Specify RFC 2818 server identity validation, rather than RFC 6125 2597 (paralleling the same decision in the OAuth specs). 2599 o Generalized language to refer to Message Authentication Codes 2600 (MACs) rather than Hash-based Message Authentication Codes (HMACs) 2601 unless in a context specific to HMAC algorithms. 2603 o Reformatted to give each header parameter its own section heading. 2605 -01 2607 o Moved definition of Plaintext JWSs (using "alg":"none") here from 2608 the JWT specification since this functionality is likely to be 2609 useful in more contexts that just for JWTs. 2611 o Added "jpk" and "x5c" header parameters for including JWK public 2612 keys and X.509 certificate chains directly in the header. 2614 o Clarified that this specification is defining the JWS Compact 2615 Serialization. Referenced the new JWS-JS spec, which defines the 2616 JWS JSON Serialization. 2618 o Added text "New header parameters should be introduced sparingly 2619 since an implementation that does not understand a parameter MUST 2620 reject the JWS". 2622 o Clarified that the order of the creation and validation steps is 2623 not significant in cases where there are no dependencies between 2624 the inputs and outputs of the steps. 2626 o Changed "no canonicalization is performed" to "no canonicalization 2627 need be performed". 2629 o Corrected the Magic Signatures reference. 2631 o Made other editorial improvements suggested by JOSE working group 2632 participants. 2634 -00 2636 o Created the initial IETF draft based upon 2637 draft-jones-json-web-signature-04 with no normative changes. 2639 o Changed terminology to no longer call both digital signatures and 2640 HMACs "signatures". 2642 Authors' Addresses 2644 Michael B. Jones 2645 Microsoft 2647 Email: mbj@microsoft.com 2648 URI: http://self-issued.info/ 2650 John Bradley 2651 Ping Identity 2653 Email: ve7jtb@ve7jtb.com 2654 URI: http://www.thread-safe.com/ 2656 Nat Sakimura 2657 Nomura Research Institute 2659 Email: n-sakimura@nri.co.jp 2660 URI: http://nat.sakimura.org/