idnits 2.17.1 draft-ietf-jose-json-web-signature-30.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 (July 1, 2014) is 3586 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 1765 -- Looks like a reference, but probably isn't: '34' on line 1765 -- Looks like a reference, but probably isn't: '97' on line 1775 -- Looks like a reference, but probably isn't: '108' on line 1775 -- Looks like a reference, but probably isn't: '103' on line 1765 -- Looks like a reference, but probably isn't: '58' on line 1765 -- Looks like a reference, but probably isn't: '82' on line 1518 -- Looks like a reference, but probably isn't: '83' on line 1765 -- Looks like a reference, but probably isn't: '50' on line 1765 -- Looks like a reference, but probably isn't: '53' on line 1765 -- Looks like a reference, but probably isn't: '54' on line 1651 -- Looks like a reference, but probably isn't: '125' on line 1765 -- Looks like a reference, but probably isn't: '69' on line 1765 -- Looks like a reference, but probably isn't: '49' on line 1765 -- Looks like a reference, but probably isn't: '80' on line 1775 -- Looks like a reference, but probably isn't: '121' on line 1775 -- Looks like a reference, but probably isn't: '111' on line 1775 -- Looks like a reference, but probably isn't: '100' on line 1775 -- Looks like a reference, but probably isn't: '0' on line 2085 -- 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: January 2, 2015 Ping Identity 6 N. Sakimura 7 NRI 8 July 1, 2014 10 JSON Web Signature (JWS) 11 draft-ietf-jose-json-web-signature-30 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 January 2, 2015. 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. JWS Compact Serialization Overview . . . . . . . . . . . . 7 63 3.2. JWS JSON Serialization Overview . . . . . . . . . . . . . 7 64 3.3. Example JWS . . . . . . . . . . . . . . . . . . . . . . . 8 65 4. JOSE Header . . . . . . . . . . . . . . . . . . . . . . . . . 9 66 4.1. Registered Header Parameter Names . . . . . . . . . . . . 10 67 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 10 68 4.1.2. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 10 69 4.1.3. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 10 70 4.1.4. "kid" (Key ID) Header Parameter . . . . . . . . . . . 11 71 4.1.5. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 11 72 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter . . . 11 73 4.1.7. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header 74 Parameter . . . . . . . . . . . . . . . . . . . . . . 12 75 4.1.8. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) 76 Header Parameter . . . . . . . . . . . . . . . . . . . 12 77 4.1.9. "typ" (Type) Header Parameter . . . . . . . . . . . . 12 78 4.1.10. "cty" (Content Type) Header Parameter . . . . . . . . 13 79 4.1.11. "crit" (Critical) Header Parameter . . . . . . . . . . 13 80 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 14 81 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 14 82 5. Producing and Consuming JWSs . . . . . . . . . . . . . . . . . 14 83 5.1. Message Signature or MAC Computation . . . . . . . . . . . 14 84 5.2. Message Signature or MAC Validation . . . . . . . . . . . 15 85 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 16 86 6. Key Identification . . . . . . . . . . . . . . . . . . . . . . 17 87 7. Serializations . . . . . . . . . . . . . . . . . . . . . . . . 17 88 7.1. JWS Compact Serialization . . . . . . . . . . . . . . . . 18 89 7.2. JWS JSON Serialization . . . . . . . . . . . . . . . . . . 18 90 8. TLS Requirements . . . . . . . . . . . . . . . . . . . . . . . 19 91 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 92 9.1. JSON Web Signature and Encryption Header Parameters 93 Registry . . . . . . . . . . . . . . . . . . . . . . . . . 21 94 9.1.1. Registration Template . . . . . . . . . . . . . . . . 21 95 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 22 97 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 23 98 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 23 99 10. Security Considerations . . . . . . . . . . . . . . . . . . . 24 100 10.1. Key Entropy . . . . . . . . . . . . . . . . . . . . . . . 25 101 10.2. Chosen Plaintext Attacks . . . . . . . . . . . . . . . . . 25 102 10.3. Timing Attacks . . . . . . . . . . . . . . . . . . . . . . 25 103 10.4. Differences between Digital Signatures and MACs . . . . . 25 104 10.5. SHA-1 Certificate Thumbprints . . . . . . . . . . . . . . 26 105 10.6. JSON Security Considerations . . . . . . . . . . . . . . . 26 106 10.7. Unicode Comparison Security Considerations . . . . . . . . 27 107 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 27 108 11.1. Normative References . . . . . . . . . . . . . . . . . . . 27 109 11.2. Informative References . . . . . . . . . . . . . . . . . . 29 110 Appendix A. JWS Examples . . . . . . . . . . . . . . . . . . . . 30 111 A.1. Example JWS using HMAC SHA-256 . . . . . . . . . . . . . . 30 112 A.1.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 30 113 A.1.2. Validating . . . . . . . . . . . . . . . . . . . . . . 32 114 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 . . . . . . . . 32 115 A.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 32 116 A.2.2. Validating . . . . . . . . . . . . . . . . . . . . . . 35 117 A.3. Example JWS using ECDSA P-256 SHA-256 . . . . . . . . . . 35 118 A.3.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 35 119 A.3.2. Validating . . . . . . . . . . . . . . . . . . . . . . 37 120 A.4. Example JWS using ECDSA P-521 SHA-512 . . . . . . . . . . 38 121 A.4.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 38 122 A.4.2. Validating . . . . . . . . . . . . . . . . . . . . . . 40 123 A.5. Example Plaintext JWS . . . . . . . . . . . . . . . . . . 40 124 A.6. Example JWS Using JWS JSON Serialization . . . . . . . . . 41 125 A.6.1. JWS Per-Signature Protected Headers . . . . . . . . . 41 126 A.6.2. JWS Per-Signature Unprotected Headers . . . . . . . . 42 127 A.6.3. Complete JOSE Header Values . . . . . . . . . . . . . 42 128 A.6.4. Complete JWS JSON Serialization Representation . . . . 42 129 Appendix B. "x5c" (X.509 Certificate Chain) Example . . . . . . . 43 130 Appendix C. Notes on implementing base64url encoding without 131 padding . . . . . . . . . . . . . . . . . . . . . . . 45 132 Appendix D. Notes on Key Selection . . . . . . . . . . . . . . . 46 133 Appendix E. Negative Test Case for "crit" Header Parameter . . . 47 134 Appendix F. Detached Content . . . . . . . . . . . . . . . . . . 48 135 Appendix G. Acknowledgements . . . . . . . . . . . . . . . . . . 48 136 Appendix H. Document History . . . . . . . . . . . . . . . . . . 49 137 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 58 139 1. Introduction 141 JSON Web Signature (JWS) represents content secured with digital 142 signatures or Message Authentication Codes (MACs) using JavaScript 143 Object Notation (JSON) [RFC7159] based data structures. The JWS 144 cryptographic mechanisms provide integrity protection for an 145 arbitrary sequence of octets. 147 Two closely related serializations for JWS objects are defined. The 148 JWS Compact Serialization is a compact, URL-safe representation 149 intended for space constrained environments such as HTTP 150 Authorization headers and URI query parameters. The JWS JSON 151 Serialization represents JWS objects as JSON objects and enables 152 multiple signatures and/or MACs to be applied to the same content. 153 Both share the same cryptographic underpinnings. 155 Cryptographic algorithms and identifiers for use with this 156 specification are described in the separate JSON Web Algorithms (JWA) 157 [JWA] specification and an IANA registry defined by that 158 specification. Related encryption capabilities are described in the 159 separate JSON Web Encryption (JWE) [JWE] specification. 161 Names defined by this specification are short because a core goal is 162 for the resulting representations to be compact. 164 1.1. Notational Conventions 166 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 167 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 168 "OPTIONAL" in this document are to be interpreted as described in Key 169 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 170 these words are used without being spelled in uppercase then they are 171 to be interpreted with their normal natural language meanings. 173 BASE64URL(OCTETS) denotes the base64url encoding of OCTETS, per 174 Section 2. 176 UTF8(STRING) denotes the octets of the UTF-8 [RFC3629] representation 177 of STRING. 179 ASCII(STRING) denotes the octets of the ASCII [USASCII] 180 representation of STRING. 182 The concatenation of two values A and B is denoted as A || B. 184 2. Terminology 186 These terms are defined by this specification: 188 JSON Web Signature (JWS) 189 A data structure representing a digitally signed or MACed message. 191 JOSE Header 192 JSON object containing the parameters describing the cryptographic 193 operations and parameters employed. The members of the JOSE 194 Header are Header Parameters. 196 JWS Payload 197 The sequence of octets to be secured -- a.k.a., the message. The 198 payload can contain an arbitrary sequence of octets. 200 JWS Signature 201 Digital signature or MAC over the JWS Protected Header and the JWS 202 Payload. 204 Header Parameter 205 A name/value pair that is member of the JOSE Header. 207 JWS Protected Header 208 JSON object that contains the Header Parameters that are integrity 209 protected by the JWS Signature digital signature or MAC operation. 210 For the JWS Compact Serialization, this comprises the entire JOSE 211 Header. For the JWS JSON Serialization, this is one component of 212 the JOSE Header. 214 JWS Unprotected Header 215 JSON object that contains the Header Parameters that are not 216 integrity protected. This can only be present when using the JWS 217 JSON Serialization. 219 Base64url Encoding 220 Base64 encoding using the URL- and filename-safe character set 221 defined in Section 5 of RFC 4648 [RFC4648], with all trailing '=' 222 characters omitted (as permitted by Section 3.2) and without the 223 inclusion of any line breaks, white space, or other additional 224 characters. (See Appendix C for notes on implementing base64url 225 encoding without padding.) 227 JWS Signing Input 228 The input to the digital signature or MAC computation. Its value 229 is ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 230 BASE64URL(JWS Payload)). 232 JWS Compact Serialization 233 A representation of the JWS as a compact, URL-safe string. 235 JWS JSON Serialization 236 A representation of the JWS as a JSON object. Unlike the JWS 237 Compact Serialization, the JWS JSON Serialization enables multiple 238 digital signatures and/or MACs to be applied to the same content. 239 This representation is neither optimized for compactness nor URL- 240 safe. 242 Plaintext JWS 243 A JWS object that provides no integrity protection. 245 Collision-Resistant Name 246 A name in a namespace that enables names to be allocated in a 247 manner such that they are highly unlikely to collide with other 248 names. Examples of collision-resistant namespaces include: Domain 249 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 250 X.670 Recommendation series, and Universally Unique IDentifiers 251 (UUIDs) [RFC4122]. When using an administratively delegated 252 namespace, the definer of a name needs to take reasonable 253 precautions to ensure they are in control of the portion of the 254 namespace they use to define the name. 256 StringOrURI 257 A JSON string value, with the additional requirement that while 258 arbitrary string values MAY be used, any value containing a ":" 259 character MUST be a URI [RFC3986]. StringOrURI values are 260 compared as case-sensitive strings with no transformations or 261 canonicalizations applied. 263 These terms defined by the JSON Web Encryption (JWE) [JWE] 264 specification are incorporated into this specification: "JSON Web 265 Encryption (JWE)" and "JWE Compact Serialization". 267 3. JSON Web Signature (JWS) Overview 269 JWS represents digitally signed or MACed content using JSON data 270 structures and base64url encoding. A JWS represents these logical 271 values: 273 JOSE Header 274 JSON object containing the parameters describing the cryptographic 275 operations and parameters employed. For a JWS object, the JOSE 276 Header members are the union of the members of the JWS Protected 277 Header and the JWS Unprotected Header, as described below. 279 JWS Payload 280 The sequence of octets to be secured -- a.k.a., the message. The 281 payload can contain an arbitrary sequence of octets. 283 JWS Signature 284 Digital signature or MAC over the JWS Protected Header and the JWS 285 Payload. 287 For a JWS object, the JOSE Header represents the combination of these 288 values: 290 JWS Protected Header 291 JSON object that contains the Header Parameters that are integrity 292 protected by the JWS Signature digital signature or MAC operation. 294 JWS Unprotected Header 295 JSON object that contains the Header Parameters that are not 296 integrity protected. 298 This document defines two serializations for JWS objects: a compact, 299 URL-safe serialization called the JWS Compact Serialization and a 300 JSON serialization called the JWS JSON Serialization. In both 301 serializations, the JWS Protected Header, JWS Payload, and JWS 302 Signature are base64url encoded for transmission, since JSON lacks a 303 way to directly represent octet sequences. 305 3.1. JWS Compact Serialization Overview 307 In the JWS Compact Serialization, no JWS Unprotected Header is used. 308 In this case, the JOSE Header and the JWS Protected Header are the 309 same. 311 In the JWS Compact Serialization, a JWS object is represented as the 312 combination of these three string values, 313 BASE64URL(UTF8(JWS Protected Header)), 314 BASE64URL(JWS Payload), and 315 BASE64URL(JWS Signature), 316 concatenated in that order, with the three strings being separated by 317 two period ('.') characters. 319 3.2. JWS JSON Serialization Overview 321 In the JWS JSON Serialization, one or both of the JWS Protected 322 Header and JWS Unprotected Header MUST be present. In this case, the 323 members of the JOSE Header are the combination of the members of the 324 JWS Protected Header and the JWS Unprotected Header values that are 325 present. 327 In the JWS JSON Serialization, a JWS object is represented as the 328 combination of these four values, 329 BASE64URL(UTF8(JWS Protected Header)), 330 JWS Unprotected Header, 331 BASE64URL(JWS Payload), and 332 BASE64URL(JWS Signature), 333 with the three base64url encoding result strings and the JWS 334 Unprotected Header value being represented as members within a JSON 335 object. The inclusion of some of these values is OPTIONAL. The JWS 336 JSON Serialization can also represent multiple signature and/or MAC 337 values, rather than just one. See Section 7.2 for more information 338 about the JWS JSON Serialization. 340 3.3. Example JWS 342 This section provides an example of a JWS. Its computation is 343 described in more detail in Appendix A.1, including specifying the 344 exact octet sequences representing the JSON values used and the key 345 value used. 347 The following example JWS Protected Header declares that the encoded 348 object is a JSON Web Token (JWT) [JWT] and the JWS Protected Header 349 and the JWS Payload are secured using the HMAC SHA-256 [RFC2104, SHS] 350 algorithm: 352 {"typ":"JWT", 353 "alg":"HS256"} 355 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 356 Header)) gives this value: 358 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 360 The UTF-8 representation of following JSON object is used as the JWS 361 Payload. (Note that the payload can be any content, and need not be 362 a representation of a JSON object.) 364 {"iss":"joe", 365 "exp":1300819380, 366 "http://example.com/is_root":true} 368 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value 369 (with line breaks for display purposes only): 371 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 372 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 374 Computing the HMAC of the JWS Signing Input ASCII(BASE64URL(UTF8(JWS 375 Protected Header)) || '.' || BASE64URL(JWS Payload)) with the HMAC 376 SHA-256 algorithm using the key specified in Appendix A.1 and 377 base64url encoding the result yields this BASE64URL(JWS Signature) 378 value: 380 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 382 Concatenating these values in the order Header.Payload.Signature with 383 period ('.') characters between the parts yields this complete JWS 384 representation using the JWS Compact Serialization (with line breaks 385 for display purposes only): 387 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 388 . 389 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 390 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 391 . 392 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 394 See Appendix A for additional examples. 396 4. JOSE Header 398 For a JWS object, the members of the JSON object(s) representing the 399 JOSE Header describe the digital signature or MAC applied to the JWS 400 Protected Header and the JWS Payload and optionally additional 401 properties of the JWS. The Header Parameter names within the JOSE 402 Header MUST be unique; recipients MUST either reject JWSs with 403 duplicate Header Parameter names or use a JSON parser that returns 404 only the lexically last duplicate member name, as specified in 405 Section 15.12 (The JSON Object) of ECMAScript 5.1 [ECMAScript]. 407 Implementations are required to understand the specific Header 408 Parameters defined by this specification that are designated as "MUST 409 be understood" and process them in the manner defined in this 410 specification. All other Header Parameters defined by this 411 specification that are not so designated MUST be ignored when not 412 understood. Unless listed as a critical Header Parameter, per 413 Section 4.1.11, all Header Parameters not defined by this 414 specification MUST be ignored when not understood. 416 There are three classes of Header Parameter names: Registered Header 417 Parameter names, Public Header Parameter names, and Private Header 418 Parameter names. 420 4.1. Registered Header Parameter Names 422 The following Header Parameter names for use in JWS objects are 423 registered in the IANA JSON Web Signature and Encryption Header 424 Parameters registry defined in Section 9.1, with meanings as defined 425 below. 427 As indicated by the common registry, JWSs and JWEs share a common 428 Header Parameter space; when a parameter is used by both 429 specifications, its usage must be compatible between the 430 specifications. 432 4.1.1. "alg" (Algorithm) Header Parameter 434 The "alg" (algorithm) Header Parameter identifies the cryptographic 435 algorithm used to secure the JWS. The signature, MAC, or plaintext 436 value is not valid if the "alg" value does not represent a supported 437 algorithm, or if there is not a key for use with that algorithm 438 associated with the party that digitally signed or MACed the content. 439 "alg" values should either be registered in the IANA JSON Web 440 Signature and Encryption Algorithms registry defined in [JWA] or be a 441 value that contains a Collision-Resistant Name. The "alg" value is a 442 case-sensitive string containing a StringOrURI value. This Header 443 Parameter MUST be present and MUST be understood and processed by 444 implementations. 446 A list of defined "alg" values for this use can be found in the IANA 447 JSON Web Signature and Encryption Algorithms registry defined in 448 [JWA]; the initial contents of this registry are the values defined 449 in Section 3.1 of the JSON Web Algorithms (JWA) [JWA] specification. 451 4.1.2. "jku" (JWK Set URL) Header Parameter 453 The "jku" (JWK Set URL) Header Parameter is a URI [RFC3986] that 454 refers to a resource for a set of JSON-encoded public keys, one of 455 which corresponds to the key used to digitally sign the JWS. The 456 keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The 457 protocol used to acquire the resource MUST provide integrity 458 protection; an HTTP GET request to retrieve the JWK Set MUST use TLS 459 [RFC2818, RFC5246]; the identity of the server MUST be validated, as 460 per Section 6 of RFC 6125 [RFC6125]. Use of this Header Parameter is 461 OPTIONAL. 463 4.1.3. "jwk" (JSON Web Key) Header Parameter 465 The "jwk" (JSON Web Key) Header Parameter is the public key that 466 corresponds to the key used to digitally sign the JWS. This key is 467 represented as a JSON Web Key [JWK]. Use of this Header Parameter is 468 OPTIONAL. 470 4.1.4. "kid" (Key ID) Header Parameter 472 The "kid" (key ID) Header Parameter is a hint indicating which key 473 was used to secure the JWS. This parameter allows originators to 474 explicitly signal a change of key to recipients. The structure of 475 the "kid" value is unspecified. Its value MUST be a string. Use of 476 this Header Parameter is OPTIONAL. 478 When used with a JWK, the "kid" value is used to match a JWK "kid" 479 parameter value. 481 4.1.5. "x5u" (X.509 URL) Header Parameter 483 The "x5u" (X.509 URL) Header Parameter is a URI [RFC3986] that refers 484 to a resource for the X.509 public key certificate or certificate 485 chain [RFC5280] corresponding to the key used to digitally sign the 486 JWS. The identified resource MUST provide a representation of the 487 certificate or certificate chain that conforms to RFC 5280 [RFC5280] 488 in PEM encoded form [RFC1421]. The certificate containing the public 489 key corresponding to the key used to digitally sign the JWS MUST be 490 the first certificate. This MAY be followed by additional 491 certificates, with each subsequent certificate being the one used to 492 certify the previous one. The protocol used to acquire the resource 493 MUST provide integrity protection; an HTTP GET request to retrieve 494 the certificate MUST use TLS [RFC2818, RFC5246]; the identity of the 495 server MUST be validated, as per Section 6 of RFC 6125 [RFC6125]. 496 Use of this Header Parameter is OPTIONAL. 498 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter 500 The "x5c" (X.509 Certificate Chain) Header Parameter contains the 501 X.509 public key certificate or certificate chain [RFC5280] 502 corresponding to the key used to digitally sign the JWS. The 503 certificate or certificate chain is represented as a JSON array of 504 certificate value strings. Each string in the array is a base64 505 encoded ([RFC4648] Section 4 -- not base64url encoded) DER 506 [ITU.X690.1994] PKIX certificate value. The certificate containing 507 the public key corresponding to the key used to digitally sign the 508 JWS MUST be the first certificate. This MAY be followed by 509 additional certificates, with each subsequent certificate being the 510 one used to certify the previous one. The recipient MUST validate 511 the certificate chain according to RFC 5280 [RFC5280] and reject the 512 signature if any validation failure occurs. Use of this Header 513 Parameter is OPTIONAL. 515 See Appendix B for an example "x5c" value. 517 4.1.7. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter 519 The "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter is a 520 base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER 521 encoding of the X.509 certificate [RFC5280] corresponding to the key 522 used to digitally sign the JWS. Use of this Header Parameter is 523 OPTIONAL. 525 4.1.8. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 526 Parameter 528 The "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 529 Parameter is a base64url encoded SHA-256 thumbprint (a.k.a. digest) 530 of the DER encoding of the X.509 certificate [RFC5280] corresponding 531 to the key used to digitally sign the JWS. Use of this Header 532 Parameter is OPTIONAL. 534 4.1.9. "typ" (Type) Header Parameter 536 The "typ" (type) Header Parameter is used by JWS applications to 537 declare the MIME Media Type [IANA.MediaTypes] of this complete JWS 538 object. This is intended for use by the application when more than 539 one kind of object could be present in an application data structure 540 that can contain a JWS object; the application can use this value to 541 disambiguate among the different kinds of objects that might be 542 present. It will typically not be used by applications when the kind 543 of object is already known. This parameter has no effect upon the 544 JWS processing. Use of this Header Parameter is OPTIONAL. 546 Per RFC 2045 [RFC2045], all media type values, subtype values, and 547 parameter names are case-insensitive. However, parameter values are 548 case-sensitive unless otherwise specified for the specific parameter. 550 To keep messages compact in common situations, it is RECOMMENDED that 551 senders omit an "application/" prefix of a media type value in a 552 "typ" Header Parameter when no other '/' appears in the media type 553 value. A recipient using the media type value MUST treat it as if 554 "application/" were prepended to any "typ" value not containing a 555 '/'. For instance, a "typ" value of "example" SHOULD be used to 556 represent the "application/example" media type; whereas, the media 557 type "application/example;part="1/2"" cannot be shortened to 558 "example;part="1/2"". 560 The "typ" value "JOSE" can be used by applications to indicate that 561 this object is a JWS or JWE using the JWS Compact Serialization or 562 the JWE Compact Serialization. The "typ" value "JOSE+JSON" can be 563 used by applications to indicate that this object is a JWS or JWE 564 using the JWS JSON Serialization or the JWE JSON Serialization. 566 Other type values can also be used by applications. 568 4.1.10. "cty" (Content Type) Header Parameter 570 The "cty" (content type) Header Parameter is used by JWS applications 571 to declare the MIME Media Type [IANA.MediaTypes] of the secured 572 content (the payload). This is intended for use by the application 573 when more than one kind of object could be present in the JWS 574 payload; the application can use this value to disambiguate among the 575 different kinds of objects that might be present. It will typically 576 not be used by applications when the kind of object is already known. 577 This parameter has no effect upon the JWS processing. Use of this 578 Header Parameter is OPTIONAL. 580 Per RFC 2045 [RFC2045], all media type values, subtype values, and 581 parameter names are case-insensitive. However, parameter values are 582 case-sensitive unless otherwise specified for the specific parameter. 584 To keep messages compact in common situations, it is RECOMMENDED that 585 senders omit an "application/" prefix of a media type value in a 586 "cty" Header Parameter when no other '/' appears in the media type 587 value. A recipient using the media type value MUST treat it as if 588 "application/" were prepended to any "cty" value not containing a 589 '/'. For instance, a "cty" value of "example" SHOULD be used to 590 represent the "application/example" media type; whereas, the media 591 type "application/example;part="1/2"" cannot be shortened to 592 "example;part="1/2"". 594 4.1.11. "crit" (Critical) Header Parameter 596 The "crit" (critical) Header Parameter indicates that extensions to 597 the initial RFC versions of [[ this specification ]] and [JWA] are 598 being used that MUST be understood and processed. Its value is an 599 array listing the Header Parameter names present in the JOSE Header 600 that use those extensions. If any of the listed extension Header 601 Parameters are not understood and supported by the receiver, it MUST 602 reject the JWS. Senders MUST NOT include Header Parameter names 603 defined by the initial RFC versions of [[ this specification ]] or 604 [JWA] for use with JWS, duplicate names, or names that do not occur 605 as Header Parameter names within the JOSE Header in the "crit" list. 606 Senders MUST NOT use the empty list "[]" as the "crit" value. 607 Recipients MAY reject the JWS if the critical list contains any 608 Header Parameter names defined by the initial RFC versions of [[ this 609 specification ]] or [JWA] for use with JWS, or any other constraints 610 on its use are violated. This Header Parameter MUST be integrity 611 protected, and therefore MUST occur only within the JWS Protected 612 Header, when used. Use of this Header Parameter is OPTIONAL. This 613 Header Parameter MUST be understood and processed by implementations. 615 An example use, along with a hypothetical "exp" (expiration-time) 616 field is: 618 {"alg":"ES256", 619 "crit":["exp"], 620 "exp":1363284000 621 } 623 4.2. Public Header Parameter Names 625 Additional Header Parameter names can be defined by those using JWSs. 626 However, in order to prevent collisions, any new Header Parameter 627 name should either be registered in the IANA JSON Web Signature and 628 Encryption Header Parameters registry defined in Section 9.1 or be a 629 Public Name: a value that contains a Collision-Resistant Name. In 630 each case, the definer of the name or value needs to take reasonable 631 precautions to make sure they are in control of the part of the 632 namespace they use to define the Header Parameter name. 634 New Header Parameters should be introduced sparingly, as they can 635 result in non-interoperable JWSs. 637 4.3. Private Header Parameter Names 639 A producer and consumer of a JWS may agree to use Header Parameter 640 names that are Private Names: names that are not Registered Header 641 Parameter names Section 4.1 or Public Header Parameter names 642 Section 4.2. Unlike Public Header Parameter names, Private Header 643 Parameter names are subject to collision and should be used with 644 caution. 646 5. Producing and Consuming JWSs 648 5.1. Message Signature or MAC Computation 650 To create a JWS, one MUST perform these steps. The order of the 651 steps is not significant in cases where there are no dependencies 652 between the inputs and outputs of the steps. 653 1. Create the content to be used as the JWS Payload. 654 2. Compute the encoded payload value BASE64URL(JWS Payload). 655 3. Create the JSON object(s) containing the desired set of Header 656 Parameters, which together comprise the JOSE Header: the JWS 657 Protected Header, and if the JWS JSON Serialization is being 658 used, the JWS Unprotected Header. 659 4. Compute the encoded header value BASE64URL(UTF8(JWS Protected 660 Header)). If the JWS Protected Header is not present (which can 661 only happen when using the JWS JSON Serialization and no 662 "protected" member is present), let this value be the empty 663 string. 664 5. Compute the JWS Signature in the manner defined for the 665 particular algorithm being used over the JWS Signing Input 666 ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 667 BASE64URL(JWS Payload)). The "alg" (algorithm) Header Parameter 668 MUST be present in the JOSE Header, with the algorithm value 669 accurately representing the algorithm used to construct the JWS 670 Signature. 671 6. Compute the encoded signature value BASE64URL(JWS Signature). 672 7. These three encoded values are used in both the JWS Compact 673 Serialization and the JWS JSON Serialization representations. 674 8. If the JWS JSON Serialization is being used, repeat this process 675 (steps 3-7) for each digital signature or MAC operation being 676 performed. 677 9. Create the desired serialized output. The JWS Compact 678 Serialization of this result is BASE64URL(UTF8(JWS Protected 679 Header)) || '.' || BASE64URL(JWS Payload) || '.' || BASE64URL(JWS 680 Signature). The JWS JSON Serialization is described in 681 Section 7.2. 683 5.2. Message Signature or MAC Validation 685 When validating a JWS, the following steps MUST be taken. The order 686 of the steps is not significant in cases where there are no 687 dependencies between the inputs and outputs of the steps. If any of 688 the listed steps fails, then the signature or MAC cannot be 689 validated. 691 It is an application decision which signatures, MACs, or plaintext 692 values must successfully validate for the JWS to be accepted. In 693 some cases, all must successfully validate or the JWS will be 694 rejected. In other cases, only a specific signature, MAC, or 695 plaintext value needs to be successfully validated. However, in all 696 cases, at least one signature, MAC, or plaintext value MUST 697 successfully validate or the JWS MUST be rejected. 699 1. Parse the JWS representation to extract the serialized values 700 for the components of the JWS. When using the JWS Compact 701 Serialization, these components are the base64url encoded 702 representations of the JWS Protected Header, the JWS Payload, 703 and the JWS Signature, and when using the JWS JSON 704 Serialization, these components also include the unencoded JWS 705 Unprotected Header value. When using the JWS Compact 706 Serialization, the JWS Protected Header, the JWS Payload, and 707 the JWS Signature are represented as base64url encoded values in 708 that order, separated by two period ('.') characters. The JWS 709 JSON Serialization is described in Section 7.2. 711 2. The encoded representation of the JWS Protected Header MUST be 712 successfully base64url decoded following the restriction that no 713 padding characters have been used. 714 3. The resulting octet sequence MUST be a UTF-8 encoded 715 representation of a completely valid JSON object conforming to 716 RFC 7159 [RFC7159], which is the JWS Protected Header. 717 4. If using the JWS Compact Serialization, let the JOSE Header be 718 the JWS Protected Header. Otherwise, when using the JWS JSON 719 Serialization, let the JOSE Header be the union of the members 720 of the corresponding JWS Protected Header and JWS Unprotected 721 Header, all of which must be completely valid JSON objects. 722 5. The resulting JOSE Header MUST NOT contain duplicate Header 723 Parameter names. When using the JWS JSON Serialization, this 724 restriction includes that the same Header Parameter name also 725 MUST NOT occur in distinct JSON object values that together 726 comprise the JOSE Header. 727 6. Verify that the implementation understands and can process all 728 fields that it is required to support, whether required by this 729 specification, by the algorithm being used, or by the "crit" 730 Header Parameter value, and that the values of those parameters 731 are also understood and supported. 732 7. The encoded representation of the JWS Payload MUST be 733 successfully base64url decoded following the restriction that no 734 padding characters have been used. 735 8. The encoded representation of the JWS Signature MUST be 736 successfully base64url decoded following the restriction that no 737 padding characters have been used. 738 9. The JWS Signature MUST be successfully validated against the JWS 739 Signing Input ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' 740 || BASE64URL(JWS Payload)) in the manner defined for the 741 algorithm being used, which MUST be accurately represented by 742 the value of the "alg" (algorithm) Header Parameter, which MUST 743 be present. 744 10. If the JWS JSON Serialization is being used, repeat this process 745 (steps 4-9) for each digital signature or MAC value contained in 746 the representation. 748 5.3. String Comparison Rules 750 Processing a JWS inevitably requires comparing known strings to 751 members and values in a JSON object. For example, in checking what 752 the algorithm is, the Unicode string "alg" will be checked against 753 the member names in the JOSE Header to see if there is a matching 754 Header Parameter name. The same process is then used to determine if 755 the value of the "alg" Header Parameter represents a supported 756 algorithm. 758 Since the only string comparison operations that are performed are 759 equality and inequality, the same rules can be used for comparing 760 both member names and member values against known strings. The JSON 761 rules for doing member name comparison are described in Section 8.3 762 of RFC 7159 [RFC7159]. 764 Also, see the JSON security considerations in Section 10.6 and the 765 Unicode security considerations in Section 10.7. 767 6. Key Identification 769 It is necessary for the recipient of a JWS to be able to determine 770 the key that was employed for the digital signature or MAC operation. 771 The key employed can be identified using the Header Parameter methods 772 described in Section 4.1 or can be identified using methods that are 773 outside the scope of this specification. Specifically, the Header 774 Parameters "jku", "jwk", "kid", "x5u", "x5c", "x5t", and "x5t#S256" 775 can be used to identify the key used. These Header Parameters MUST 776 be integrity protected if the information that they convey is to be 777 utilized in a trust decision. 779 The sender SHOULD include sufficient information in the Header 780 Parameters to identify the key used, unless the application uses 781 another means or convention to determine the key used. Validation of 782 the signature or MAC fails when the algorithm used requires a key 783 (which is true of all algorithms except for "none") and the key used 784 cannot be determined. 786 The means of exchanging any shared symmetric keys used is outside the 787 scope of this specification. 789 Also, see Appendix D for notes on possible key selection algorithms. 791 7. Serializations 793 JWS objects use one of two serializations, the JWS Compact 794 Serialization or the JWS JSON Serialization. Applications using this 795 specification need to specify what serialization and serialization 796 features are used for that application. For instance, applications 797 might specify that only the JWS JSON Serialization is used, that only 798 JWS JSON Serialization support for a single signature or MAC value is 799 used, or that support for multiple signatures and/or MAC values is 800 used. JWS implementations only need to implement the features needed 801 for the applications they are designed to support. 803 7.1. JWS Compact Serialization 805 The JWS Compact Serialization represents digitally signed or MACed 806 content as a compact URL-safe string. This string is 807 BASE64URL(UTF8(JWS Protected Header)) || '.' || BASE64URL(JWS 808 Payload) || '.' || BASE64URL(JWS Signature). Only one signature/MAC 809 is supported by the JWS Compact Serialization and it provides no 810 syntax to represent a JWS Unprotected Header value. 812 7.2. JWS JSON Serialization 814 The JWS JSON Serialization represents digitally signed or MACed 815 content as a JSON object. Content using the JWS JSON Serialization 816 can be secured with more than one digital signature and/or MAC 817 operation. This representation is neither optimized for compactness 818 nor URL-safe. 820 The following members are defined for use in top-level JSON objects 821 used for the JWS JSON Serialization: 822 payload 823 The "payload" member MUST be present and contain the value 824 BASE64URL(JWS Payload). 825 signatures 826 The "signatures" member value MUST be an array of JSON objects. 827 Each object represents a signature or MAC over the JWS Payload and 828 the JWS Protected Header. 830 The following members are defined for use in the JSON objects that 831 are elements of the "signatures" array: 832 protected 833 The "protected" member MUST be present and contain the value 834 BASE64URL(UTF8(JWS Protected Header)) when the JWS Protected 835 Header value is non-empty; otherwise, it MUST be absent. These 836 Header Parameter values are integrity protected. 837 header 838 The "header" member MUST be present and contain the value JWS 839 Unprotected Header when the JWS Unprotected Header value is non- 840 empty; otherwise, it MUST be absent. This value is represented as 841 an unencoded JSON object, rather than as a string. These Header 842 Parameter values are not integrity protected. 843 signature 844 The "signature" member MUST be present and contain the value 845 BASE64URL(JWS Signature). 847 At least one of the "protected" and "header" members MUST be present 848 for each signature/MAC computation so that an "alg" Header Parameter 849 value is conveyed. 851 Additional members can be present in both the JSON objects defined 852 above; if not understood by implementations encountering them, they 853 MUST be ignored. 855 The Header Parameter values used when creating or validating 856 individual signature or MAC values are the union of the two sets of 857 Header Parameter values that may be present: (1) the JWS Protected 858 Header represented in the "protected" member of the signature/MAC's 859 array element, and (2) the JWS Unprotected Header in the "header" 860 member of the signature/MAC's array element. The union of these sets 861 of Header Parameters comprises the JOSE Header. The Header Parameter 862 names in the two locations MUST be disjoint. 864 Each JWS Signature value is computed using the parameters of the 865 corresponding JOSE Header value in the same manner as for the JWS 866 Compact Serialization. This has the desirable property that each JWS 867 Signature value represented in the "signatures" array is identical to 868 the value that would have been computed for the same parameter in the 869 JWS Compact Serialization, provided that the JWS Protected Header 870 value for that signature/MAC computation (which represents the 871 integrity-protected Header Parameter values) matches that used in the 872 JWS Compact Serialization. 874 In summary, the syntax of a JWS using the JWS JSON Serialization is 875 as follows: 877 { 878 "payload":"", 879 "signatures":[ 880 {"protected":"", 881 "header":, 882 "signature":""}, 883 ... 884 {"protected":"", 885 "header":, 886 "signature":""}] 887 } 889 See Appendix A.6 for an example of computing a JWS using the JWS JSON 890 Serialization. 892 8. TLS Requirements 894 Implementations MUST support TLS. Which version(s) ought to be 895 implemented will vary over time, and depend on the widespread 896 deployment and known security vulnerabilities at the time of 897 implementation. At the time of this writing, TLS version 1.2 899 [RFC5246] is the most recent version. 901 To protect against information disclosure and tampering, 902 confidentiality protection MUST be applied using TLS with a 903 ciphersuite that provides confidentiality and integrity protection. 905 Whenever TLS is used, the identity of the service provider encoded in 906 the TLS server certificate MUST be verified using the procedures 907 described in Section 6 of RFC 6125 [RFC6125]. 909 9. IANA Considerations 911 The following registration procedure is used for all the registries 912 established by this specification. 914 Values are registered on a Specification Required [RFC5226] basis 915 after a two-week review period on the [TBD]@ietf.org mailing list, on 916 the advice of one or more Designated Experts. However, to allow for 917 the allocation of values prior to publication, the Designated 918 Expert(s) may approve registration once they are satisfied that such 919 a specification will be published. 921 Registration requests must be sent to the [TBD]@ietf.org mailing list 922 for review and comment, with an appropriate subject (e.g., "Request 923 for access token type: example"). [[ Note to the RFC Editor: The name 924 of the mailing list should be determined in consultation with the 925 IESG and IANA. Suggested name: jose-reg-review. ]] 927 Within the review period, the Designated Expert(s) will either 928 approve or deny the registration request, communicating this decision 929 to the review list and IANA. Denials should include an explanation 930 and, if applicable, suggestions as to how to make the request 931 successful. Registration requests that are undetermined for a period 932 longer than 21 days can be brought to the IESG's attention (using the 933 iesg@iesg.org mailing list) for resolution. 935 Criteria that should be applied by the Designated Expert(s) includes 936 determining whether the proposed registration duplicates existing 937 functionality, determining whether it is likely to be of general 938 applicability or whether it is useful only for a single application, 939 and whether the registration makes sense. 941 IANA must only accept registry updates from the Designated Expert(s) 942 and should direct all requests for registration to the review mailing 943 list. 945 It is suggested that multiple Designated Experts be appointed who are 946 able to represent the perspectives of different applications using 947 this specification, in order to enable broadly-informed review of 948 registration decisions. In cases where a registration decision could 949 be perceived as creating a conflict of interest for a particular 950 Expert, that Expert should defer to the judgment of the other 951 Expert(s). 953 9.1. JSON Web Signature and Encryption Header Parameters Registry 955 This specification establishes the IANA JSON Web Signature and 956 Encryption Header Parameters registry for Header Parameter names. 957 The registry records the Header Parameter name and a reference to the 958 specification that defines it. The same Header Parameter name can be 959 registered multiple times, provided that the parameter usage is 960 compatible between the specifications. Different registrations of 961 the same Header Parameter name will typically use different Header 962 Parameter Usage Location(s) values. 964 9.1.1. Registration Template 966 Header Parameter Name: 967 The name requested (e.g., "example"). Because a core goal of this 968 specification is for the resulting representations to be compact, 969 it is RECOMMENDED that the name be short -- not to exceed 8 970 characters without a compelling reason to do so. This name is 971 case-sensitive. Names may not match other registered names in a 972 case-insensitive manner unless the Designated Expert(s) state that 973 there is a compelling reason to allow an exception in this 974 particular case. 975 Header Parameter Description: 976 Brief description of the Header Parameter (e.g., "Example 977 description"). 978 Header Parameter Usage Location(s): 979 The Header Parameter usage locations, which should be one or more 980 of the values "JWS" or "JWE". 981 Change Controller: 982 For Standards Track RFCs, state "IESG". For others, give the name 983 of the responsible party. Other details (e.g., postal address, 984 email address, home page URI) may also be included. 985 Specification Document(s): 986 Reference to the document(s) that specify the parameter, 987 preferably including URI(s) that can be used to retrieve copies of 988 the document(s). An indication of the relevant sections may also 989 be included but is not required. 991 9.1.2. Initial Registry Contents 993 This specification registers the Header Parameter names defined in 994 Section 4.1 in this registry. 996 o Header Parameter Name: "alg" 997 o Header Parameter Description: Algorithm 998 o Header Parameter Usage Location(s): JWS 999 o Change Controller: IESG 1000 o Specification Document(s): Section 4.1.1 of [[ this document ]] 1002 o Header Parameter Name: "jku" 1003 o Header Parameter Description: JWK Set URL 1004 o Header Parameter Usage Location(s): JWS 1005 o Change Controller: IESG 1006 o Specification Document(s): Section 4.1.2 of [[ this document ]] 1008 o Header Parameter Name: "jwk" 1009 o Header Parameter Description: JSON Web Key 1010 o Header Parameter Usage Location(s): JWS 1011 o Change Controller: IESG 1012 o Specification document(s): Section 4.1.3 of [[ this document ]] 1014 o Header Parameter Name: "kid" 1015 o Header Parameter Description: Key ID 1016 o Header Parameter Usage Location(s): JWS 1017 o Change Controller: IESG 1018 o Specification Document(s): Section 4.1.4 of [[ this document ]] 1020 o Header Parameter Name: "x5u" 1021 o Header Parameter Description: X.509 URL 1022 o Header Parameter Usage Location(s): JWS 1023 o Change Controller: IESG 1024 o Specification Document(s): Section 4.1.5 of [[ this document ]] 1026 o Header Parameter Name: "x5c" 1027 o Header Parameter Description: X.509 Certificate Chain 1028 o Header Parameter Usage Location(s): JWS 1029 o Change Controller: IESG 1030 o Specification Document(s): Section 4.1.6 of [[ this document ]] 1032 o Header Parameter Name: "x5t" 1033 o Header Parameter Description: X.509 Certificate SHA-1 Thumbprint 1034 o Header Parameter Usage Location(s): JWS 1035 o Change Controller: IESG 1036 o Specification Document(s): Section 4.1.7 of [[ this document ]] 1037 o Header Parameter Name: "x5t#S256" 1038 o Header Parameter Description: X.509 Certificate SHA-256 Thumbprint 1039 o Header Parameter Usage Location(s): JWS 1040 o Change Controller: IESG 1041 o Specification Document(s): Section 4.1.8 of [[ this document ]] 1043 o Header Parameter Name: "typ" 1044 o Header Parameter Description: Type 1045 o Header Parameter Usage Location(s): JWS 1046 o Change Controller: IESG 1047 o Specification Document(s): Section 4.1.9 of [[ this document ]] 1049 o Header Parameter Name: "cty" 1050 o Header Parameter Description: Content Type 1051 o Header Parameter Usage Location(s): JWS 1052 o Change Controller: IESG 1053 o Specification Document(s): Section 4.1.10 of [[ this document ]] 1055 o Header Parameter Name: "crit" 1056 o Header Parameter Description: Critical 1057 o Header Parameter Usage Location(s): JWS 1058 o Change Controller: IESG 1059 o Specification Document(s): Section 4.1.11 of [[ this document ]] 1061 9.2. Media Type Registration 1063 9.2.1. Registry Contents 1065 This specification registers the "application/jose" Media Type 1066 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes], which 1067 can be used to indicate that the content is a JWS or JWE object using 1068 the JWS Compact Serialization or the JWE Compact Serialization and 1069 the "application/jose+json" Media Type in the MIME Media Types 1070 registry, which can be used to indicate that the content is a JWS or 1071 JWE object using the JWS JSON Serialization or the JWE JSON 1072 Serialization. 1074 o Type name: application 1075 o Subtype name: jose 1076 o Required parameters: n/a 1077 o Optional parameters: n/a 1078 o Encoding considerations: 8bit; application/jose values are encoded 1079 as a series of base64url encoded values (some of which may be the 1080 empty string) separated by period ('.') characters. 1081 o Security considerations: See the Security Considerations section 1082 of [[ this document ]] 1084 o Interoperability considerations: n/a 1085 o Published specification: [[ this document ]] 1086 o Applications that use this media type: OpenID Connect, Mozilla 1087 Persona, Salesforce, Google, Android, Windows Azure, Xbox One, and 1088 numerous others that use JWTs 1089 o Additional information: Magic number(s): n/a, File extension(s): 1090 n/a, Macintosh file type code(s): n/a 1091 o Person & email address to contact for further information: Michael 1092 B. Jones, mbj@microsoft.com 1093 o Intended usage: COMMON 1094 o Restrictions on usage: none 1095 o Author: Michael B. Jones, mbj@microsoft.com 1096 o Change Controller: IESG 1098 o Type name: application 1099 o Subtype name: jose+json 1100 o Required parameters: n/a 1101 o Optional parameters: n/a 1102 o Encoding considerations: 8bit; application/jose+json values are 1103 represented as a JSON Object; UTF-8 encoding SHOULD be employed 1104 for the JSON object. 1105 o Security considerations: See the Security Considerations section 1106 of [[ this document ]] 1107 o Interoperability considerations: n/a 1108 o Published specification: [[ this document ]] 1109 o Applications that use this media type: TBD 1110 o Additional information: Magic number(s): n/a, File extension(s): 1111 n/a, Macintosh file type code(s): n/a 1112 o Person & email address to contact for further information: Michael 1113 B. Jones, mbj@microsoft.com 1114 o Intended usage: COMMON 1115 o Restrictions on usage: none 1116 o Author: Michael B. Jones, mbj@microsoft.com 1117 o Change Controller: IESG 1119 10. Security Considerations 1121 All of the security issues that are pertinent to any cryptographic 1122 application must be addressed by JWS/JWE/JWK agents. Among these 1123 issues are protecting the user's asymmetric private and symmetric 1124 secret keys, preventing various attacks, and helping avoid mistakes 1125 such as inadvertently encrypting a message to the wrong recipient. 1126 The entire list of security considerations is beyond the scope of 1127 this document, but some significant considerations are listed here. 1129 All the security considerations in XML DSIG 2.0 1130 [W3C.NOTE-xmldsig-core2-20130411], also apply to this specification, 1131 other than those that are XML specific. Likewise, many of the best 1132 practices documented in XML Signature Best Practices 1133 [W3C.NOTE-xmldsig-bestpractices-20130411] also apply to this 1134 specification, other than those that are XML specific. 1136 10.1. Key Entropy 1138 Keys are only as strong as the amount of entropy used to generate 1139 them. A minimum of 128 bits of entropy should be used for all keys, 1140 and depending upon the application context, more may be required. In 1141 particular, it may be difficult to generate sufficiently random 1142 values in some browsers and application environments. 1144 10.2. Chosen Plaintext Attacks 1146 Creators of JWSs should not allow third parties to insert arbitrary 1147 content into the message without adding entropy not controlled by the 1148 third party. 1150 10.3. Timing Attacks 1152 When cryptographic algorithms are implemented in such a way that 1153 successful operations take a different amount of time than 1154 unsuccessful operations, attackers may be able to use the time 1155 difference to obtain information about the keys employed. Therefore, 1156 such timing differences must be avoided. 1158 10.4. Differences between Digital Signatures and MACs 1160 While MACs and digital signatures can both be used for integrity 1161 checking, there are some significant differences between the security 1162 properties that each of them provides. These need to be taken into 1163 consideration when designing protocols and selecting the algorithms 1164 to be used in protocols. 1166 Both signatures and MACs provide for integrity checking -- verifying 1167 that the message has not been modified since the integrity value was 1168 computed. However, MACs provide for origination identification only 1169 under specific circumstances. It can normally be assumed that a 1170 private key used for a signature is only in the hands of a single 1171 entity (although perhaps a distributed entity, in the case of 1172 replicated servers); however, a MAC key needs to be in the hands of 1173 all the entities that use it for integrity computation and checking. 1174 This means that origination can only be determined if a MAC key is 1175 known only to two entities and the receiver knows that it did not 1176 create the message. MAC validation cannot be used to prove 1177 origination to a third party. 1179 10.5. SHA-1 Certificate Thumbprints 1181 A SHA-1 hash is used when computing "x5t" (X.509 Certificate SHA-1 1182 Thumbprint) values, for compatibility reasons. Should an effective 1183 means of producing SHA-1 hash collisions be developed, and should an 1184 attacker wish to interfere with the use of a known certificate on a 1185 given system, this could be accomplished by creating another 1186 certificate whose SHA-1 hash value is the same and adding it to the 1187 certificate store used by the intended victim. A prerequisite to 1188 this attack succeeding is the attacker having write access to the 1189 intended victim's certificate store. 1191 Alternatively, the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) 1192 Header Parameter could be used instead of "x5t". However, at the 1193 time of this writing, no development platform is known to support 1194 SHA-256 certificate thumbprints. 1196 10.6. JSON Security Considerations 1198 Strict JSON [RFC7159] validation is a security requirement. If 1199 malformed JSON is received, then the intent of the sender is 1200 impossible to reliably discern. Ambiguous and potentially 1201 exploitable situations could arise if the JSON parser used does not 1202 reject malformed JSON syntax. In particular, any JSON inputs not 1203 conforming to the JSON-text syntax defined in RFC 7159 input MUST be 1204 rejected in their entirety. 1206 Section 4 of the JSON Data Interchange Format specification [RFC7159] 1207 states "The names within an object SHOULD be unique", whereas this 1208 specification states that "Header Parameter names within this object 1209 MUST be unique; recipients MUST either reject JWSs with duplicate 1210 Header Parameter names or use a JSON parser that returns only the 1211 lexically last duplicate member name, as specified in Section 15.12 1212 (The JSON Object) of ECMAScript 5.1 [ECMAScript]". Thus, this 1213 specification requires that the Section 4 "SHOULD" be treated as a 1214 "MUST" by senders and that it be either treated as a "MUST" or in the 1215 manner specified in ECMAScript 5.1 by receivers. Ambiguous and 1216 potentially exploitable situations could arise if the JSON parser 1217 used does not enforce the uniqueness of member names or returns an 1218 unpredictable value for duplicate member names. 1220 Some JSON parsers might not reject input that contains extra 1221 significant characters after a valid input. For instance, the input 1222 "{"tag":"value"}ABCD" contains a valid JSON-text object followed by 1223 the extra characters "ABCD". Such input MUST be rejected in its 1224 entirety. 1226 10.7. Unicode Comparison Security Considerations 1228 Header Parameter names and algorithm names are Unicode strings. For 1229 security reasons, the representations of these names must be compared 1230 verbatim after performing any escape processing (as per Section 8.3 1231 of RFC 7159 [RFC7159]). This means, for instance, that these JSON 1232 strings must compare as being equal ("sig", "\u0073ig"), whereas 1233 these must all compare as being not equal to the first set or to each 1234 other ("SIG", "Sig", "si\u0047"). 1236 JSON strings can contain characters outside the Unicode Basic 1237 Multilingual Plane. For instance, the G clef character (U+1D11E) may 1238 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWS 1239 implementations SHOULD ensure that characters outside the Basic 1240 Multilingual Plane are preserved and compared correctly; 1241 alternatively, if this is not possible due to these characters 1242 exercising limitations present in the underlying JSON implementation, 1243 then input containing them MUST be rejected. 1245 11. References 1247 11.1. Normative References 1249 [ECMAScript] 1250 Ecma International, "ECMAScript Language Specification, 1251 5.1 Edition", ECMA 262, June 2011. 1253 [IANA.MediaTypes] 1254 Internet Assigned Numbers Authority (IANA), "MIME Media 1255 Types", 2005. 1257 [ITU.X690.1994] 1258 International Telecommunications Union, "Information 1259 Technology - ASN.1 encoding rules: Specification of Basic 1260 Encoding Rules (BER), Canonical Encoding Rules (CER) and 1261 Distinguished Encoding Rules (DER)", ITU-T Recommendation 1262 X.690, 1994. 1264 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 1265 draft-ietf-jose-json-web-algorithms (work in progress), 1266 July 2014. 1268 [JWK] Jones, M., "JSON Web Key (JWK)", 1269 draft-ietf-jose-json-web-key (work in progress), 1270 July 2014. 1272 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 1273 Mail: Part I: Message Encryption and Authentication 1274 Procedures", RFC 1421, February 1993. 1276 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1277 Extensions (MIME) Part One: Format of Internet Message 1278 Bodies", RFC 2045, November 1996. 1280 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1281 Extensions (MIME) Part Two: Media Types", RFC 2046, 1282 November 1996. 1284 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1285 Requirement Levels", BCP 14, RFC 2119, March 1997. 1287 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1289 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1290 10646", STD 63, RFC 3629, November 2003. 1292 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1293 Resource Identifier (URI): Generic Syntax", STD 66, 1294 RFC 3986, January 2005. 1296 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1297 Encodings", RFC 4648, October 2006. 1299 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1300 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1302 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1303 Housley, R., and W. Polk, "Internet X.509 Public Key 1304 Infrastructure Certificate and Certificate Revocation List 1305 (CRL) Profile", RFC 5280, May 2008. 1307 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 1308 Verification of Domain-Based Application Service Identity 1309 within Internet Public Key Infrastructure Using X.509 1310 (PKIX) Certificates in the Context of Transport Layer 1311 Security (TLS)", RFC 6125, March 2011. 1313 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 1314 Interchange Format", RFC 7159, March 2014. 1316 [USASCII] American National Standards Institute, "Coded Character 1317 Set -- 7-bit American Standard Code for Information 1318 Interchange", ANSI X3.4, 1986. 1320 11.2. Informative References 1322 [CanvasApp] 1323 Facebook, "Canvas Applications", 2010. 1325 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 1326 September 2010. 1328 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 1329 draft-ietf-jose-json-web-encryption (work in progress), 1330 July 2014. 1332 [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 1333 (JWT)", draft-ietf-oauth-json-web-token (work in 1334 progress), July 2014. 1336 [MagicSignatures] 1337 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 1338 Signatures", January 2011. 1340 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 1341 Hashing for Message Authentication", RFC 2104, 1342 February 1997. 1344 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 1345 Unique IDentifier (UUID) URN Namespace", RFC 4122, 1346 July 2005. 1348 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1349 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1350 May 2008. 1352 [SHS] National Institute of Standards and Technology, "Secure 1353 Hash Standard (SHS)", FIPS PUB 180-3, October 2008. 1355 [W3C.NOTE-xmldsig-bestpractices-20130411] 1356 Hirsch, F. and P. Datta, "XML Signature Best Practices", 1357 World Wide Web Consortium Note NOTE-xmldsig-bestpractices- 1358 20130411, April 2013, . 1361 [W3C.NOTE-xmldsig-core2-20130411] 1362 Eastlake, D., Reagle, J., Solo, D., Hirsch, F., Roessler, 1363 T., Yiu, K., Datta, P., and S. Cantor, "XML Signature 1364 Syntax and Processing Version 2.0", World Wide Web 1365 Consortium Note NOTE-xmldsig-core2-20130411, April 2013, 1366 . 1368 Appendix A. JWS Examples 1370 This section provides several examples of JWSs. While the first 1371 three examples all represent JSON Web Tokens (JWTs) [JWT], the 1372 payload can be any octet sequence, as shown in Appendix A.4. 1374 A.1. Example JWS using HMAC SHA-256 1376 A.1.1. Encoding 1378 The following example JWS Protected Header declares that the data 1379 structure is a JSON Web Token (JWT) [JWT] and the JWS Signing Input 1380 is secured using the HMAC SHA-256 algorithm. 1382 {"typ":"JWT", 1383 "alg":"HS256"} 1385 To remove potential ambiguities in the representation of the JSON 1386 object above, the actual octet sequence representing UTF8(JWS 1387 Protected Header) used in this example is also included below. (Note 1388 that ambiguities can arise due to differing platform representations 1389 of line breaks (CRLF versus LF), differing spacing at the beginning 1390 and ends of lines, whether the last line has a terminating line break 1391 or not, and other causes. In the representation used in this 1392 example, the first line has no leading or trailing spaces, a CRLF 1393 line break (13, 10) occurs between the first and second lines, the 1394 second line has one leading space (32) and no trailing spaces, and 1395 the last line does not have a terminating line break.) The octets 1396 representing UTF8(JWS Protected Header) in this example (using JSON 1397 array notation) are: 1399 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 1400 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 1402 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1403 Header)) gives this value: 1405 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1407 The JWS Payload used in this example is the octets of the UTF-8 1408 representation of the JSON object below. (Note that the payload can 1409 be any base64url encoded octet sequence, and need not be a base64url 1410 encoded JSON object.) 1412 {"iss":"joe", 1413 "exp":1300819380, 1414 "http://example.com/is_root":true} 1416 The following octet sequence, which is the UTF-8 representation used 1417 in this example for the JSON object above, is the JWS Payload: 1419 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 1420 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 1421 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 1422 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 1423 111, 116, 34, 58, 116, 114, 117, 101, 125] 1425 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1426 Header)) gives this value (with line breaks for display purposes 1427 only): 1429 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1430 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1432 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1433 BASE64URL(JWS Payload) gives this string (with line breaks for 1434 display purposes only): 1436 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1437 . 1438 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1439 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1441 The resulting JWS Signing Input value, which is the ASCII 1442 representation of above string, is the following octet sequence 1443 (using JSON array notation): 1445 [101, 121, 74, 48, 101, 88, 65, 105, 79, 105, 74, 75, 86, 49, 81, 1446 105, 76, 65, 48, 75, 73, 67, 74, 104, 98, 71, 99, 105, 79, 105, 74, 1447 73, 85, 122, 73, 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 1448 77, 105, 79, 105, 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 1449 74, 108, 101, 72, 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 1450 107, 122, 79, 68, 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 1451 72, 65, 54, 76, 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 1452 109, 78, 118, 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 1453 106, 112, 48, 99, 110, 86, 108, 102, 81] 1455 HMACs are generated using keys. This example uses the symmetric key 1456 represented in JSON Web Key [JWK] format below (with line breaks 1457 within values for display purposes only): 1459 {"kty":"oct", 1460 "k":"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75 1461 aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" 1462 } 1464 Running the HMAC SHA-256 algorithm on the JWS Signing Input with this 1465 key yields this JWS Signature octet sequence: 1467 [116, 24, 223, 180, 151, 153, 224, 37, 79, 250, 96, 125, 216, 173, 1468 187, 186, 22, 212, 37, 77, 105, 214, 191, 240, 91, 88, 5, 88, 83, 1469 132, 141, 121] 1471 Encoding this JWS Signature as BASE64URL(JWS Signature) gives this 1472 value: 1474 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1476 Concatenating these values in the order Header.Payload.Signature with 1477 period ('.') characters between the parts yields this complete JWS 1478 representation using the JWS Compact Serialization (with line breaks 1479 for display purposes only): 1481 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1482 . 1483 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1484 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1485 . 1486 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1488 A.1.2. Validating 1490 Since the "alg" Header Parameter is "HS256", we validate the HMAC 1491 SHA-256 value contained in the JWS Signature. 1493 To validate the HMAC value, we repeat the previous process of using 1494 the correct key and the JWS Signing Input (which is the initial 1495 substring of the JWS Compact Serialization representation up until 1496 but not including the second period character) as input to the HMAC 1497 SHA-256 function and then taking the output and determining if it 1498 matches the JWS Signature (which is base64url decoded from the value 1499 encoded in the JWS representation). If it matches exactly, the HMAC 1500 has been validated. 1502 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 1504 A.2.1. Encoding 1506 The JWS Protected Header in this example is different from the 1507 previous example in two ways: First, because a different algorithm is 1508 being used, the "alg" value is different. Second, for illustration 1509 purposes only, the optional "typ" parameter is not used. (This 1510 difference is not related to the algorithm employed.) The JWS 1511 Protected Header used is: 1513 {"alg":"RS256"} 1515 The octets representing UTF8(JWS Protected Header) in this example 1516 (using JSON array notation) are: 1518 [123, 34, 97, 108, 103, 34, 58, 34, 82, 83, 50, 53, 54, 34, 125] 1520 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1521 Header)) gives this value: 1523 eyJhbGciOiJSUzI1NiJ9 1525 The JWS Payload used in this example, which follows, is the same as 1526 in the previous example. Since the BASE64URL(JWS Payload) value will 1527 therefore be the same, its computation is not repeated here. 1529 {"iss":"joe", 1530 "exp":1300819380, 1531 "http://example.com/is_root":true} 1533 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1534 BASE64URL(JWS Payload) gives this string (with line breaks for 1535 display purposes only): 1537 eyJhbGciOiJSUzI1NiJ9 1538 . 1539 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1540 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1542 The resulting JWS Signing Input value, which is the ASCII 1543 representation of above string, is the following octet sequence: 1545 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 122, 73, 1546 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1547 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1548 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1549 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1550 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1551 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1552 99, 110, 86, 108, 102, 81] 1554 This example uses the RSA key represented in JSON Web Key [JWK] 1555 format below (with line breaks within values for display purposes 1556 only): 1558 {"kty":"RSA", 1559 "n":"ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddx 1560 HmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMs 1561 D1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSH 1562 SXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdV 1563 MTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8 1564 NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ", 1565 "e":"AQAB", 1566 "d":"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97I 1567 jlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0 1568 BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn 1569 439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYT 1570 CBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLh 1571 BOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ" 1572 } 1574 The RSA private key is then passed to the RSA signing function, which 1575 also takes the hash type, SHA-256, and the JWS Signing Input as 1576 inputs. The result of the digital signature is an octet sequence, 1577 which represents a big endian integer. In this example, it is: 1579 [112, 46, 33, 137, 67, 232, 143, 209, 30, 181, 216, 45, 191, 120, 69, 1580 243, 65, 6, 174, 27, 129, 255, 247, 115, 17, 22, 173, 209, 113, 125, 1581 131, 101, 109, 66, 10, 253, 60, 150, 238, 221, 115, 162, 102, 62, 81, 1582 102, 104, 123, 0, 11, 135, 34, 110, 1, 135, 237, 16, 115, 249, 69, 1583 229, 130, 173, 252, 239, 22, 216, 90, 121, 142, 232, 198, 109, 219, 1584 61, 184, 151, 91, 23, 208, 148, 2, 190, 237, 213, 217, 217, 112, 7, 1585 16, 141, 178, 129, 96, 213, 248, 4, 12, 167, 68, 87, 98, 184, 31, 1586 190, 127, 249, 217, 46, 10, 231, 111, 36, 242, 91, 51, 187, 230, 244, 1587 74, 230, 30, 177, 4, 10, 203, 32, 4, 77, 62, 249, 18, 142, 212, 1, 1588 48, 121, 91, 212, 189, 59, 65, 238, 202, 208, 102, 171, 101, 25, 129, 1589 253, 228, 141, 247, 127, 55, 45, 195, 139, 159, 175, 221, 59, 239, 1590 177, 139, 93, 163, 204, 60, 46, 176, 47, 158, 58, 65, 214, 18, 202, 1591 173, 21, 145, 18, 115, 160, 95, 35, 185, 232, 56, 250, 175, 132, 157, 1592 105, 132, 41, 239, 90, 30, 136, 121, 130, 54, 195, 212, 14, 96, 69, 1593 34, 165, 68, 200, 242, 122, 122, 45, 184, 6, 99, 209, 108, 247, 202, 1594 234, 86, 222, 64, 92, 178, 33, 90, 69, 178, 194, 85, 102, 181, 90, 1595 193, 167, 72, 160, 112, 223, 200, 163, 42, 70, 149, 67, 208, 25, 238, 1596 251, 71] 1598 Encoding the signature as BASE64URL(JWS Signature) produces this 1599 value (with line breaks for display purposes only): 1601 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1602 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1603 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1604 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1605 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1606 p0igcN_IoypGlUPQGe77Rw 1608 Concatenating these values in the order Header.Payload.Signature with 1609 period ('.') characters between the parts yields this complete JWS 1610 representation using the JWS Compact Serialization (with line breaks 1611 for display purposes only): 1613 eyJhbGciOiJSUzI1NiJ9 1614 . 1615 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1616 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1617 . 1618 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1619 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1620 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1621 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1622 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1623 p0igcN_IoypGlUPQGe77Rw 1625 A.2.2. Validating 1627 Since the "alg" Header Parameter is "RS256", we validate the RSASSA- 1628 PKCS-v1_5 SHA-256 digital signature contained in the JWS Signature. 1630 Validating the JWS Signature is a bit different from the previous 1631 example. We pass the public key (n, e), the JWS Signature (which is 1632 base64url decoded from the value encoded in the JWS representation), 1633 and the JWS Signing Input (which is the initial substring of the JWS 1634 Compact Serialization representation up until but not including the 1635 second period character) to an RSASSA-PKCS-v1_5 signature verifier 1636 that has been configured to use the SHA-256 hash function. 1638 A.3. Example JWS using ECDSA P-256 SHA-256 1640 A.3.1. Encoding 1642 The JWS Protected Header for this example differs from the previous 1643 example because a different algorithm is being used. The JWS 1644 Protected Header used is: 1646 {"alg":"ES256"} 1648 The octets representing UTF8(JWS Protected Header) in this example 1649 (using JSON array notation) are: 1651 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 50, 53, 54, 34, 125] 1653 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1654 Header)) gives this value: 1656 eyJhbGciOiJFUzI1NiJ9 1658 The JWS Payload used in this example, which follows, is the same as 1659 in the previous examples. Since the BASE64URL(JWS Payload) value 1660 will therefore be the same, its computation is not repeated here. 1662 {"iss":"joe", 1663 "exp":1300819380, 1664 "http://example.com/is_root":true} 1666 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1667 BASE64URL(JWS Payload) gives this string (with line breaks for 1668 display purposes only): 1670 eyJhbGciOiJFUzI1NiJ9 1671 . 1672 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1673 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1675 The resulting JWS Signing Input value, which is the ASCII 1676 representation of above string, is the following octet sequence: 1678 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 73, 1679 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1680 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1681 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1682 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1683 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1684 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1685 99, 110, 86, 108, 102, 81] 1687 This example uses the elliptic curve key represented in JSON Web Key 1688 [JWK] format below: 1690 {"kty":"EC", 1691 "crv":"P-256", 1692 "x":"f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", 1693 "y":"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0", 1694 "d":"jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI" 1695 } 1697 The ECDSA private part d is then passed to an ECDSA signing function, 1698 which also takes the curve type, P-256, the hash type, SHA-256, and 1699 the JWS Signing Input as inputs. The result of the digital signature 1700 is the EC point (R, S), where R and S are unsigned integers. In this 1701 example, the R and S values, given as octet sequences representing 1702 big endian integers are: 1704 +--------+----------------------------------------------------------+ 1705 | Result | Value | 1706 | Name | | 1707 +--------+----------------------------------------------------------+ 1708 | R | [14, 209, 33, 83, 121, 99, 108, 72, 60, 47, 127, 21, 88, | 1709 | | 7, 212, 2, 163, 178, 40, 3, 58, 249, 124, 126, 23, 129, | 1710 | | 154, 195, 22, 158, 166, 101] | 1711 | S | [197, 10, 7, 211, 140, 60, 112, 229, 216, 241, 45, 175, | 1712 | | 8, 74, 84, 128, 166, 101, 144, 197, 242, 147, 80, 154, | 1713 | | 143, 63, 127, 138, 131, 163, 84, 213] | 1714 +--------+----------------------------------------------------------+ 1716 The JWS Signature is the value R || S. Encoding the signature as 1717 BASE64URL(JWS Signature) produces this value (with line breaks for 1718 display purposes only): 1720 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1721 pmWQxfKTUJqPP3-Kg6NU1Q 1723 Concatenating these values in the order Header.Payload.Signature with 1724 period ('.') characters between the parts yields this complete JWS 1725 representation using the JWS Compact Serialization (with line breaks 1726 for display purposes only): 1728 eyJhbGciOiJFUzI1NiJ9 1729 . 1730 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1731 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1732 . 1733 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1734 pmWQxfKTUJqPP3-Kg6NU1Q 1736 A.3.2. Validating 1738 Since the "alg" Header Parameter is "ES256", we validate the ECDSA 1739 P-256 SHA-256 digital signature contained in the JWS Signature. 1741 Validating the JWS Signature is a bit different from the previous 1742 examples. We need to split the 64 member octet sequence of the JWS 1743 Signature (which is base64url decoded from the value encoded in the 1744 JWS representation) into two 32 octet sequences, the first 1745 representing R and the second S. We then pass the public key (x, y), 1746 the signature (R, S), and the JWS Signing Input (which is the initial 1747 substring of the JWS Compact Serialization representation up until 1748 but not including the second period character) to an ECDSA signature 1749 verifier that has been configured to use the P-256 curve with the 1750 SHA-256 hash function. 1752 A.4. Example JWS using ECDSA P-521 SHA-512 1754 A.4.1. Encoding 1756 The JWS Protected Header for this example differs from the previous 1757 example because different ECDSA curves and hash functions are used. 1758 The JWS Protected Header used is: 1760 {"alg":"ES512"} 1762 The octets representing UTF8(JWS Protected Header) in this example 1763 (using JSON array notation) are: 1765 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 53, 49, 50, 34, 125] 1767 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1768 Header)) gives this value: 1770 eyJhbGciOiJFUzUxMiJ9 1772 The JWS Payload used in this example, is the ASCII string "Payload". 1773 The representation of this string is the octet sequence: 1775 [80, 97, 121, 108, 111, 97, 100] 1777 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value: 1779 UGF5bG9hZA 1781 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1782 BASE64URL(JWS Payload) gives this string: 1784 eyJhbGciOiJFUzUxMiJ9.UGF5bG9hZA 1786 The resulting JWS Signing Input value, which is the ASCII 1787 representation of above string, is the following octet sequence: 1789 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 85, 1790 120, 77, 105, 74, 57, 46, 85, 71, 70, 53, 98, 71, 57, 104, 90, 65] 1792 This example uses the elliptic curve key represented in JSON Web Key 1793 [JWK] format below (with line breaks within values for display 1794 purposes only): 1796 {"kty":"EC", 1797 "crv":"P-521", 1798 "x":"AekpBQ8ST8a8VcfVOTNl353vSrDCLLJXmPk06wTjxrrjcBpXp5EOnYG_ 1799 NjFZ6OvLFV1jSfS9tsz4qUxcWceqwQGk", 1800 "y":"ADSmRA43Z1DSNx_RvcLI87cdL07l6jQyyBXMoxVg_l2Th-x3S1WDhjDl 1801 y79ajL4Kkd0AZMaZmh9ubmf63e3kyMj2", 1802 "d":"AY5pb7A0UFiB3RELSD64fTLOSV_jazdF7fLYyuTw8lOfRhWg6Y6rUrPA 1803 xerEzgdRhajnu0ferB0d53vM9mE15j2C" 1804 } 1806 The ECDSA private part d is then passed to an ECDSA signing function, 1807 which also takes the curve type, P-521, the hash type, SHA-512, and 1808 the JWS Signing Input as inputs. The result of the digital signature 1809 is the EC point (R, S), where R and S are unsigned integers. In this 1810 example, the R and S values, given as octet sequences representing 1811 big endian integers are: 1813 +--------+----------------------------------------------------------+ 1814 | Result | Value | 1815 | Name | | 1816 +--------+----------------------------------------------------------+ 1817 | R | [1, 220, 12, 129, 231, 171, 194, 209, 232, 135, 233, | 1818 | | 117, 247, 105, 122, 210, 26, 125, 192, 1, 217, 21, 82, | 1819 | | 91, 45, 240, 255, 83, 19, 34, 239, 71, 48, 157, 147, | 1820 | | 152, 105, 18, 53, 108, 163, 214, 68, 231, 62, 153, 150, | 1821 | | 106, 194, 164, 246, 72, 143, 138, 24, 50, 129, 223, 133, | 1822 | | 206, 209, 172, 63, 237, 119, 109] | 1823 | S | [0, 111, 6, 105, 44, 5, 41, 208, 128, 61, 152, 40, 92, | 1824 | | 61, 152, 4, 150, 66, 60, 69, 247, 196, 170, 81, 193, | 1825 | | 199, 78, 59, 194, 169, 16, 124, 9, 143, 42, 142, 131, | 1826 | | 48, 206, 238, 34, 175, 83, 203, 220, 159, 3, 107, 155, | 1827 | | 22, 27, 73, 111, 68, 68, 21, 238, 144, 229, 232, 148, | 1828 | | 188, 222, 59, 242, 103] | 1829 +--------+----------------------------------------------------------+ 1831 The JWS Signature is the value R || S. Encoding the signature as 1832 BASE64URL(JWS Signature) produces this value (with line breaks for 1833 display purposes only): 1835 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1836 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1837 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1839 Concatenating these values in the order Header.Payload.Signature with 1840 period ('.') characters between the parts yields this complete JWS 1841 representation using the JWS Compact Serialization (with line breaks 1842 for display purposes only): 1844 eyJhbGciOiJFUzUxMiJ9 1845 . 1846 UGF5bG9hZA 1847 . 1848 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1849 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1850 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1852 A.4.2. Validating 1854 Since the "alg" Header Parameter is "ES512", we validate the ECDSA 1855 P-521 SHA-512 digital signature contained in the JWS Signature. 1857 Validating this JWS Signature is very similar to the previous 1858 example. We need to split the 132 member octet sequence of the JWS 1859 Signature into two 66 octet sequences, the first representing R and 1860 the second S. We then pass the public key (x, y), the signature (R, 1861 S), and the JWS Signing Input to an ECDSA signature verifier that has 1862 been configured to use the P-521 curve with the SHA-512 hash 1863 function. 1865 A.5. Example Plaintext JWS 1867 The following example JWS Protected Header declares that the encoded 1868 object is a Plaintext JWS: 1870 {"alg":"none"} 1872 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1873 Header)) gives this value: 1875 eyJhbGciOiJub25lIn0 1877 The JWS Payload used in this example, which follows, is the same as 1878 in the previous examples. Since the BASE64URL(JWS Payload) value 1879 will therefore be the same, its computation is not repeated here. 1881 {"iss":"joe", 1882 "exp":1300819380, 1883 "http://example.com/is_root":true} 1885 The JWS Signature is the empty octet string and BASE64URL(JWS 1886 Signature) is the empty string. 1888 Concatenating these parts in the order Header.Payload.Signature with 1889 period ('.') characters between the parts yields this complete JWS 1890 (with line breaks for display purposes only): 1892 eyJhbGciOiJub25lIn0 1893 . 1894 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1895 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1896 . 1898 A.6. Example JWS Using JWS JSON Serialization 1900 This section contains an example using the JWS JSON Serialization. 1901 This example demonstrates the capability for conveying multiple 1902 digital signatures and/or MACs for the same payload. 1904 The JWS Payload used in this example is the same as that used in the 1905 examples in Appendix A.2 and Appendix A.3 (with line breaks for 1906 display purposes only): 1908 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1909 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1911 Two digital signatures are used in this example: the first using 1912 RSASSA-PKCS-v1_5 SHA-256 and the second using ECDSA P-256 SHA-256. 1913 For the first, the JWS Protected Header and key are the same as in 1914 Appendix A.2, resulting in the same JWS Signature value; therefore, 1915 its computation is not repeated here. For the second, the JWS 1916 Protected Header and key are the same as in Appendix A.3, resulting 1917 in the same JWS Signature value; therefore, its computation is not 1918 repeated here. 1920 A.6.1. JWS Per-Signature Protected Headers 1922 The JWS Protected Header value used for the first signature is: 1924 {"alg":"RS256"} 1926 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1927 Header)) gives this value: 1929 eyJhbGciOiJSUzI1NiJ9 1931 The JWS Protected Header value used for the second signature is: 1933 {"alg":"ES256"} 1935 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1936 Header)) gives this value: 1938 eyJhbGciOiJFUzI1NiJ9 1940 A.6.2. JWS Per-Signature Unprotected Headers 1942 Key ID values are supplied for both keys using per-signature Header 1943 Parameters. The two values used to represent these Key IDs are: 1945 {"kid":"2010-12-29"} 1947 and 1949 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 1951 A.6.3. Complete JOSE Header Values 1953 Combining the protected and unprotected header values supplied, the 1954 JOSE Header values used for the first and second signatures 1955 respectively are: 1957 {"alg":"RS256", 1958 "kid":"2010-12-29"} 1960 and 1962 {"alg":"ES256", 1963 "kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 1965 A.6.4. Complete JWS JSON Serialization Representation 1967 The complete JSON Web Signature JSON Serialization for these values 1968 is as follows (with line breaks within values for display purposes 1969 only): 1971 {"payload": 1972 "eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGF 1973 tcGxlLmNvbS9pc19yb290Ijp0cnVlfQ", 1974 "signatures":[ 1975 {"protected":"eyJhbGciOiJSUzI1NiJ9", 1976 "header": 1977 {"kid":"2010-12-29"}, 1978 "signature": 1979 "cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZ 1980 mh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjb 1981 KBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHl 1982 b1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZES 1983 c6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AX 1984 LIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw"}, 1985 {"protected":"eyJhbGciOiJFUzI1NiJ9", 1986 "header": 1987 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"}, 1988 "signature": 1989 "DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8IS 1990 lSApmWQxfKTUJqPP3-Kg6NU1Q"}] 1991 } 1993 Appendix B. "x5c" (X.509 Certificate Chain) Example 1995 The JSON array below is an example of a certificate chain that could 1996 be used as the value of an "x5c" (X.509 Certificate Chain) Header 1997 Parameter, per Section 4.1.6. Note that since these strings contain 1998 base64 encoded (not base64url encoded) values, they are allowed to 1999 contain white space and line breaks. 2001 ["MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVM 2002 xITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR2 2003 8gRGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExM 2004 TYwMTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UE 2005 CBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWR 2006 keS5jb20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYW 2007 RkeS5jb20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlc 2008 nRpZmljYXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJ 2009 KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTt 2010 wY6vj3D3HKrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqV 2011 Tr9vcyOdQmVZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aL 2012 GbqGmu75RpRSgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo 2013 7RJlbmr2EkRTcDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgW 2014 JCJjPOq8lh8BJ6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAw 2015 EAAaOCATIwggEuMB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVH 2016 SMEGDAWgBTSxLDSkdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEA 2017 MDMGCCsGAQUFBwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWR 2018 keS5jb20wRgYDVR0fBD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2 2019 RhZGR5LmNvbS9yZXBvc2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVH 2020 SAAMDgwNgYIKwYBBQUHAgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j 2021 b20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggE 2022 BANKGwOy9+aG2Z+5mC6IGOgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPI 2023 UyIXvJxwqoJKSQ3kbTJSMUA2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL 2024 5CkKSkB2XIsKd83ASe8T+5o0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9 2025 p0iRFEUOOjZv2kWzRaJBydTXRE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsx 2026 uxN89txJx9OjxUUAiKEngHUuHqDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZ 2027 EjYx8WnM25sgVjOuH0aBsXBTWVU+4=", 2028 "MIIE+zCCBGSgAwIBAgICAQ0wDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1Z 2029 hbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIE 2030 luYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb 2031 24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8x 2032 IDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTA0MDYyOTE3MDY 2033 yMFoXDTI0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRoZS 2034 BHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgM 2035 iBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN 2036 ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XC 2037 APVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux 2038 6wwdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLO 2039 tXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWo 2040 riMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZ 2041 Eewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjggHhMIIB3TAdBgNVHQ 2042 4EFgQU0sSw0pHUTBFxs2HLPaH+3ahq1OMwgdIGA1UdIwSByjCBx6GBwaSBvjCBu 2043 zEkMCIGA1UEBxMbVmFsaUNlcnQgVmFsaWRhdGlvbiBOZXR3b3JrMRcwFQYDVQQK 2044 Ew5WYWxpQ2VydCwgSW5jLjE1MDMGA1UECxMsVmFsaUNlcnQgQ2xhc3MgMiBQb2x 2045 pY3kgVmFsaWRhdGlvbiBBdXRob3JpdHkxITAfBgNVBAMTGGh0dHA6Ly93d3cudm 2046 FsaWNlcnQuY29tLzEgMB4GCSqGSIb3DQEJARYRaW5mb0B2YWxpY2VydC5jb22CA 2047 QEwDwYDVR0TAQH/BAUwAwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGG 2048 F2h0dHA6Ly9vY3NwLmdvZGFkZHkuY29tMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA 2049 6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS9yb290LmNybD 2050 BLBgNVHSAERDBCMEAGBFUdIAAwODA2BggrBgEFBQcCARYqaHR0cDovL2NlcnRpZ 2051 mljYXRlcy5nb2RhZGR5LmNvbS9yZXBvc2l0b3J5MA4GA1UdDwEB/wQEAwIBBjAN 2052 BgkqhkiG9w0BAQUFAAOBgQC1QPmnHfbq/qQaQlpE9xXUhUaJwL6e4+PrxeNYiY+ 2053 Sn1eocSxI0YGyeR+sBjUZsE4OWBsUs5iB0QQeyAfJg594RAoYC5jcdnplDQ1tgM 2054 QLARzLrUc+cb53S8wGd9D0VmsfSxOaFIqII6hR8INMqzW/Rn453HWkrugp++85j 2055 09VZw==", 2056 "MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ 2057 0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNT 2058 AzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0a 2059 G9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkq 2060 hkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE 2061 5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTm 2062 V0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZ 2063 XJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQD 2064 ExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9 2065 AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5a 2066 vIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zf 2067 N1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwb 2068 P7RfZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQU 2069 AA4GBADt/UG9vUJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQ 2070 C1u+mNr0HZDzTuIYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMM 2071 j4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd"] 2073 Appendix C. Notes on implementing base64url encoding without padding 2075 This appendix describes how to implement base64url encoding and 2076 decoding functions without padding based upon standard base64 2077 encoding and decoding functions that do use padding. 2079 To be concrete, example C# code implementing these functions is shown 2080 below. Similar code could be used in other languages. 2082 static string base64urlencode(byte [] arg) 2083 { 2084 string s = Convert.ToBase64String(arg); // Regular base64 encoder 2085 s = s.Split('=')[0]; // Remove any trailing '='s 2086 s = s.Replace('+', '-'); // 62nd char of encoding 2087 s = s.Replace('/', '_'); // 63rd char of encoding 2088 return s; 2089 } 2091 static byte [] base64urldecode(string arg) 2092 { 2093 string s = arg; 2094 s = s.Replace('-', '+'); // 62nd char of encoding 2095 s = s.Replace('_', '/'); // 63rd char of encoding 2096 switch (s.Length % 4) // Pad with trailing '='s 2097 { 2098 case 0: break; // No pad chars in this case 2099 case 2: s += "=="; break; // Two pad chars 2100 case 3: s += "="; break; // One pad char 2101 default: throw new System.Exception( 2102 "Illegal base64url string!"); 2103 } 2104 return Convert.FromBase64String(s); // Standard base64 decoder 2105 } 2107 As per the example code above, the number of '=' padding characters 2108 that needs to be added to the end of a base64url encoded string 2109 without padding to turn it into one with padding is a deterministic 2110 function of the length of the encoded string. Specifically, if the 2111 length mod 4 is 0, no padding is added; if the length mod 4 is 2, two 2112 '=' padding characters are added; if the length mod 4 is 3, one '=' 2113 padding character is added; if the length mod 4 is 1, the input is 2114 malformed. 2116 An example correspondence between unencoded and encoded values 2117 follows. The octet sequence below encodes into the string below, 2118 which when decoded, reproduces the octet sequence. 2119 3 236 255 224 193 2120 A-z_4ME 2122 Appendix D. Notes on Key Selection 2124 This appendix describes a set of possible algorithms for selecting 2125 the key to be used to validate the digital signature or MAC of a JWS 2126 object or for selecting the key to be used to decrypt a JWE object. 2127 This guidance describes a family of possible algorithms, rather than 2128 a single algorithm, because in different contexts, not all the 2129 sources of keys will be used, they can be tried in different orders, 2130 and sometimes not all the collected keys will be tried; hence, 2131 different algorithms will be used in different application contexts. 2133 The steps below are described for illustration purposes only; 2134 specific applications can and are likely to use different algorithms 2135 or perform some of the steps in different orders. Specific 2136 applications will frequently have a much simpler method of 2137 determining the keys to use, as there may be one or two key selection 2138 methods that are profiled for the application's use. This appendix 2139 supplements the normative information on key location in Section 6. 2141 These algorithms include the following steps. Note that the steps 2142 can be performed in any order and do not need to be treated as 2143 distinct. For example, keys can be tried as soon as they are found, 2144 rather than collecting all the keys before trying any. 2146 1. Collect the set of potentially applicable keys. Sources of keys 2147 may include: 2149 * Keys supplied by the application protocol being used. 2151 * Keys referenced by the "jku" (JWK Set URL) Header Parameter. 2153 * The key provided by the "jwk" (JSON Web Key) Header Parameter. 2155 * The key referenced by the "x5u" (X.509 URL) Header Parameter. 2157 * The key provided by the "x5c" (X.509 Certificate Chain) Header 2158 Parameter. 2160 * Other applicable keys available to the application. 2162 The order for collecting and trying keys from different key 2163 sources is typically application dependent. For example, 2164 frequently all keys from a one set of locations, such as local 2165 caches, will be tried before collecting and trying keys from 2166 other locations. 2168 2. Filter the set of collected keys. For instance, some 2169 applications will use only keys referenced by "kid" (key ID) or 2170 "x5t" (X.509 certificate SHA-1 thumbprint) parameters. If the 2171 application uses the "alg" (algorithm), "use" (public key use), 2172 or "key_ops" (key operations) parameters, keys with keys with 2173 inappropriate values of those parameters would be excluded. 2174 Additionally, keys might be filtered to include or exclude keys 2175 with certain other member values in an application specific 2176 manner. For some applications, no filtering will be applied. 2178 3. Order the set of collected keys. For instance, keys referenced 2179 by "kid" (Key ID) or "x5t" (X.509 Certificate SHA-1 Thumbprint) 2180 parameters might be tried before keys with neither of these 2181 values. Likewise, keys with certain member values might be 2182 ordered before keys with other member values. For some 2183 applications, no ordering will be applied. 2185 4. Make trust decisions about the keys. Signatures made with keys 2186 not meeting the application's trust criteria would not be 2187 accepted. Such criteria might include, but is not limited to the 2188 source of the key, whether the TLS certificate validates for keys 2189 retrieved from URLs, whether a key in an X.509 certificate is 2190 backed by a valid certificate chain, and other information known 2191 by the application. 2193 5. Attempt signature or MAC validation for a JWS object or 2194 decryption of a JWE object with some or all of the collected and 2195 possibly filtered and/or ordered keys. A limit on the number of 2196 keys to be tried might be applied. This process will normally 2197 terminate following a successful validation or decryption. 2199 Note that it is reasonable for some applications to perform signature 2200 or MAC validation prior to making a trust decision about a key, since 2201 keys for which the validation fails need no trust decision. 2203 Appendix E. Negative Test Case for "crit" Header Parameter 2205 Conforming implementations must reject input containing critical 2206 extensions that are not understood or cannot be processed. The 2207 following JWS must be rejected by all implementations, because it 2208 uses an extension Header Parameter name 2209 "http://example.invalid/UNDEFINED" that they do not understand. Any 2210 other similar input, in which the use of the value 2211 "http://example.invalid/UNDEFINED" is substituted for any other 2212 Header Parameter name not understood by the implementation, must also 2213 be rejected. 2215 The JWS Protected Header value for this JWS is: 2217 {"alg":"none", 2218 "crit":["http://example.invalid/UNDEFINED"], 2219 "http://example.invalid/UNDEFINED":true 2220 } 2222 The complete JWS that must be rejected is as follows (with line 2223 breaks for display purposes only): 2225 eyJhbGciOiJub25lIiwNCiAiY3JpdCI6WyJodHRwOi8vZXhhbXBsZS5jb20vVU5ERU 2226 ZJTkVEIl0sDQogImh0dHA6Ly9leGFtcGxlLmNvbS9VTkRFRklORUQiOnRydWUNCn0. 2227 RkFJTA. 2229 Appendix F. Detached Content 2231 In some contexts, it is useful integrity protect content that is not 2232 itself contained in a JWS object. One way to do this is create a JWS 2233 object in the normal fashion using a representation of the content as 2234 the payload, but then delete the payload representation from the JWS, 2235 and send this modified object to the recipient, rather than the JWS. 2236 When using the JWS Compact Serialization, the deletion is 2237 accomplished by replacing the second field (which contains 2238 BASE64URL(JWS Payload)) value with the empty string; when using the 2239 JWS JSON Serialization, the deletion is accomplished by deleting the 2240 "payload" member. This method assumes that the recipient can 2241 reconstruct the exact payload used in the JWS. To use the modified 2242 object, the recipient reconstructs the JWS by re-inserting the 2243 payload representation into the modified object, and uses the 2244 resulting JWS in the usual manner. Note that this method needs no 2245 support from JWS libraries, as applications can use this method by 2246 modifying the inputs and outputs of standard JWS libraries. 2248 Appendix G. Acknowledgements 2250 Solutions for signing JSON content were previously explored by Magic 2251 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 2252 Applications [CanvasApp], all of which influenced this draft. 2254 Thanks to Axel Nennker for his early implementation and feedback on 2255 the JWS and JWE specifications. 2257 This specification is the work of the JOSE Working Group, which 2258 includes dozens of active and dedicated participants. In particular, 2259 the following individuals contributed ideas, feedback, and wording 2260 that influenced this specification: 2262 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 2263 Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben 2264 Laurie, James Manger, Matt Miller, Kathleen Moriarty, Tony Nadalin, 2265 Hideki Nara, Axel Nennker, John Panzer, Emmanuel Raviart, Eric 2266 Rescorla, Jim Schaad, Paul Tarjan, Hannes Tschofenig, and Sean 2267 Turner. 2269 Jim Schaad and Karen O'Donoghue chaired the JOSE working group and 2270 Sean Turner, Stephen Farrell, and Kathleen Moriarty served as 2271 Security area directors during the creation of this specification. 2273 Appendix H. Document History 2275 [[ to be removed by the RFC Editor before publication as an RFC ]] 2277 -30 2279 o Added subsection headings within the Overview section for the two 2280 serializations. 2282 o Added references and cleaned up the reference syntax in a few 2283 places. 2285 o Applied minor wording changes to the Security Considerations 2286 section and made other local editorial improvements. 2288 -29 2290 o Replaced the terms JWS Header, JWE Header, and JWT Header with a 2291 single JOSE Header term defined in the JWS specification. This 2292 also enabled a single Header Parameter definition to be used and 2293 reduced other areas of duplication between specifications. 2295 -28 2297 o Revised the introduction to the Security Considerations section. 2298 Also introduced additional subsection headings for security 2299 considerations items and also moved a security consideration item 2300 here from the JWA draft. 2302 o Added text about when applications typically would and would not 2303 use "typ" and "cty" header parameters. 2305 -27 2307 o Added the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) header 2308 parameter. 2310 o Stated that any JSON inputs not conforming to the JSON-text syntax 2311 defined in RFC 7159 input MUST be rejected in their entirety. 2313 o Simplified the TLS requirements. 2315 -26 2317 o Referenced Section 6 of RFC 6125 for TLS server certificate 2318 identity validation. 2320 o Described potential sources of ambiguity in representing the JSON 2321 objects used in the examples. The octets of the actual UTF-8 2322 representations of the JSON objects used in the examples are 2323 included to remove these ambiguities. 2325 o Added a small amount of additional explanatory text to the 2326 signature validation examples to aid implementers. 2328 o Noted that octet sequences are depicted using JSON array notation. 2330 o Updated references, including to W3C specifications. 2332 -25 2334 o No changes were made, other than to the version number and date. 2336 -24 2338 o Updated the JSON reference to RFC 7159. 2340 -23 2342 o Clarified that the base64url encoding includes no line breaks, 2343 white space, or other additional characters. 2345 -22 2347 o Corrected RFC 2119 terminology usage. 2349 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 2351 -21 2353 o Applied review comments to the appendix "Notes on Key Selection", 2354 addressing issue #93. 2356 o Changed some references from being normative to informative, 2357 addressing issue #90. 2359 o Applied review comments to the JSON Serialization section, 2360 addressing issue #121. 2362 -20 2364 o Made terminology definitions more consistent, addressing issue 2365 #165. 2367 o Restructured the JSON Serialization section to call out the 2368 parameters used in hanging lists, addressing issue #121. 2370 o Described key filtering and refined other aspects of the text in 2371 the appendix "Notes on Key Selection", addressing issue #93. 2373 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis, 2374 addressing issue #90. 2376 -19 2378 o Added the appendix "Notes on Validation Key Selection", addressing 2379 issue #93. 2381 o Reordered the key selection parameters. 2383 -18 2385 o Updated the mandatory-to-implement (MTI) language to say that 2386 applications using this specification need to specify what 2387 serialization and serialization features are used for that 2388 application, addressing issue #119. 2390 o Changes to address editorial and minor issues #25, #89, #97, #110, 2391 #114, #115, #116, #117, #120, and #184. 2393 o Added and used Header Parameter Description registry field. 2395 -17 2396 o Refined the "typ" and "cty" definitions to always be MIME Media 2397 Types, with the omission of "application/" prefixes recommended 2398 for brevity, addressing issue #50. 2400 o Updated the mandatory-to-implement (MTI) language to say that 2401 general-purpose implementations must implement the single 2402 signature/MAC value case for both serializations whereas special- 2403 purpose implementations can implement just one serialization if 2404 that meets the needs of the use cases the implementation is 2405 designed for, addressing issue #119. 2407 o Explicitly named all the logical components of a JWS and defined 2408 the processing rules and serializations in terms of those 2409 components, addressing issues #60, #61, and #62. 2411 o Replaced verbose repetitive phases such as "base64url encode the 2412 octets of the UTF-8 representation of X" with mathematical 2413 notation such as "BASE64URL(UTF8(X))". 2415 o Terms used in multiple documents are now defined in one place and 2416 incorporated by reference. Some lightly used or obvious terms 2417 were also removed. This addresses issue #58. 2419 -16 2421 o Changes to address editorial and minor issues #50, #98, #99, #102, 2422 #104, #106, #107, #111, and #112. 2424 -15 2426 o Clarified that it is an application decision which signatures, 2427 MACs, or plaintext values must successfully validate for the JWS 2428 to be accepted, addressing issue #35. 2430 o Corrected editorial error in "ES512" example. 2432 o Changes to address editorial and minor issues #34, #96, #100, 2433 #101, #104, #105, and #106. 2435 -14 2437 o Stated that the "signature" parameter is to be omitted in the JWS 2438 JSON Serialization when its value would be empty (which is only 2439 the case for a Plaintext JWS). 2441 -13 2442 o Made all header parameter values be per-signature/MAC, addressing 2443 issue #24. 2445 -12 2447 o Clarified that the "typ" and "cty" header parameters are used in 2448 an application-specific manner and have no effect upon the JWS 2449 processing. 2451 o Replaced the MIME types "application/jws+json" and 2452 "application/jws" with "application/jose+json" and 2453 "application/jose". 2455 o Stated that recipients MUST either reject JWSs with duplicate 2456 Header Parameter Names or use a JSON parser that returns only the 2457 lexically last duplicate member name. 2459 o Added a Serializations section with parallel treatment of the JWS 2460 Compact Serialization and the JWS JSON Serialization and also 2461 moved the former Implementation Considerations content there. 2463 -11 2465 o Added Key Identification section. 2467 o For the JWS JSON Serialization, enable header parameter values to 2468 be specified in any of three parameters: the "protected" member 2469 that is integrity protected and shared among all recipients, the 2470 "unprotected" member that is not integrity protected and shared 2471 among all recipients, and the "header" member that is not 2472 integrity protected and specific to a particular recipient. (This 2473 does not affect the JWS Compact Serialization, in which all header 2474 parameter values are in a single integrity protected JWE Header 2475 value.) 2477 o Removed suggested compact serialization for multiple digital 2478 signatures and/or MACs. 2480 o Changed the MIME type name "application/jws-js" to 2481 "application/jws+json", addressing issue #22. 2483 o Tightened the description of the "crit" (critical) header 2484 parameter. 2486 o Added a negative test case for the "crit" header parameter 2488 -10 2489 o Added an appendix suggesting a possible compact serialization for 2490 JWSs with multiple digital signatures and/or MACs. 2492 -09 2494 o Added JWS JSON Serialization, as specified by 2495 draft-jones-jose-jws-json-serialization-04. 2497 o Registered "application/jws-js" MIME type and "JWS-JS" typ header 2498 parameter value. 2500 o Defined that the default action for header parameters that are not 2501 understood is to ignore them unless specifically designated as 2502 "MUST be understood" or included in the new "crit" (critical) 2503 header parameter list. This addressed issue #6. 2505 o Changed term "JWS Secured Input" to "JWS Signing Input". 2507 o Changed from using the term "byte" to "octet" when referring to 8 2508 bit values. 2510 o Changed member name from "recipients" to "signatures" in the JWS 2511 JSON Serialization. 2513 o Added complete values using the JWS Compact Serialization for all 2514 examples. 2516 -08 2518 o Applied editorial improvements suggested by Jeff Hodges and Hannes 2519 Tschofenig. Many of these simplified the terminology used. 2521 o Clarified statements of the form "This header parameter is 2522 OPTIONAL" to "Use of this header parameter is OPTIONAL". 2524 o Added a Header Parameter Usage Location(s) field to the IANA JSON 2525 Web Signature and Encryption Header Parameters registry. 2527 o Added seriesInfo information to Internet Draft references. 2529 -07 2531 o Updated references. 2533 -06 2535 o Changed "x5c" (X.509 Certificate Chain) representation from being 2536 a single string to being an array of strings, each containing a 2537 single base64 encoded DER certificate value, representing elements 2538 of the certificate chain. 2540 o Applied changes made by the RFC Editor to RFC 6749's registry 2541 language to this specification. 2543 -05 2545 o Added statement that "StringOrURI values are compared as case- 2546 sensitive strings with no transformations or canonicalizations 2547 applied". 2549 o Indented artwork elements to better distinguish them from the body 2550 text. 2552 -04 2554 o Completed JSON Security Considerations section, including 2555 considerations about rejecting input with duplicate member names. 2557 o Completed security considerations on the use of a SHA-1 hash when 2558 computing "x5t" (x.509 certificate thumbprint) values. 2560 o Refer to the registries as the primary sources of defined values 2561 and then secondarily reference the sections defining the initial 2562 contents of the registries. 2564 o Normatively reference XML DSIG 2.0 for its security 2565 considerations. 2567 o Added this language to Registration Templates: "This name is case 2568 sensitive. Names that match other registered names in a case 2569 insensitive manner SHOULD NOT be accepted." 2571 o Reference draft-jones-jose-jws-json-serialization instead of 2572 draft-jones-json-web-signature-json-serialization. 2574 o Described additional open issues. 2576 o Applied editorial suggestions. 2578 -03 2580 o Added the "cty" (content type) header parameter for declaring type 2581 information about the secured content, as opposed to the "typ" 2582 (type) header parameter, which declares type information about 2583 this object. 2585 o Added "Collision Resistant Namespace" to the terminology section. 2587 o Reference ITU.X690.1994 for DER encoding. 2589 o Added an example JWS using ECDSA P-521 SHA-512. This has 2590 particular illustrative value because of the use of the 521 bit 2591 integers in the key and signature values. This is also an example 2592 in which the payload is not a base64url encoded JSON object. 2594 o Added an example "x5c" value. 2596 o No longer say "the UTF-8 representation of the JWS Secured Input 2597 (which is the same as the ASCII representation)". Just call it 2598 "the ASCII representation of the JWS Secured Input". 2600 o Added Registration Template sections for defined registries. 2602 o Added Registry Contents sections to populate registry values. 2604 o Changed name of the JSON Web Signature and Encryption "typ" Values 2605 registry to be the JSON Web Signature and Encryption Type Values 2606 registry, since it is used for more than just values of the "typ" 2607 parameter. 2609 o Moved registries JSON Web Signature and Encryption Header 2610 Parameters and JSON Web Signature and Encryption Type Values to 2611 the JWS specification. 2613 o Numerous editorial improvements. 2615 -02 2617 o Clarified that it is an error when a "kid" value is included and 2618 no matching key is found. 2620 o Removed assumption that "kid" (key ID) can only refer to an 2621 asymmetric key. 2623 o Clarified that JWSs with duplicate Header Parameter Names MUST be 2624 rejected. 2626 o Clarified the relationship between "typ" header parameter values 2627 and MIME types. 2629 o Registered application/jws MIME type and "JWS" typ header 2630 parameter value. 2632 o Simplified JWK terminology to get replace the "JWK Key Object" and 2633 "JWK Container Object" terms with simply "JSON Web Key (JWK)" and 2634 "JSON Web Key Set (JWK Set)" and to eliminate potential confusion 2635 between single keys and sets of keys. As part of this change, the 2636 Header Parameter Name for a public key value was changed from 2637 "jpk" (JSON Public Key) to "jwk" (JSON Web Key). 2639 o Added suggestion on defining additional header parameters such as 2640 "x5t#S256" in the future for certificate thumbprints using hash 2641 algorithms other than SHA-1. 2643 o Specify RFC 2818 server identity validation, rather than RFC 6125 2644 (paralleling the same decision in the OAuth specs). 2646 o Generalized language to refer to Message Authentication Codes 2647 (MACs) rather than Hash-based Message Authentication Codes (HMACs) 2648 unless in a context specific to HMAC algorithms. 2650 o Reformatted to give each header parameter its own section heading. 2652 -01 2654 o Moved definition of Plaintext JWSs (using "alg":"none") here from 2655 the JWT specification since this functionality is likely to be 2656 useful in more contexts that just for JWTs. 2658 o Added "jpk" and "x5c" header parameters for including JWK public 2659 keys and X.509 certificate chains directly in the header. 2661 o Clarified that this specification is defining the JWS Compact 2662 Serialization. Referenced the new JWS-JS spec, which defines the 2663 JWS JSON Serialization. 2665 o Added text "New header parameters should be introduced sparingly 2666 since an implementation that does not understand a parameter MUST 2667 reject the JWS". 2669 o Clarified that the order of the creation and validation steps is 2670 not significant in cases where there are no dependencies between 2671 the inputs and outputs of the steps. 2673 o Changed "no canonicalization is performed" to "no canonicalization 2674 need be performed". 2676 o Corrected the Magic Signatures reference. 2678 o Made other editorial improvements suggested by JOSE working group 2679 participants. 2681 -00 2683 o Created the initial IETF draft based upon 2684 draft-jones-json-web-signature-04 with no normative changes. 2686 o Changed terminology to no longer call both digital signatures and 2687 HMACs "signatures". 2689 Authors' Addresses 2691 Michael B. Jones 2692 Microsoft 2694 Email: mbj@microsoft.com 2695 URI: http://self-issued.info/ 2697 John Bradley 2698 Ping Identity 2700 Email: ve7jtb@ve7jtb.com 2701 URI: http://www.thread-safe.com/ 2703 Nat Sakimura 2704 Nomura Research Institute 2706 Email: n-sakimura@nri.co.jp 2707 URI: http://nat.sakimura.org/