idnits 2.17.1 draft-ietf-jose-json-web-signature-33.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 (September 25, 2014) is 3473 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 1891 -- Looks like a reference, but probably isn't: '34' on line 1891 -- Looks like a reference, but probably isn't: '97' on line 1901 -- Looks like a reference, but probably isn't: '108' on line 1901 -- Looks like a reference, but probably isn't: '103' on line 1891 -- Looks like a reference, but probably isn't: '58' on line 1891 -- Looks like a reference, but probably isn't: '82' on line 1645 -- Looks like a reference, but probably isn't: '83' on line 1891 -- Looks like a reference, but probably isn't: '50' on line 1891 -- Looks like a reference, but probably isn't: '53' on line 1891 -- Looks like a reference, but probably isn't: '54' on line 1777 -- Looks like a reference, but probably isn't: '125' on line 1891 -- Looks like a reference, but probably isn't: '69' on line 1891 -- Looks like a reference, but probably isn't: '49' on line 1891 -- Looks like a reference, but probably isn't: '80' on line 1901 -- Looks like a reference, but probably isn't: '121' on line 1901 -- Looks like a reference, but probably isn't: '111' on line 1901 -- Looks like a reference, but probably isn't: '100' on line 1901 -- Looks like a reference, but probably isn't: '0' on line 2211 -- 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' == Outdated reference: A later version (-11) exists of draft-ietf-uta-tls-bcp-03 -- Obsolete informational reference (is this intentional?): RFC 3447 (Obsoleted by RFC 8017) -- Obsolete informational reference (is this intentional?): RFC 5226 (Obsoleted by RFC 8126) Summary: 5 errors (**), 0 flaws (~~), 2 warnings (==), 26 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: March 29, 2015 Ping Identity 6 N. Sakimura 7 NRI 8 September 25, 2014 10 JSON Web Signature (JWS) 11 draft-ietf-jose-json-web-signature-33 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 March 29, 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 . . . . . . . . . . . . 9 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 . . . . . . . . . . . 10 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 . . . . . . . . . . . . . . . . . . . . . . 11 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 . . . . . . . . 12 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 . . . . . . . . . . . . . . . . . 17 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 . . . . . . . . . . . . . . . . . . . . . . . 20 91 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 92 9.1. JSON Web Signature and Encryption Header Parameters 93 Registry . . . . . . . . . . . . . . . . . . . . . . . . 21 94 9.1.1. Registration Template . . . . . . . . . . . . . . . . 22 95 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 22 97 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 24 98 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 24 99 10. Security Considerations . . . . . . . . . . . . . . . . . . . 25 100 10.1. Key Entropy and Random Values . . . . . . . . . . . . . . 25 101 10.2. Key Protection . . . . . . . . . . . . . . . . . . . . . 26 102 10.3. Key Origin Authentication . . . . . . . . . . . . . . . . 26 103 10.4. Cryptographic Agility . . . . . . . . . . . . . . . . . . 26 104 10.5. Differences between Digital Signatures and MACs . . . . . 26 105 10.6. Algorithm Validation . . . . . . . . . . . . . . . . . . 27 106 10.7. Algorithm Protection . . . . . . . . . . . . . . . . . . 27 107 10.8. Chosen Plaintext Attacks . . . . . . . . . . . . . . . . 28 108 10.9. Timing Attacks . . . . . . . . . . . . . . . . . . . . . 28 109 10.10. Replay Protection . . . . . . . . . . . . . . . . . . . . 28 110 10.11. SHA-1 Certificate Thumbprints . . . . . . . . . . . . . . 28 111 10.12. JSON Security Considerations . . . . . . . . . . . . . . 28 112 10.13. Unicode Comparison Security Considerations . . . . . . . 29 113 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 30 114 11.1. Normative References . . . . . . . . . . . . . . . . . . 30 115 11.2. Informative References . . . . . . . . . . . . . . . . . 31 116 Appendix A. JWS Examples . . . . . . . . . . . . . . . . . . . . 32 117 A.1. Example JWS using HMAC SHA-256 . . . . . . . . . . . . . 33 118 A.1.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 33 119 A.1.2. Validating . . . . . . . . . . . . . . . . . . . . . . 35 120 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 . . . . . . . 35 121 A.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 35 122 A.2.2. Validating . . . . . . . . . . . . . . . . . . . . . . 38 123 A.3. Example JWS using ECDSA P-256 SHA-256 . . . . . . . . . . 38 124 A.3.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 38 125 A.3.2. Validating . . . . . . . . . . . . . . . . . . . . . . 40 126 A.4. Example JWS using ECDSA P-521 SHA-512 . . . . . . . . . . 41 127 A.4.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 41 128 A.4.2. Validating . . . . . . . . . . . . . . . . . . . . . . 43 129 A.5. Example Unsecured JWS . . . . . . . . . . . . . . . . . . 43 130 A.6. Example JWS Using JWS JSON Serialization . . . . . . . . 44 131 A.6.1. JWS Per-Signature Protected Headers . . . . . . . . . 44 132 A.6.2. JWS Per-Signature Unprotected Headers . . . . . . . . 45 133 A.6.3. Complete JOSE Header Values . . . . . . . . . . . . . 45 134 A.6.4. Complete JWS JSON Serialization Representation . . . . 45 135 Appendix B. "x5c" (X.509 Certificate Chain) Example . . . . . . . 46 136 Appendix C. Notes on implementing base64url encoding without 137 padding . . . . . . . . . . . . . . . . . . . . . . . 48 138 Appendix D. Notes on Key Selection . . . . . . . . . . . . . . . 49 139 Appendix E. Negative Test Case for "crit" Header Parameter . . . 50 140 Appendix F. Detached Content . . . . . . . . . . . . . . . . . . 51 141 Appendix G. Acknowledgements . . . . . . . . . . . . . . . . . . 51 142 Appendix H. Document History . . . . . . . . . . . . . . . . . . 52 143 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 61 145 1. Introduction 147 JSON Web Signature (JWS) represents content secured with digital 148 signatures or Message Authentication Codes (MACs) using JavaScript 149 Object Notation (JSON) [RFC7159] based data structures. The JWS 150 cryptographic mechanisms provide integrity protection for an 151 arbitrary sequence of octets. See Section 10.5 for a discussion on 152 the differences between Digital Signatures and MACs. 154 Two closely related serializations for JWS objects are defined. The 155 JWS Compact Serialization is a compact, URL-safe representation 156 intended for space constrained environments such as HTTP 157 Authorization headers and URI query parameters. The JWS JSON 158 Serialization represents JWS objects as JSON objects and enables 159 multiple signatures and/or MACs to be applied to the same content. 160 Both share the same cryptographic underpinnings. 162 Cryptographic algorithms and identifiers for use with this 163 specification are described in the separate JSON Web Algorithms (JWA) 164 [JWA] specification and an IANA registry defined by that 165 specification. Related encryption capabilities are described in the 166 separate JSON Web Encryption (JWE) [JWE] specification. 168 Names defined by this specification are short because a core goal is 169 for the resulting representations to be compact. 171 1.1. Notational Conventions 173 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 174 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 175 "OPTIONAL" in this document are to be interpreted as described in Key 176 words for use in RFCs to Indicate Requirement Levels [RFC2119]. If 177 these words are used without being spelled in uppercase then they are 178 to be interpreted with their normal natural language meanings. 180 BASE64URL(OCTETS) denotes the base64url encoding of OCTETS, per 181 Section 2. 183 UTF8(STRING) denotes the octets of the UTF-8 [RFC3629] representation 184 of STRING. 186 ASCII(STRING) denotes the octets of the ASCII [USASCII] 187 representation of STRING. 189 The concatenation of two values A and B is denoted as A || B. 191 2. Terminology 193 These terms are defined by this specification: 195 JSON Web Signature (JWS) 196 A data structure representing a digitally signed or MACed message. 198 JOSE Header 199 JSON object containing the parameters describing the cryptographic 200 operations and parameters employed. The JOSE Header is comprised 201 of a set of Header Parameters. 203 JWS Payload 204 The sequence of octets to be secured -- a.k.a., the message. The 205 payload can contain an arbitrary sequence of octets. 207 JWS Signature 208 Digital signature or MAC over the JWS Protected Header and the JWS 209 Payload. 211 Header Parameter 212 A name/value pair that is member of the JOSE Header. 214 JWS Protected Header 215 JSON object that contains the Header Parameters that are integrity 216 protected by the JWS Signature digital signature or MAC operation. 217 For the JWS Compact Serialization, this comprises the entire JOSE 218 Header. For the JWS JSON Serialization, this is one component of 219 the JOSE Header. 221 JWS Unprotected Header 222 JSON object that contains the Header Parameters that are not 223 integrity protected. This can only be present when using the JWS 224 JSON Serialization. 226 Base64url Encoding 227 Base64 encoding using the URL- and filename-safe character set 228 defined in Section 5 of RFC 4648 [RFC4648], with all trailing '=' 229 characters omitted (as permitted by Section 3.2) and without the 230 inclusion of any line breaks, white space, or other additional 231 characters. (See Appendix C for notes on implementing base64url 232 encoding without padding.) 234 JWS Signing Input 235 The input to the digital signature or MAC computation. Its value 236 is ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 237 BASE64URL(JWS Payload)). 239 JWS Compact Serialization 240 A representation of the JWS as a compact, URL-safe string. 242 JWS JSON Serialization 243 A representation of the JWS as a JSON object. Unlike the JWS 244 Compact Serialization, the JWS JSON Serialization enables multiple 245 digital signatures and/or MACs to be applied to the same content. 246 This representation is neither optimized for compactness nor URL- 247 safe. 249 Unsecured JWS 250 A JWS object that provides no integrity protection. 252 Collision-Resistant Name 253 A name in a namespace that enables names to be allocated in a 254 manner such that they are highly unlikely to collide with other 255 names. Examples of collision-resistant namespaces include: Domain 256 Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and 257 X.670 Recommendation series, and Universally Unique IDentifiers 258 (UUIDs) [RFC4122]. When using an administratively delegated 259 namespace, the definer of a name needs to take reasonable 260 precautions to ensure they are in control of the portion of the 261 namespace they use to define the name. 263 StringOrURI 264 A JSON string value, with the additional requirement that while 265 arbitrary string values MAY be used, any value containing a ":" 266 character MUST be a URI [RFC3986]. StringOrURI values are 267 compared as case-sensitive strings with no transformations or 268 canonicalizations applied. 270 These terms defined by the JSON Web Encryption (JWE) [JWE] 271 specification are incorporated into this specification: "JSON Web 272 Encryption (JWE)" and "JWE Compact Serialization". 274 3. JSON Web Signature (JWS) Overview 276 JWS represents digitally signed or MACed content using JSON data 277 structures and base64url encoding. These JSON data structures MAY 278 contain white space and/or line breaks. A JWS represents these 279 logical values (each of which is defined in Section 2): 281 o JOSE Header 282 o JWS Payload 283 o JWS Signature 285 For a JWS object, the JOSE Header members are the union of the 286 members of these values (each of which is defined in Section 2): 288 o JWS Protected Header 289 o JWS Unprotected Header 291 This document defines two serializations for JWS objects: a compact, 292 URL-safe serialization called the JWS Compact Serialization and a 293 JSON serialization called the JWS JSON Serialization. In both 294 serializations, the JWS Protected Header, JWS Payload, and JWS 295 Signature are base64url encoded for transmission, since JSON lacks a 296 way to directly represent arbitrary octet sequences. 298 3.1. JWS Compact Serialization Overview 300 In the JWS Compact Serialization, no JWS Unprotected Header is used. 301 In this case, the JOSE Header and the JWS Protected Header are the 302 same. 304 In the JWS Compact Serialization, a JWS object is represented as the 305 concatenation: 307 BASE64URL(UTF8(JWS Protected Header)) || '.' || 308 BASE64URL(JWS Payload) || '.' || 309 BASE64URL(JWS Signature) 311 3.2. JWS JSON Serialization Overview 313 In the JWS JSON Serialization, one or both of the JWS Protected 314 Header and JWS Unprotected Header MUST be present. In this case, the 315 members of the JOSE Header are the combination of the members of the 316 JWS Protected Header and the JWS Unprotected Header values that are 317 present. 319 In the JWS JSON Serialization, a JWS object is represented as the 320 combination of these four values, 321 BASE64URL(UTF8(JWS Protected Header)), 322 JWS Unprotected Header, 323 BASE64URL(JWS Payload), and 324 BASE64URL(JWS Signature), 325 with the three base64url encoding result strings and the JWS 326 Unprotected Header value being represented as members within a JSON 327 object. The inclusion of some of these values is OPTIONAL. The JWS 328 JSON Serialization can also represent multiple signature and/or MAC 329 values, rather than just one. See Section 7.2 for more information 330 about the JWS JSON Serialization. 332 3.3. Example JWS 334 This section provides an example of a JWS. Its computation is 335 described in more detail in Appendix A.1, including specifying the 336 exact octet sequences representing the JSON values used and the key 337 value used. 339 The following example JWS Protected Header declares that the encoded 340 object is a JSON Web Token (JWT) [JWT] and the JWS Protected Header 341 and the JWS Payload are secured using the HMAC SHA-256 [RFC2104, SHS] 342 algorithm: 344 {"typ":"JWT", 345 "alg":"HS256"} 347 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 348 Header)) gives this value: 350 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 352 The UTF-8 representation of following JSON object is used as the JWS 353 Payload. (Note that the payload can be any content, and need not be 354 a representation of a JSON object.) 356 {"iss":"joe", 357 "exp":1300819380, 358 "http://example.com/is_root":true} 360 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value 361 (with line breaks for display purposes only): 363 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 364 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 366 Computing the HMAC of the JWS Signing Input ASCII(BASE64URL(UTF8(JWS 367 Protected Header)) || '.' || BASE64URL(JWS Payload)) with the HMAC 368 SHA-256 algorithm using the key specified in Appendix A.1 and 369 base64url encoding the result yields this BASE64URL(JWS Signature) 370 value: 372 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 374 Concatenating these values in the order Header.Payload.Signature with 375 period ('.') characters between the parts yields this complete JWS 376 representation using the JWS Compact Serialization (with line breaks 377 for display purposes only): 379 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 380 . 381 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 382 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 383 . 384 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 386 See Appendix A for additional examples. 388 4. JOSE Header 390 For a JWS object, the members of the JSON object(s) representing the 391 JOSE Header describe the digital signature or MAC applied to the JWS 392 Protected Header and the JWS Payload and optionally additional 393 properties of the JWS. The Header Parameter names within the JOSE 394 Header MUST be unique; recipients MUST either reject JWSs with 395 duplicate Header Parameter names or use a JSON parser that returns 396 only the lexically last duplicate member name, as specified in 397 Section 15.12 (The JSON Object) of ECMAScript 5.1 [ECMAScript]. 399 Implementations are required to understand the specific Header 400 Parameters defined by this specification that are designated as "MUST 401 be understood" and process them in the manner defined in this 402 specification. All other Header Parameters defined by this 403 specification that are not so designated MUST be ignored when not 404 understood. Unless listed as a critical Header Parameter, per 405 Section 4.1.11, all Header Parameters not defined by this 406 specification MUST be ignored when not understood. 408 There are three classes of Header Parameter names: Registered Header 409 Parameter names, Public Header Parameter names, and Private Header 410 Parameter names. 412 4.1. Registered Header Parameter Names 414 The following Header Parameter names for use in JWS objects are 415 registered in the IANA JSON Web Signature and Encryption Header 416 Parameters registry defined in Section 9.1, with meanings as defined 417 below. 419 As indicated by the common registry, JWSs and JWEs share a common 420 Header Parameter space; when a parameter is used by both 421 specifications, its usage must be compatible between the 422 specifications. 424 4.1.1. "alg" (Algorithm) Header Parameter 426 The "alg" (algorithm) Header Parameter identifies the cryptographic 427 algorithm used to secure the JWS. The JWS Signature value is not 428 valid if the "alg" value does not represent a supported algorithm, or 429 if there is not a key for use with that algorithm associated with the 430 party that digitally signed or MACed the content. "alg" values should 431 either be registered in the IANA JSON Web Signature and Encryption 432 Algorithms registry defined in [JWA] or be a value that contains a 433 Collision-Resistant Name. The "alg" value is a case-sensitive string 434 containing a StringOrURI value. This Header Parameter MUST be 435 present and MUST be understood and processed by implementations. 437 A list of defined "alg" values for this use can be found in the IANA 438 JSON Web Signature and Encryption Algorithms registry defined in 439 [JWA]; the initial contents of this registry are the values defined 440 in Section 3.1 of the JSON Web Algorithms (JWA) [JWA] specification. 442 4.1.2. "jku" (JWK Set URL) Header Parameter 444 The "jku" (JWK Set URL) Header Parameter is a URI [RFC3986] that 445 refers to a resource for a set of JSON-encoded public keys, one of 446 which corresponds to the key used to digitally sign the JWS. The 447 keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The 448 protocol used to acquire the resource MUST provide integrity 449 protection; an HTTP GET request to retrieve the JWK Set MUST use TLS 450 [RFC2818, RFC5246]; the identity of the server MUST be validated, as 451 per Section 6 of RFC 6125 [RFC6125]. Use of this Header Parameter is 452 OPTIONAL. 454 4.1.3. "jwk" (JSON Web Key) Header Parameter 456 The "jwk" (JSON Web Key) Header Parameter is the public key that 457 corresponds to the key used to digitally sign the JWS. This key is 458 represented as a JSON Web Key [JWK]. Use of this Header Parameter is 459 OPTIONAL. 461 4.1.4. "kid" (Key ID) Header Parameter 463 The "kid" (key ID) Header Parameter is a hint indicating which key 464 was used to secure the JWS. This parameter allows originators to 465 explicitly signal a change of key to recipients. The structure of 466 the "kid" value is unspecified. Its value MUST be a string. Use of 467 this Header Parameter is OPTIONAL. 469 When used with a JWK, the "kid" value is used to match a JWK "kid" 470 parameter value. 472 4.1.5. "x5u" (X.509 URL) Header Parameter 474 The "x5u" (X.509 URL) Header Parameter is a URI [RFC3986] that refers 475 to a resource for the X.509 public key certificate or certificate 476 chain [RFC5280] corresponding to the key used to digitally sign the 477 JWS. The identified resource MUST provide a representation of the 478 certificate or certificate chain that conforms to RFC 5280 [RFC5280] 479 in PEM encoded form [RFC1421]. The certificate containing the public 480 key corresponding to the key used to digitally sign the JWS MUST be 481 the first certificate. This MAY be followed by additional 482 certificates, with each subsequent certificate being the one used to 483 certify the previous one. The protocol used to acquire the resource 484 MUST provide integrity protection; an HTTP GET request to retrieve 485 the certificate MUST use TLS [RFC2818, RFC5246]; the identity of the 486 server MUST be validated, as per Section 6 of RFC 6125 [RFC6125]. 487 Use of this Header Parameter is OPTIONAL. 489 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter 491 The "x5c" (X.509 Certificate Chain) Header Parameter contains the 492 X.509 public key certificate or certificate chain [RFC5280] 493 corresponding to the key used to digitally sign the JWS. The 494 certificate or certificate chain is represented as a JSON array of 495 certificate value strings. Each string in the array is a base64 496 encoded ([RFC4648] Section 4 -- not base64url encoded) DER 497 [ITU.X690.1994] PKIX certificate value. The certificate containing 498 the public key corresponding to the key used to digitally sign the 499 JWS MUST be the first certificate. This MAY be followed by 500 additional certificates, with each subsequent certificate being the 501 one used to certify the previous one. The recipient MUST validate 502 the certificate chain according to RFC 5280 [RFC5280] and reject the 503 signature if any validation failure occurs. Use of this Header 504 Parameter is OPTIONAL. 506 See Appendix B for an example "x5c" value. 508 4.1.7. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter 510 The "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter is a 511 base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER 512 encoding of the X.509 certificate [RFC5280] corresponding to the key 513 used to digitally sign the JWS. Note that certificate thumbprints 514 are also sometimes known as certificate fingerprints. Use of this 515 Header Parameter is OPTIONAL. 517 4.1.8. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 518 Parameter 520 The "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header 521 Parameter is a base64url encoded SHA-256 thumbprint (a.k.a. digest) 522 of the DER encoding of the X.509 certificate [RFC5280] corresponding 523 to the key used to digitally sign the JWS. Note that certificate 524 thumbprints are also sometimes known as certificate fingerprints. 525 Use of this Header Parameter is OPTIONAL. 527 4.1.9. "typ" (Type) Header Parameter 529 The "typ" (type) Header Parameter is used by JWS applications to 530 declare the MIME Media Type [IANA.MediaTypes] of this complete JWS 531 object. This is intended for use by the application when more than 532 one kind of object could be present in an application data structure 533 that can contain a JWS object; the application can use this value to 534 disambiguate among the different kinds of objects that might be 535 present. It will typically not be used by applications when the kind 536 of object is already known. This parameter is ignored by JWS 537 implementations; any processing of this parameter is performed by the 538 JWS application. Use of this Header Parameter is OPTIONAL. 540 Per RFC 2045 [RFC2045], all media type values, subtype values, and 541 parameter names are case-insensitive. However, parameter values are 542 case-sensitive unless otherwise specified for the specific parameter. 544 To keep messages compact in common situations, it is RECOMMENDED that 545 senders omit an "application/" prefix of a media type value in a 546 "typ" Header Parameter when no other '/' appears in the media type 547 value. A recipient using the media type value MUST treat it as if 548 "application/" were prepended to any "typ" value not containing a 549 '/'. For instance, a "typ" value of "example" SHOULD be used to 550 represent the "application/example" media type; whereas, the media 551 type "application/example;part="1/2"" cannot be shortened to 552 "example;part="1/2"". 554 The "typ" value "JOSE" can be used by applications to indicate that 555 this object is a JWS or JWE using the JWS Compact Serialization or 556 the JWE Compact Serialization. The "typ" value "JOSE+JSON" can be 557 used by applications to indicate that this object is a JWS or JWE 558 using the JWS JSON Serialization or the JWE JSON Serialization. 559 Other type values can also be used by applications. 561 4.1.10. "cty" (Content Type) Header Parameter 563 The "cty" (content type) Header Parameter is used by JWS applications 564 to declare the MIME Media Type [IANA.MediaTypes] of the secured 565 content (the payload). This is intended for use by the application 566 when more than one kind of object could be present in the JWS 567 payload; the application can use this value to disambiguate among the 568 different kinds of objects that might be present. It will typically 569 not be used by applications when the kind of object is already known. 570 This parameter is ignored by JWS implementations; any processing of 571 this parameter is performed by the JWS application. Use of this 572 Header Parameter is OPTIONAL. 574 Per RFC 2045 [RFC2045], all media type values, subtype values, and 575 parameter names are case-insensitive. However, parameter values are 576 case-sensitive unless otherwise specified for the specific parameter. 578 To keep messages compact in common situations, it is RECOMMENDED that 579 senders omit an "application/" prefix of a media type value in a 580 "cty" Header Parameter when no other '/' appears in the media type 581 value. A recipient using the media type value MUST treat it as if 582 "application/" were prepended to any "cty" value not containing a 583 '/'. For instance, a "cty" value of "example" SHOULD be used to 584 represent the "application/example" media type; whereas, the media 585 type "application/example;part="1/2"" cannot be shortened to 586 "example;part="1/2"". 588 4.1.11. "crit" (Critical) Header Parameter 590 The "crit" (critical) Header Parameter indicates that extensions to 591 the initial RFC versions of [[ this specification ]] and [JWA] are 592 being used that MUST be understood and processed. Its value is an 593 array listing the Header Parameter names present in the JOSE Header 594 that use those extensions. If any of the listed extension Header 595 Parameters are not understood and supported by the receiver, it MUST 596 reject the JWS. Senders MUST NOT include Header Parameter names 597 defined by the initial RFC versions of [[ this specification ]] or 598 [JWA] for use with JWS, duplicate names, or names that do not occur 599 as Header Parameter names within the JOSE Header in the "crit" list. 600 Senders MUST NOT use the empty list "[]" as the "crit" value. 601 Recipients MAY reject the JWS if the critical list contains any 602 Header Parameter names defined by the initial RFC versions of [[ this 603 specification ]] or [JWA] for use with JWS, or any other constraints 604 on its use are violated. This Header Parameter MUST be integrity 605 protected, and therefore MUST occur only within the JWS Protected 606 Header, when used. Use of this Header Parameter is OPTIONAL. This 607 Header Parameter MUST be understood and processed by implementations. 609 An example use, along with a hypothetical "exp" (expiration-time) 610 field is: 612 {"alg":"ES256", 613 "crit":["exp"], 614 "exp":1363284000 615 } 617 4.2. Public Header Parameter Names 619 Additional Header Parameter names can be defined by those using JWSs. 620 However, in order to prevent collisions, any new Header Parameter 621 name should either be registered in the IANA JSON Web Signature and 622 Encryption Header Parameters registry defined in Section 9.1 or be a 623 Public Name: a value that contains a Collision-Resistant Name. In 624 each case, the definer of the name or value needs to take reasonable 625 precautions to make sure they are in control of the part of the 626 namespace they use to define the Header Parameter name. 628 New Header Parameters should be introduced sparingly, as they can 629 result in non-interoperable JWSs. 631 4.3. Private Header Parameter Names 633 A producer and consumer of a JWS may agree to use Header Parameter 634 names that are Private Names: names that are not Registered Header 635 Parameter names Section 4.1 or Public Header Parameter names 636 Section 4.2. Unlike Public Header Parameter names, Private Header 637 Parameter names are subject to collision and should be used with 638 caution. 640 5. Producing and Consuming JWSs 642 5.1. Message Signature or MAC Computation 644 To create a JWS, one MUST perform these steps. The order of the 645 steps is not significant in cases where there are no dependencies 646 between the inputs and outputs of the steps. 647 1. Create the content to be used as the JWS Payload. 648 2. Compute the encoded payload value BASE64URL(JWS Payload). 649 3. Create the JSON object(s) containing the desired set of Header 650 Parameters, which together comprise the JOSE Header: the JWS 651 Protected Header, and if the JWS JSON Serialization is being 652 used, the JWS Unprotected Header. 653 4. Compute the encoded header value BASE64URL(UTF8(JWS Protected 654 Header)). If the JWS Protected Header is not present (which can 655 only happen when using the JWS JSON Serialization and no 656 "protected" member is present), let this value be the empty 657 string. 658 5. Compute the JWS Signature in the manner defined for the 659 particular algorithm being used over the JWS Signing Input 660 ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 661 BASE64URL(JWS Payload)). The "alg" (algorithm) Header Parameter 662 MUST be present in the JOSE Header, with the algorithm value 663 accurately representing the algorithm used to construct the JWS 664 Signature. 665 6. Compute the encoded signature value BASE64URL(JWS Signature). 666 7. These three encoded values are used in both the JWS Compact 667 Serialization and the JWS JSON Serialization representations. 668 8. If the JWS JSON Serialization is being used, repeat this process 669 (steps 3-7) for each digital signature or MAC operation being 670 performed. 671 9. Create the desired serialized output. The JWS Compact 672 Serialization of this result is BASE64URL(UTF8(JWS Protected 673 Header)) || '.' || BASE64URL(JWS Payload) || '.' || BASE64URL(JWS 674 Signature). The JWS JSON Serialization is described in 675 Section 7.2. 677 5.2. Message Signature or MAC Validation 679 When validating a JWS, the following steps MUST be taken. The order 680 of the steps is not significant in cases where there are no 681 dependencies between the inputs and outputs of the steps. If any of 682 the listed steps fails, then the signature or MAC cannot be 683 validated. 685 When there are multiple JWS Signature values, it is an application 686 decision which of the JWS Signature values must successfully validate 687 for the JWS to be accepted. In some cases, all must successfully 688 validate or the JWS will be rejected. In other cases, only a 689 specific JWS signature value needs to be successfully validated. 690 However, in all cases, at least one JWS signature value MUST 691 successfully validate or the JWS MUST be rejected. 693 1. Parse the JWS representation to extract the serialized values 694 for the components of the JWS. When using the JWS Compact 695 Serialization, these components are the base64url encoded 696 representations of the JWS Protected Header, the JWS Payload, 697 and the JWS Signature, and when using the JWS JSON 698 Serialization, these components also include the unencoded JWS 699 Unprotected Header value. When using the JWS Compact 700 Serialization, the JWS Protected Header, the JWS Payload, and 701 the JWS Signature are represented as base64url encoded values in 702 that order, separated by two period ('.') characters. The JWS 703 JSON Serialization is described in Section 7.2. 705 2. The encoded representation of the JWS Protected Header MUST be 706 successfully base64url decoded following the restriction that no 707 padding characters have been used. 708 3. The resulting octet sequence MUST be a UTF-8 encoded 709 representation of a completely valid JSON object conforming to 710 RFC 7159 [RFC7159], which is the JWS Protected Header. 711 4. If using the JWS Compact Serialization, let the JOSE Header be 712 the JWS Protected Header. Otherwise, when using the JWS JSON 713 Serialization, let the JOSE Header be the union of the members 714 of the corresponding JWS Protected Header and JWS Unprotected 715 Header, all of which must be completely valid JSON objects. 716 5. The resulting JOSE Header MUST NOT contain duplicate Header 717 Parameter names. When using the JWS JSON Serialization, this 718 restriction includes that the same Header Parameter name also 719 MUST NOT occur in distinct JSON object values that together 720 comprise the JOSE Header. 721 6. Verify that the implementation understands and can process all 722 fields that it is required to support, whether required by this 723 specification, by the algorithm being used, or by the "crit" 724 Header Parameter value, and that the values of those parameters 725 are also understood and supported. 726 7. The encoded representation of the JWS Payload MUST be 727 successfully base64url decoded following the restriction that no 728 padding characters have been used. 729 8. The encoded representation of the JWS Signature MUST be 730 successfully base64url decoded following the restriction that no 731 padding characters have been used. 732 9. Validate the JWS Signature against the JWS Signing Input 733 ASCII(BASE64URL(UTF8(JWS Protected Header)) || '.' || 734 BASE64URL(JWS Payload)) in the manner defined for the algorithm 735 being used, which MUST be accurately represented by the value of 736 the "alg" (algorithm) Header Parameter, which MUST be present. 737 See Section 10.6 for security considerations on algorithm 738 validation. Record whether the validation succeeded or not. 739 10. If the JWS JSON Serialization is being used, repeat this process 740 (steps 4-9) for each digital signature or MAC value contained in 741 the representation. 742 11. If none of the validations in step 9 succeeded, then the JWS 743 MUST be rejected. Otherwise, in the JWS JSON Serialization 744 case, return a result to the application indicating which of the 745 validations succeeded and failed. In the JWS Compact 746 Serialization case, the result can simply indicate whether the 747 JWS was accepted or rejected. 749 Finally, note that it is an application decision which algorithms are 750 acceptable in a given context. Even if a JWS can be successfully 751 validated, unless the algorithm(s) used in the JWS are acceptable to 752 the application, it SHOULD reject the JWS. 754 5.3. String Comparison Rules 756 Processing a JWS inevitably requires comparing known strings to 757 members and values in a JSON object. For example, in checking what 758 the algorithm is, the Unicode string "alg" will be checked against 759 the member names in the JOSE Header to see if there is a matching 760 Header Parameter name. The same process is then used to determine if 761 the value of the "alg" Header Parameter represents a supported 762 algorithm. 764 Since the only string comparison operations that are performed are 765 equality and inequality, the same rules can be used for comparing 766 both member names and member values against known strings. The JSON 767 rules for doing member name comparison are described in Section 8.3 768 of RFC 7159 [RFC7159]. 770 Also, see the JSON security considerations in Section 10.12 and the 771 Unicode security considerations in Section 10.13. 773 6. Key Identification 775 It is necessary for the recipient of a JWS to be able to determine 776 the key that was employed for the digital signature or MAC operation. 777 The key employed can be identified using the Header Parameter methods 778 described in Section 4.1 or can be identified using methods that are 779 outside the scope of this specification. Specifically, the Header 780 Parameters "jku", "jwk", "kid", "x5u", "x5c", "x5t", and "x5t#S256" 781 can be used to identify the key used. These Header Parameters MUST 782 be integrity protected if the information that they convey is to be 783 utilized in a trust decision. 785 The sender SHOULD include sufficient information in the Header 786 Parameters to identify the key used, unless the application uses 787 another means or convention to determine the key used. Validation of 788 the signature or MAC fails when the algorithm used requires a key 789 (which is true of all algorithms except for "none") and the key used 790 cannot be determined. 792 The means of exchanging any shared symmetric keys used is outside the 793 scope of this specification. 795 Also, see Appendix D for notes on possible key selection algorithms. 797 7. Serializations 799 JWS objects use one of two serializations, the JWS Compact 800 Serialization or the JWS JSON Serialization. Applications using this 801 specification need to specify what serialization and serialization 802 features are used for that application. For instance, applications 803 might specify that only the JWS JSON Serialization is used, that only 804 JWS JSON Serialization support for a single signature or MAC value is 805 used, or that support for multiple signatures and/or MAC values is 806 used. JWS implementations only need to implement the features needed 807 for the applications they are designed to support. 809 7.1. JWS Compact Serialization 811 The JWS Compact Serialization represents digitally signed or MACed 812 content as a compact, URL-safe string. This string is: 814 BASE64URL(UTF8(JWS Protected Header)) || '.' || 815 BASE64URL(JWS Payload) || '.' || 816 BASE64URL(JWS Signature) 818 Only one signature/MAC is supported by the JWS Compact Serialization 819 and it provides no syntax to represent a JWS Unprotected Header 820 value. 822 7.2. JWS JSON Serialization 824 The JWS JSON Serialization represents digitally signed or MACed 825 content as a JSON object. Content using the JWS JSON Serialization 826 can be secured with more than one digital signature and/or MAC 827 operation. This representation is neither optimized for compactness 828 nor URL-safe. 830 The following members are defined for use in top-level JSON objects 831 used for the JWS JSON Serialization: 833 payload 834 The "payload" member MUST be present and contain the value 835 BASE64URL(JWS Payload). 837 signatures 838 The "signatures" member value MUST be an array of JSON objects. 839 Each object represents a signature or MAC over the JWS Payload and 840 the JWS Protected Header. 842 The following members are defined for use in the JSON objects that 843 are elements of the "signatures" array: 845 protected 846 The "protected" member MUST be present and contain the value 847 BASE64URL(UTF8(JWS Protected Header)) when the JWS Protected 848 Header value is non-empty; otherwise, it MUST be absent. These 849 Header Parameter values are integrity protected. 851 header 852 The "header" member MUST be present and contain the value JWS 853 Unprotected Header when the JWS Unprotected Header value is non- 854 empty; otherwise, it MUST be absent. This value is represented as 855 an unencoded JSON object, rather than as a string. These Header 856 Parameter values are not integrity protected. 858 signature 859 The "signature" member MUST be present and contain the value 860 BASE64URL(JWS Signature). 862 At least one of the "protected" and "header" members MUST be present 863 for each signature/MAC computation so that an "alg" Header Parameter 864 value is conveyed. 866 Additional members can be present in both the JSON objects defined 867 above; if not understood by implementations encountering them, they 868 MUST be ignored. 870 The Header Parameter values used when creating or validating 871 individual signature or MAC values are the union of the two sets of 872 Header Parameter values that may be present: (1) the JWS Protected 873 Header represented in the "protected" member of the signature/MAC's 874 array element, and (2) the JWS Unprotected Header in the "header" 875 member of the signature/MAC's array element. The union of these sets 876 of Header Parameters comprises the JOSE Header. The Header Parameter 877 names in the two locations MUST be disjoint. 879 Each JWS Signature value is computed using the parameters of the 880 corresponding JOSE Header value in the same manner as for the JWS 881 Compact Serialization. This has the desirable property that each JWS 882 Signature value represented in the "signatures" array is identical to 883 the value that would have been computed for the same parameter in the 884 JWS Compact Serialization, provided that the JWS Protected Header 885 value for that signature/MAC computation (which represents the 886 integrity-protected Header Parameter values) matches that used in the 887 JWS Compact Serialization. 889 In summary, the syntax of a JWS using the JWS JSON Serialization is 890 as follows: 892 { 893 "payload":"", 894 "signatures":[ 895 {"protected":"", 896 "header":, 897 "signature":""}, 898 ... 899 {"protected":"", 900 "header":, 901 "signature":""}] 902 } 904 See Appendix A.6 for an example of computing a JWS using the JWS JSON 905 Serialization. 907 8. TLS Requirements 909 Implementations MUST support TLS. Which version(s) ought to be 910 implemented will vary over time, and depend on the widespread 911 deployment and known security vulnerabilities at the time of 912 implementation. At the time of this writing, TLS version 1.2 913 [RFC5246] is the most recent version. 915 To protect against information disclosure and tampering, 916 confidentiality protection MUST be applied using TLS with a 917 ciphersuite that provides confidentiality and integrity protection. 918 See current publications by the IETF TLS working group, including RFC 919 6176 [RFC6176], for guidance on the ciphersuites currently considered 920 to be appropriate for use. Also, see Recommendations for Secure Use 921 of TLS and DTLS [I-D.ietf-uta-tls-bcp] for recommendations on 922 improving the security of software and services using TLS. 924 Whenever TLS is used, the identity of the service provider encoded in 925 the TLS server certificate MUST be verified using the procedures 926 described in Section 6 of RFC 6125 [RFC6125]. 928 9. IANA Considerations 930 The following registration procedure is used for all the registries 931 established by this specification. 933 Values are registered on a Specification Required [RFC5226] basis 934 after a three-week review period on the [TBD]@ietf.org mailing list, 935 on the advice of one or more Designated Experts. However, to allow 936 for the allocation of values prior to publication, the Designated 937 Expert(s) may approve registration once they are satisfied that such 938 a specification will be published. 940 Registration requests must be sent to the [TBD]@ietf.org mailing list 941 for review and comment, with an appropriate subject (e.g., "Request 942 for access token type: example"). [[ Note to the RFC Editor: The name 943 of the mailing list should be determined in consultation with the 944 IESG and IANA. Suggested name: jose-reg-review. ]] 946 Within the review period, the Designated Expert(s) will either 947 approve or deny the registration request, communicating this decision 948 to the review list and IANA. Denials should include an explanation 949 and, if applicable, suggestions as to how to make the request 950 successful. Registration requests that are undetermined for a period 951 longer than 21 days can be brought to the IESG's attention (using the 952 iesg@iesg.org mailing list) for resolution. 954 Criteria that should be applied by the Designated Expert(s) includes 955 determining whether the proposed registration duplicates existing 956 functionality, determining whether it is likely to be of general 957 applicability or whether it is useful only for a single application, 958 and whether the registration makes sense. 960 IANA must only accept registry updates from the Designated Expert(s) 961 and should direct all requests for registration to the review mailing 962 list. 964 It is suggested that multiple Designated Experts be appointed who are 965 able to represent the perspectives of different applications using 966 this specification, in order to enable broadly-informed review of 967 registration decisions. In cases where a registration decision could 968 be perceived as creating a conflict of interest for a particular 969 Expert, that Expert should defer to the judgment of the other 970 Expert(s). 972 9.1. JSON Web Signature and Encryption Header Parameters Registry 974 This specification establishes the IANA JSON Web Signature and 975 Encryption Header Parameters registry for Header Parameter names. 976 The registry records the Header Parameter name and a reference to the 977 specification that defines it. The same Header Parameter name can be 978 registered multiple times, provided that the parameter usage is 979 compatible between the specifications. Different registrations of 980 the same Header Parameter name will typically use different Header 981 Parameter Usage Location(s) values. 983 9.1.1. Registration Template 985 Header Parameter Name: 986 The name requested (e.g., "example"). Because a core goal of this 987 specification is for the resulting representations to be compact, 988 it is RECOMMENDED that the name be short -- not to exceed 8 989 characters without a compelling reason to do so. This name is 990 case-sensitive. Names may not match other registered names in a 991 case-insensitive manner unless the Designated Expert(s) state that 992 there is a compelling reason to allow an exception in this 993 particular case. 995 Header Parameter Description: 996 Brief description of the Header Parameter (e.g., "Example 997 description"). 999 Header Parameter Usage Location(s): 1000 The Header Parameter usage locations, which should be one or more 1001 of the values "JWS" or "JWE". 1003 Change Controller: 1004 For Standards Track RFCs, state "IESG". For others, give the name 1005 of the responsible party. Other details (e.g., postal address, 1006 email address, home page URI) may also be included. 1008 Specification Document(s): 1009 Reference to the document(s) that specify the parameter, 1010 preferably including URI(s) that can be used to retrieve copies of 1011 the document(s). An indication of the relevant sections may also 1012 be included but is not required. 1014 9.1.2. Initial Registry Contents 1016 This specification registers the Header Parameter names defined in 1017 Section 4.1 in this registry. 1019 o Header Parameter Name: "alg" 1020 o Header Parameter Description: Algorithm 1021 o Header Parameter Usage Location(s): JWS 1022 o Change Controller: IESG 1023 o Specification Document(s): Section 4.1.1 of [[ this document ]] 1025 o Header Parameter Name: "jku" 1026 o Header Parameter Description: JWK Set URL 1027 o Header Parameter Usage Location(s): JWS 1028 o Change Controller: IESG 1029 o Specification Document(s): Section 4.1.2 of [[ this document ]] 1031 o Header Parameter Name: "jwk" 1032 o Header Parameter Description: JSON Web Key 1033 o Header Parameter Usage Location(s): JWS 1034 o Change Controller: IESG 1035 o Specification document(s): Section 4.1.3 of [[ this document ]] 1037 o Header Parameter Name: "kid" 1038 o Header Parameter Description: Key ID 1039 o Header Parameter Usage Location(s): JWS 1040 o Change Controller: IESG 1041 o Specification Document(s): Section 4.1.4 of [[ this document ]] 1043 o Header Parameter Name: "x5u" 1044 o Header Parameter Description: X.509 URL 1045 o Header Parameter Usage Location(s): JWS 1046 o Change Controller: IESG 1047 o Specification Document(s): Section 4.1.5 of [[ this document ]] 1049 o Header Parameter Name: "x5c" 1050 o Header Parameter Description: X.509 Certificate Chain 1051 o Header Parameter Usage Location(s): JWS 1052 o Change Controller: IESG 1053 o Specification Document(s): Section 4.1.6 of [[ this document ]] 1055 o Header Parameter Name: "x5t" 1056 o Header Parameter Description: X.509 Certificate SHA-1 Thumbprint 1057 o Header Parameter Usage Location(s): JWS 1058 o Change Controller: IESG 1059 o Specification Document(s): Section 4.1.7 of [[ this document ]] 1061 o Header Parameter Name: "x5t#S256" 1062 o Header Parameter Description: X.509 Certificate SHA-256 Thumbprint 1063 o Header Parameter Usage Location(s): JWS 1064 o Change Controller: IESG 1065 o Specification Document(s): Section 4.1.8 of [[ this document ]] 1067 o Header Parameter Name: "typ" 1068 o Header Parameter Description: Type 1069 o Header Parameter Usage Location(s): JWS 1070 o Change Controller: IESG 1071 o Specification Document(s): Section 4.1.9 of [[ this document ]] 1073 o Header Parameter Name: "cty" 1074 o Header Parameter Description: Content Type 1075 o Header Parameter Usage Location(s): JWS 1076 o Change Controller: IESG 1077 o Specification Document(s): Section 4.1.10 of [[ this document ]] 1079 o Header Parameter Name: "crit" 1080 o Header Parameter Description: Critical 1081 o Header Parameter Usage Location(s): JWS 1082 o Change Controller: IESG 1083 o Specification Document(s): Section 4.1.11 of [[ this document ]] 1085 9.2. Media Type Registration 1087 9.2.1. Registry Contents 1089 This specification registers the "application/jose" Media Type 1090 [RFC2046] in the MIME Media Types registry [IANA.MediaTypes], which 1091 can be used to indicate that the content is a JWS or JWE object using 1092 the JWS Compact Serialization or the JWE Compact Serialization and 1093 the "application/jose+json" Media Type in the MIME Media Types 1094 registry, which can be used to indicate that the content is a JWS or 1095 JWE object using the JWS JSON Serialization or the JWE JSON 1096 Serialization. 1098 o Type name: application 1099 o Subtype name: jose 1100 o Required parameters: n/a 1101 o Optional parameters: n/a 1102 o Encoding considerations: 8bit; application/jose values are encoded 1103 as a series of base64url encoded values (some of which may be the 1104 empty string) separated by period ('.') characters. 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: OpenID Connect, Mozilla 1110 Persona, Salesforce, Google, Android, Windows Azure, Xbox One, and 1111 numerous others that use JWTs 1112 o Additional information: Magic number(s): n/a, File extension(s): 1113 n/a, Macintosh file type code(s): n/a 1114 o Person & email address to contact for further information: Michael 1115 B. Jones, mbj@microsoft.com 1116 o Intended usage: COMMON 1117 o Restrictions on usage: none 1118 o Author: Michael B. Jones, mbj@microsoft.com 1119 o Change Controller: IESG 1120 o Type name: application 1121 o Subtype name: jose+json 1122 o Required parameters: n/a 1123 o Optional parameters: n/a 1124 o Encoding considerations: 8bit; application/jose+json values are 1125 represented as a JSON Object; UTF-8 encoding SHOULD be employed 1126 for the JSON object. 1127 o Security considerations: See the Security Considerations section 1128 of [[ this document ]] 1129 o Interoperability considerations: n/a 1130 o Published specification: [[ this document ]] 1131 o Applications that use this media type: TBD 1132 o Additional information: Magic number(s): n/a, File extension(s): 1133 n/a, Macintosh file type code(s): n/a 1134 o Person & email address to contact for further information: Michael 1135 B. Jones, mbj@microsoft.com 1136 o Intended usage: COMMON 1137 o Restrictions on usage: none 1138 o Author: Michael B. Jones, mbj@microsoft.com 1139 o Change Controller: IESG 1141 10. Security Considerations 1143 All of the security issues that are pertinent to any cryptographic 1144 application must be addressed by JWS/JWE/JWK agents. Among these 1145 issues are protecting the user's asymmetric private and symmetric 1146 secret keys and employing countermeasures to various attacks. 1148 All the security considerations in XML DSIG 2.0 1149 [W3C.NOTE-xmldsig-core2-20130411], also apply to this specification, 1150 other than those that are XML specific. Likewise, many of the best 1151 practices documented in XML Signature Best Practices 1152 [W3C.NOTE-xmldsig-bestpractices-20130411] also apply to this 1153 specification, other than those that are XML specific. 1155 10.1. Key Entropy and Random Values 1157 Keys are only as strong as the amount of entropy used to generate 1158 them. A minimum of 128 bits of entropy should be used for all keys, 1159 and depending upon the application context, more may be required. 1161 Implementations must randomly generate public/private key pairs, 1162 message authentication (MAC) keys, and padding values. The use of 1163 inadequate pseudo-random number generators (PRNGs) to generate 1164 cryptographic keys can result in little or no security. An attacker 1165 may find it much easier to reproduce the PRNG environment that 1166 produced the keys, searching the resulting small set of 1167 possibilities, rather than brute force searching the whole key space. 1168 The generation of quality random numbers is difficult. RFC 4086 1169 [RFC4086] offers important guidance in this area. 1171 10.2. Key Protection 1173 Implementations must protect the signer's private key. Compromise of 1174 the signer's private key permits an attacker to masquerade as the 1175 signer. 1177 Implementations must protect the message authentication (MAC) key. 1178 Compromise of the MAC key may result in undetectable modification of 1179 the authenticated content. 1181 10.3. Key Origin Authentication 1183 The key management technique employed to obtain public keys must 1184 authenticate the origin of the key; otherwise, it is unknown what 1185 party signed the message. 1187 Likewise, the key management technique employed to distribute MAC 1188 keys must provide data origin authentication; otherwise, the contents 1189 are delivered with integrity from an unknown source. 1191 10.4. Cryptographic Agility 1193 See Section 8.1 of [JWA] for security considerations on cryptographic 1194 agility. 1196 10.5. Differences between Digital Signatures and MACs 1198 While MACs and digital signatures can both be used for integrity 1199 checking, there are some significant differences between the security 1200 properties that each of them provides. These need to be taken into 1201 consideration when designing protocols and selecting the algorithms 1202 to be used in protocols. 1204 Both signatures and MACs provide for integrity checking -- verifying 1205 that the message has not been modified since the integrity value was 1206 computed. However, MACs provide for origination identification only 1207 under specific circumstances. It can normally be assumed that a 1208 private key used for a signature is only in the hands of a single 1209 entity (although perhaps a distributed entity, in the case of 1210 replicated servers); however, a MAC key needs to be in the hands of 1211 all the entities that use it for integrity computation and checking. 1212 This means that origination can only be determined if a MAC key is 1213 known only to two entities and the receiver knows that it did not 1214 create the message. MAC validation cannot be used to prove 1215 origination to a third party. 1217 10.6. Algorithm Validation 1219 The digital signature representations for some algorithms include 1220 information about the algorithm used inside the signature value. For 1221 instance, signatures produced with RSASSA-PKCS-v1_5 [RFC3447] encode 1222 the hash function used and many libraries actually use the hash 1223 algorithm specified inside the signature when validating the 1224 signature. When using such libraries, as part of the algorithm 1225 validation performed, implementations MUST ensure that the algorithm 1226 information encoded in the signature corresponds to that specified 1227 with the "alg" Header Parameter. If this is not done, an attacker 1228 could claim to have used a strong hash algorithm while actually using 1229 a weak one represented in the signature value. 1231 10.7. Algorithm Protection 1233 In some usages of JWS, there is a risk of algorithm substitution 1234 attacks, in which an attacker can use an existing digital signature 1235 value with a different signature algorithm to make it appear that a 1236 signer has signed something that it has not. These attacks have been 1237 discussed in detail in the context of CMS [RFC6211]. This risk 1238 arises when all of the following are true: 1240 o Verifiers of a signature support multiple algorithms. 1242 o Given an existing signature, an attacker can find another payload 1243 that produces the same signature value with a different algorithm. 1245 o The payload crafted by the attacker is valid in the application 1246 context. 1248 There are several ways for an application to mitigate algorithm 1249 substitution attacks: 1251 o Use only digital signature algorithms that are not vulnerable to 1252 substitution attacks. Substitution attacks are only feasible if 1253 an attacker can compute pre-images for a hash function accepted by 1254 the recipient. All JWA-defined signature algorithms use SHA-2 1255 hashes, for which there are no known pre-image attacks, as of the 1256 time of this writing. 1258 o Require that the "alg" Header Parameter be carried in the 1259 protected header. (This is always the case when using the JWS 1260 Compact Serialization and is the approach taken by CMS [RFC6211].) 1262 o Include a field containing the algorithm in the application 1263 payload, and require that it be matched with the "alg" Header 1264 Parameter during verification. (This is the approach taken by 1265 PKIX [RFC5280].) 1267 10.8. Chosen Plaintext Attacks 1269 Creators of JWSs should not allow third parties to insert arbitrary 1270 content into the message without adding entropy not controlled by the 1271 third party. 1273 10.9. Timing Attacks 1275 When cryptographic algorithms are implemented in such a way that 1276 successful operations take a different amount of time than 1277 unsuccessful operations, attackers may be able to use the time 1278 difference to obtain information about the keys employed. Therefore, 1279 such timing differences must be avoided. 1281 10.10. Replay Protection 1283 While not directly in scope for this specification, note that 1284 applications using JWS (or JWE) objects can thwart replay attacks by 1285 including a unique message identifier as integrity-protected content 1286 in the JWS (or JWE) message and having the recipient verify that the 1287 message has not been previously received or acted upon. 1289 10.11. SHA-1 Certificate Thumbprints 1291 A SHA-1 hash is used when computing "x5t" (X.509 Certificate SHA-1 1292 Thumbprint) values, for compatibility reasons. Should an effective 1293 means of producing SHA-1 hash collisions be developed, and should an 1294 attacker wish to interfere with the use of a known certificate on a 1295 given system, this could be accomplished by creating another 1296 certificate whose SHA-1 hash value is the same and adding it to the 1297 certificate store used by the intended victim. A prerequisite to 1298 this attack succeeding is the attacker having write access to the 1299 intended victim's certificate store. 1301 Alternatively, the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) 1302 Header Parameter could be used instead of "x5t". However, at the 1303 time of this writing, no development platform is known to support 1304 SHA-256 certificate thumbprints. 1306 10.12. JSON Security Considerations 1308 Strict JSON [RFC7159] validation is a security requirement. If 1309 malformed JSON is received, then the intent of the sender is 1310 impossible to reliably discern. Ambiguous and potentially 1311 exploitable situations could arise if the JSON parser used does not 1312 reject malformed JSON syntax. In particular, any JSON inputs not 1313 conforming to the JSON-text syntax defined in RFC 7159 input MUST be 1314 rejected in their entirety. 1316 Section 4 of the JSON Data Interchange Format specification [RFC7159] 1317 states "The names within an object SHOULD be unique", whereas this 1318 specification states that "Header Parameter names within this object 1319 MUST be unique; recipients MUST either reject JWSs with duplicate 1320 Header Parameter names or use a JSON parser that returns only the 1321 lexically last duplicate member name, as specified in Section 15.12 1322 (The JSON Object) of ECMAScript 5.1 [ECMAScript]". Thus, this 1323 specification requires that the Section 4 "SHOULD" be treated as a 1324 "MUST" by senders and that it be either treated as a "MUST" or in the 1325 manner specified in ECMAScript 5.1 by receivers. Ambiguous and 1326 potentially exploitable situations could arise if the JSON parser 1327 used does not enforce the uniqueness of member names or returns an 1328 unpredictable value for duplicate member names. 1330 Some JSON parsers might not reject input that contains extra 1331 significant characters after a valid input. For instance, the input 1332 "{"tag":"value"}ABCD" contains a valid JSON-text object followed by 1333 the extra characters "ABCD". Such input MUST be rejected in its 1334 entirety. 1336 10.13. Unicode Comparison Security Considerations 1338 Header Parameter names and algorithm names are Unicode strings. For 1339 security reasons, the representations of these names must be compared 1340 verbatim after performing any escape processing (as per Section 8.3 1341 of RFC 7159 [RFC7159]). This means, for instance, that these JSON 1342 strings must compare as being equal ("sig", "\u0073ig"), whereas 1343 these must all compare as being not equal to the first set or to each 1344 other ("SIG", "Sig", "si\u0047"). 1346 JSON strings can contain characters outside the Unicode Basic 1347 Multilingual Plane. For instance, the G clef character (U+1D11E) may 1348 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWS 1349 implementations SHOULD ensure that characters outside the Basic 1350 Multilingual Plane are preserved and compared correctly; 1351 alternatively, if this is not possible due to these characters 1352 exercising limitations present in the underlying JSON implementation, 1353 then input containing them MUST be rejected. 1355 11. References 1356 11.1. Normative References 1358 [ECMAScript] 1359 Ecma International, "ECMAScript Language Specification, 1360 5.1 Edition", ECMA 262, June 2011. 1362 [IANA.MediaTypes] 1363 Internet Assigned Numbers Authority (IANA), "MIME Media 1364 Types", 2005. 1366 [ITU.X690.1994] 1367 International Telecommunications Union, "Information 1368 Technology - ASN.1 encoding rules: Specification of Basic 1369 Encoding Rules (BER), Canonical Encoding Rules (CER) and 1370 Distinguished Encoding Rules (DER)", ITU-T Recommendation 1371 X.690, 1994. 1373 [JWA] Jones, M., "JSON Web Algorithms (JWA)", 1374 draft-ietf-jose-json-web-algorithms (work in progress), 1375 September 2014. 1377 [JWK] Jones, M., "JSON Web Key (JWK)", 1378 draft-ietf-jose-json-web-key (work in progress), 1379 September 2014. 1381 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 1382 Mail: Part I: Message Encryption and Authentication 1383 Procedures", RFC 1421, February 1993. 1385 [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1386 Extensions (MIME) Part One: Format of Internet Message 1387 Bodies", RFC 2045, November 1996. 1389 [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail 1390 Extensions (MIME) Part Two: Media Types", RFC 2046, 1391 November 1996. 1393 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1394 Requirement Levels", BCP 14, RFC 2119, March 1997. 1396 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 1398 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 1399 10646", STD 63, RFC 3629, November 2003. 1401 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 1402 Resource Identifier (URI): Generic Syntax", STD 66, 1403 RFC 3986, January 2005. 1405 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 1406 Encodings", RFC 4648, October 2006. 1408 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1409 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 1411 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 1412 Housley, R., and W. Polk, "Internet X.509 Public Key 1413 Infrastructure Certificate and Certificate Revocation List 1414 (CRL) Profile", RFC 5280, May 2008. 1416 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 1417 Verification of Domain-Based Application Service Identity 1418 within Internet Public Key Infrastructure Using X.509 1419 (PKIX) Certificates in the Context of Transport Layer 1420 Security (TLS)", RFC 6125, March 2011. 1422 [RFC6176] Turner, S. and T. Polk, "Prohibiting Secure Sockets Layer 1423 (SSL) Version 2.0", RFC 6176, March 2011. 1425 [RFC7159] Bray, T., "The JavaScript Object Notation (JSON) Data 1426 Interchange Format", RFC 7159, March 2014. 1428 [USASCII] American National Standards Institute, "Coded Character 1429 Set -- 7-bit American Standard Code for Information 1430 Interchange", ANSI X3.4, 1986. 1432 11.2. Informative References 1434 [CanvasApp] 1435 Facebook, "Canvas Applications", 2010. 1437 [I-D.ietf-uta-tls-bcp] 1438 Sheffer, Y., Holz, R., and P. Saint-Andre, 1439 "Recommendations for Secure Use of TLS and DTLS", 1440 draft-ietf-uta-tls-bcp-03 (work in progress), 1441 September 2014. 1443 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 1444 September 2010. 1446 [JWE] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 1447 draft-ietf-jose-json-web-encryption (work in progress), 1448 September 2014. 1450 [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token 1451 (JWT)", draft-ietf-oauth-json-web-token (work in 1452 progress), September 2014. 1454 [MagicSignatures] 1455 Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic 1456 Signatures", January 2011. 1458 [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC: Keyed- 1459 Hashing for Message Authentication", RFC 2104, 1460 February 1997. 1462 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 1463 Standards (PKCS) #1: RSA Cryptography Specifications 1464 Version 2.1", RFC 3447, February 2003. 1466 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 1467 Requirements for Security", BCP 106, RFC 4086, June 2005. 1469 [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally 1470 Unique IDentifier (UUID) URN Namespace", RFC 4122, 1471 July 2005. 1473 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1474 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1475 May 2008. 1477 [RFC6211] Schaad, J., "Cryptographic Message Syntax (CMS) Algorithm 1478 Identifier Protection Attribute", RFC 6211, April 2011. 1480 [SHS] National Institute of Standards and Technology, "Secure 1481 Hash Standard (SHS)", FIPS PUB 180-4, March 2012. 1483 [W3C.NOTE-xmldsig-bestpractices-20130411] 1484 Hirsch, F. and P. Datta, "XML Signature Best Practices", 1485 World Wide Web Consortium Note NOTE-xmldsig-bestpractices- 1486 20130411, April 2013, . 1489 [W3C.NOTE-xmldsig-core2-20130411] 1490 Eastlake, D., Reagle, J., Solo, D., Hirsch, F., Roessler, 1491 T., Yiu, K., Datta, P., and S. Cantor, "XML Signature 1492 Syntax and Processing Version 2.0", World Wide Web 1493 Consortium Note NOTE-xmldsig-core2-20130411, April 2013, 1494 . 1496 Appendix A. JWS Examples 1498 This section provides several examples of JWSs. While the first 1499 three examples all represent JSON Web Tokens (JWTs) [JWT], the 1500 payload can be any octet sequence, as shown in Appendix A.4. 1502 A.1. Example JWS using HMAC SHA-256 1504 A.1.1. Encoding 1506 The following example JWS Protected Header declares that the data 1507 structure is a JSON Web Token (JWT) [JWT] and the JWS Signing Input 1508 is secured using the HMAC SHA-256 algorithm. 1510 {"typ":"JWT", 1511 "alg":"HS256"} 1513 To remove potential ambiguities in the representation of the JSON 1514 object above, the actual octet sequence representing UTF8(JWS 1515 Protected Header) used in this example is also included below. (Note 1516 that ambiguities can arise due to differing platform representations 1517 of line breaks (CRLF versus LF), differing spacing at the beginning 1518 and ends of lines, whether the last line has a terminating line break 1519 or not, and other causes. In the representation used in this 1520 example, the first line has no leading or trailing spaces, a CRLF 1521 line break (13, 10) occurs between the first and second lines, the 1522 second line has one leading space (32) and no trailing spaces, and 1523 the last line does not have a terminating line break.) The octets 1524 representing UTF8(JWS Protected Header) in this example (using JSON 1525 array notation) are: 1527 [123, 34, 116, 121, 112, 34, 58, 34, 74, 87, 84, 34, 44, 13, 10, 32, 1528 34, 97, 108, 103, 34, 58, 34, 72, 83, 50, 53, 54, 34, 125] 1530 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1531 Header)) gives this value: 1533 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1535 The JWS Payload used in this example is the octets of the UTF-8 1536 representation of the JSON object below. (Note that the payload can 1537 be any base64url encoded octet sequence, and need not be a base64url 1538 encoded JSON object.) 1540 {"iss":"joe", 1541 "exp":1300819380, 1542 "http://example.com/is_root":true} 1544 The following octet sequence, which is the UTF-8 representation used 1545 in this example for the JSON object above, is the JWS Payload: 1547 [123, 34, 105, 115, 115, 34, 58, 34, 106, 111, 101, 34, 44, 13, 10, 1548 32, 34, 101, 120, 112, 34, 58, 49, 51, 48, 48, 56, 49, 57, 51, 56, 1549 48, 44, 13, 10, 32, 34, 104, 116, 116, 112, 58, 47, 47, 101, 120, 97, 1550 109, 112, 108, 101, 46, 99, 111, 109, 47, 105, 115, 95, 114, 111, 1551 111, 116, 34, 58, 116, 114, 117, 101, 125] 1553 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1554 Header)) gives this value (with line breaks for display purposes 1555 only): 1557 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1558 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1560 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1561 BASE64URL(JWS Payload) gives this string (with line breaks for 1562 display purposes only): 1564 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1565 . 1566 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1567 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1569 The resulting JWS Signing Input value, which is the ASCII 1570 representation of above string, is the following octet sequence 1571 (using JSON array notation): 1573 [101, 121, 74, 48, 101, 88, 65, 105, 79, 105, 74, 75, 86, 49, 81, 1574 105, 76, 65, 48, 75, 73, 67, 74, 104, 98, 71, 99, 105, 79, 105, 74, 1575 73, 85, 122, 73, 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 1576 77, 105, 79, 105, 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 1577 74, 108, 101, 72, 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 1578 107, 122, 79, 68, 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 1579 72, 65, 54, 76, 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 1580 109, 78, 118, 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 1581 106, 112, 48, 99, 110, 86, 108, 102, 81] 1583 HMACs are generated using keys. This example uses the symmetric key 1584 represented in JSON Web Key [JWK] format below (with line breaks 1585 within values for display purposes only): 1587 {"kty":"oct", 1588 "k":"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75 1589 aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" 1590 } 1592 Running the HMAC SHA-256 algorithm on the JWS Signing Input with this 1593 key yields this JWS Signature octet sequence: 1595 [116, 24, 223, 180, 151, 153, 224, 37, 79, 250, 96, 125, 216, 173, 1596 187, 186, 22, 212, 37, 77, 105, 214, 191, 240, 91, 88, 5, 88, 83, 1597 132, 141, 121] 1598 Encoding this JWS Signature as BASE64URL(JWS Signature) gives this 1599 value: 1601 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1603 Concatenating these values in the order Header.Payload.Signature with 1604 period ('.') characters between the parts yields this complete JWS 1605 representation using the JWS Compact Serialization (with line breaks 1606 for display purposes only): 1608 eyJ0eXAiOiJKV1QiLA0KICJhbGciOiJIUzI1NiJ9 1609 . 1610 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1611 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1612 . 1613 dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk 1615 A.1.2. Validating 1617 Since the "alg" Header Parameter is "HS256", we validate the HMAC 1618 SHA-256 value contained in the JWS Signature. 1620 To validate the HMAC value, we repeat the previous process of using 1621 the correct key and the JWS Signing Input (which is the initial 1622 substring of the JWS Compact Serialization representation up until 1623 but not including the second period character) as input to the HMAC 1624 SHA-256 function and then taking the output and determining if it 1625 matches the JWS Signature (which is base64url decoded from the value 1626 encoded in the JWS representation). If it matches exactly, the HMAC 1627 has been validated. 1629 A.2. Example JWS using RSASSA-PKCS-v1_5 SHA-256 1631 A.2.1. Encoding 1633 The JWS Protected Header in this example is different from the 1634 previous example in two ways: First, because a different algorithm is 1635 being used, the "alg" value is different. Second, for illustration 1636 purposes only, the optional "typ" parameter is not used. (This 1637 difference is not related to the algorithm employed.) The JWS 1638 Protected Header used is: 1640 {"alg":"RS256"} 1642 The octets representing UTF8(JWS Protected Header) in this example 1643 (using JSON array notation) are: 1645 [123, 34, 97, 108, 103, 34, 58, 34, 82, 83, 50, 53, 54, 34, 125] 1646 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1647 Header)) gives this value: 1649 eyJhbGciOiJSUzI1NiJ9 1651 The JWS Payload used in this example, which follows, is the same as 1652 in the previous example. Since the BASE64URL(JWS Payload) value will 1653 therefore be the same, its computation is not repeated here. 1655 {"iss":"joe", 1656 "exp":1300819380, 1657 "http://example.com/is_root":true} 1659 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1660 BASE64URL(JWS Payload) gives this string (with line breaks for 1661 display purposes only): 1663 eyJhbGciOiJSUzI1NiJ9 1664 . 1665 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1666 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1668 The resulting JWS Signing Input value, which is the ASCII 1669 representation of above string, is the following octet sequence: 1671 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 122, 73, 1672 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1673 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1674 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1675 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1676 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1677 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1678 99, 110, 86, 108, 102, 81] 1680 This example uses the RSA key represented in JSON Web Key [JWK] 1681 format below (with line breaks within values for display purposes 1682 only): 1684 {"kty":"RSA", 1685 "n":"ofgWCuLjybRlzo0tZWJjNiuSfb4p4fAkd_wWJcyQoTbji9k0l8W26mPddx 1686 HmfHQp-Vaw-4qPCJrcS2mJPMEzP1Pt0Bm4d4QlL-yRT-SFd2lZS-pCgNMs 1687 D1W_YpRPEwOWvG6b32690r2jZ47soMZo9wGzjb_7OMg0LOL-bSf63kpaSH 1688 SXndS5z5rexMdbBYUsLA9e-KXBdQOS-UTo7WTBEMa2R2CapHg665xsmtdV 1689 MTBQY4uDZlxvb3qCo5ZwKh9kG4LT6_I5IhlJH7aGhyxXFvUK-DWNmoudF8 1690 NAco9_h9iaGNj8q2ethFkMLs91kzk2PAcDTW9gb54h4FRWyuXpoQ", 1691 "e":"AQAB", 1692 "d":"Eq5xpGnNCivDflJsRQBXHx1hdR1k6Ulwe2JZD50LpXyWPEAeP88vLNO97I 1693 jlA7_GQ5sLKMgvfTeXZx9SE-7YwVol2NXOoAJe46sui395IW_GO-pWJ1O0 1694 BkTGoVEn2bKVRUCgu-GjBVaYLU6f3l9kJfFNS3E0QbVdxzubSu3Mkqzjkn 1695 439X0M_V51gfpRLI9JYanrC4D4qAdGcopV_0ZHHzQlBjudU2QvXt4ehNYT 1696 CBr6XCLQUShb1juUO1ZdiYoFaFQT5Tw8bGUl_x_jTj3ccPDVZFD9pIuhLh 1697 BOneufuBiB4cS98l2SR_RQyGWSeWjnczT0QU91p1DhOVRuOopznQ" 1698 } 1700 The RSA private key is then passed to the RSA signing function, which 1701 also takes the hash type, SHA-256, and the JWS Signing Input as 1702 inputs. The result of the digital signature is an octet sequence, 1703 which represents a big endian integer. In this example, it is: 1705 [112, 46, 33, 137, 67, 232, 143, 209, 30, 181, 216, 45, 191, 120, 69, 1706 243, 65, 6, 174, 27, 129, 255, 247, 115, 17, 22, 173, 209, 113, 125, 1707 131, 101, 109, 66, 10, 253, 60, 150, 238, 221, 115, 162, 102, 62, 81, 1708 102, 104, 123, 0, 11, 135, 34, 110, 1, 135, 237, 16, 115, 249, 69, 1709 229, 130, 173, 252, 239, 22, 216, 90, 121, 142, 232, 198, 109, 219, 1710 61, 184, 151, 91, 23, 208, 148, 2, 190, 237, 213, 217, 217, 112, 7, 1711 16, 141, 178, 129, 96, 213, 248, 4, 12, 167, 68, 87, 98, 184, 31, 1712 190, 127, 249, 217, 46, 10, 231, 111, 36, 242, 91, 51, 187, 230, 244, 1713 74, 230, 30, 177, 4, 10, 203, 32, 4, 77, 62, 249, 18, 142, 212, 1, 1714 48, 121, 91, 212, 189, 59, 65, 238, 202, 208, 102, 171, 101, 25, 129, 1715 253, 228, 141, 247, 127, 55, 45, 195, 139, 159, 175, 221, 59, 239, 1716 177, 139, 93, 163, 204, 60, 46, 176, 47, 158, 58, 65, 214, 18, 202, 1717 173, 21, 145, 18, 115, 160, 95, 35, 185, 232, 56, 250, 175, 132, 157, 1718 105, 132, 41, 239, 90, 30, 136, 121, 130, 54, 195, 212, 14, 96, 69, 1719 34, 165, 68, 200, 242, 122, 122, 45, 184, 6, 99, 209, 108, 247, 202, 1720 234, 86, 222, 64, 92, 178, 33, 90, 69, 178, 194, 85, 102, 181, 90, 1721 193, 167, 72, 160, 112, 223, 200, 163, 42, 70, 149, 67, 208, 25, 238, 1722 251, 71] 1724 Encoding the signature as BASE64URL(JWS Signature) produces this 1725 value (with line breaks for display purposes only): 1727 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1728 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1729 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1730 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1731 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1732 p0igcN_IoypGlUPQGe77Rw 1734 Concatenating these values in the order Header.Payload.Signature with 1735 period ('.') characters between the parts yields this complete JWS 1736 representation using the JWS Compact Serialization (with line breaks 1737 for display purposes only): 1739 eyJhbGciOiJSUzI1NiJ9 1740 . 1741 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1742 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1743 . 1744 cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZmh7 1745 AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjbKBYNX4 1746 BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHlb1L07Qe7K 1747 0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZESc6BfI7noOPqv 1748 hJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AXLIhWkWywlVmtVrB 1749 p0igcN_IoypGlUPQGe77Rw 1751 A.2.2. Validating 1753 Since the "alg" Header Parameter is "RS256", we validate the RSASSA- 1754 PKCS-v1_5 SHA-256 digital signature contained in the JWS Signature. 1756 Validating the JWS Signature is a bit different from the previous 1757 example. We pass the public key (n, e), the JWS Signature (which is 1758 base64url decoded from the value encoded in the JWS representation), 1759 and the JWS Signing Input (which is the initial substring of the JWS 1760 Compact Serialization representation up until but not including the 1761 second period character) to an RSASSA-PKCS-v1_5 signature verifier 1762 that has been configured to use the SHA-256 hash function. 1764 A.3. Example JWS using ECDSA P-256 SHA-256 1766 A.3.1. Encoding 1768 The JWS Protected Header for this example differs from the previous 1769 example because a different algorithm is being used. The JWS 1770 Protected Header used is: 1772 {"alg":"ES256"} 1774 The octets representing UTF8(JWS Protected Header) in this example 1775 (using JSON array notation) are: 1777 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 50, 53, 54, 34, 125] 1779 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1780 Header)) gives this value: 1782 eyJhbGciOiJFUzI1NiJ9 1784 The JWS Payload used in this example, which follows, is the same as 1785 in the previous examples. Since the BASE64URL(JWS Payload) value 1786 will therefore be the same, its computation is not repeated here. 1788 {"iss":"joe", 1789 "exp":1300819380, 1790 "http://example.com/is_root":true} 1792 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1793 BASE64URL(JWS Payload) gives this string (with line breaks for 1794 display purposes only): 1796 eyJhbGciOiJFUzI1NiJ9 1797 . 1798 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1799 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1801 The resulting JWS Signing Input value, which is the ASCII 1802 representation of above string, is the following octet sequence: 1804 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 73, 1805 49, 78, 105, 74, 57, 46, 101, 121, 74, 112, 99, 51, 77, 105, 79, 105, 1806 74, 113, 98, 50, 85, 105, 76, 65, 48, 75, 73, 67, 74, 108, 101, 72, 1807 65, 105, 79, 106, 69, 122, 77, 68, 65, 52, 77, 84, 107, 122, 79, 68, 1808 65, 115, 68, 81, 111, 103, 73, 109, 104, 48, 100, 72, 65, 54, 76, 1809 121, 57, 108, 101, 71, 70, 116, 99, 71, 120, 108, 76, 109, 78, 118, 1810 98, 83, 57, 112, 99, 49, 57, 121, 98, 50, 57, 48, 73, 106, 112, 48, 1811 99, 110, 86, 108, 102, 81] 1813 This example uses the elliptic curve key represented in JSON Web Key 1814 [JWK] format below: 1816 {"kty":"EC", 1817 "crv":"P-256", 1818 "x":"f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU", 1819 "y":"x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0", 1820 "d":"jpsQnnGQmL-YBIffH1136cspYG6-0iY7X1fCE9-E9LI" 1821 } 1823 The ECDSA private part d is then passed to an ECDSA signing function, 1824 which also takes the curve type, P-256, the hash type, SHA-256, and 1825 the JWS Signing Input as inputs. The result of the digital signature 1826 is the EC point (R, S), where R and S are unsigned integers. In this 1827 example, the R and S values, given as octet sequences representing 1828 big endian integers are: 1830 +--------+----------------------------------------------------------+ 1831 | Result | Value | 1832 | Name | | 1833 +--------+----------------------------------------------------------+ 1834 | R | [14, 209, 33, 83, 121, 99, 108, 72, 60, 47, 127, 21, 88, | 1835 | | 7, 212, 2, 163, 178, 40, 3, 58, 249, 124, 126, 23, 129, | 1836 | | 154, 195, 22, 158, 166, 101] | 1837 | S | [197, 10, 7, 211, 140, 60, 112, 229, 216, 241, 45, 175, | 1838 | | 8, 74, 84, 128, 166, 101, 144, 197, 242, 147, 80, 154, | 1839 | | 143, 63, 127, 138, 131, 163, 84, 213] | 1840 +--------+----------------------------------------------------------+ 1842 The JWS Signature is the value R || S. Encoding the signature as 1843 BASE64URL(JWS Signature) produces this value (with line breaks for 1844 display purposes only): 1846 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1847 pmWQxfKTUJqPP3-Kg6NU1Q 1849 Concatenating these values in the order Header.Payload.Signature with 1850 period ('.') characters between the parts yields this complete JWS 1851 representation using the JWS Compact Serialization (with line breaks 1852 for display purposes only): 1854 eyJhbGciOiJFUzI1NiJ9 1855 . 1856 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 1857 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 1858 . 1859 DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8ISlSA 1860 pmWQxfKTUJqPP3-Kg6NU1Q 1862 A.3.2. Validating 1864 Since the "alg" Header Parameter is "ES256", we validate the ECDSA 1865 P-256 SHA-256 digital signature contained in the JWS Signature. 1867 Validating the JWS Signature is a bit different from the previous 1868 examples. We need to split the 64 member octet sequence of the JWS 1869 Signature (which is base64url decoded from the value encoded in the 1870 JWS representation) into two 32 octet sequences, the first 1871 representing R and the second S. We then pass the public key (x, y), 1872 the signature (R, S), and the JWS Signing Input (which is the initial 1873 substring of the JWS Compact Serialization representation up until 1874 but not including the second period character) to an ECDSA signature 1875 verifier that has been configured to use the P-256 curve with the 1876 SHA-256 hash function. 1878 A.4. Example JWS using ECDSA P-521 SHA-512 1880 A.4.1. Encoding 1882 The JWS Protected Header for this example differs from the previous 1883 example because different ECDSA curves and hash functions are used. 1884 The JWS Protected Header used is: 1886 {"alg":"ES512"} 1888 The octets representing UTF8(JWS Protected Header) in this example 1889 (using JSON array notation) are: 1891 [123, 34, 97, 108, 103, 34, 58, 34, 69, 83, 53, 49, 50, 34, 125] 1893 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1894 Header)) gives this value: 1896 eyJhbGciOiJFUzUxMiJ9 1898 The JWS Payload used in this example, is the ASCII string "Payload". 1899 The representation of this string is the octet sequence: 1901 [80, 97, 121, 108, 111, 97, 100] 1903 Encoding this JWS Payload as BASE64URL(JWS Payload) gives this value: 1905 UGF5bG9hZA 1907 Combining these as BASE64URL(UTF8(JWS Protected Header)) || '.' || 1908 BASE64URL(JWS Payload) gives this string: 1910 eyJhbGciOiJFUzUxMiJ9.UGF5bG9hZA 1912 The resulting JWS Signing Input value, which is the ASCII 1913 representation of above string, is the following octet sequence: 1915 [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 70, 85, 122, 85, 1916 120, 77, 105, 74, 57, 46, 85, 71, 70, 53, 98, 71, 57, 104, 90, 65] 1918 This example uses the elliptic curve key represented in JSON Web Key 1919 [JWK] format below (with line breaks within values for display 1920 purposes only): 1922 {"kty":"EC", 1923 "crv":"P-521", 1924 "x":"AekpBQ8ST8a8VcfVOTNl353vSrDCLLJXmPk06wTjxrrjcBpXp5EOnYG_ 1925 NjFZ6OvLFV1jSfS9tsz4qUxcWceqwQGk", 1926 "y":"ADSmRA43Z1DSNx_RvcLI87cdL07l6jQyyBXMoxVg_l2Th-x3S1WDhjDl 1927 y79ajL4Kkd0AZMaZmh9ubmf63e3kyMj2", 1928 "d":"AY5pb7A0UFiB3RELSD64fTLOSV_jazdF7fLYyuTw8lOfRhWg6Y6rUrPA 1929 xerEzgdRhajnu0ferB0d53vM9mE15j2C" 1930 } 1932 The ECDSA private part d is then passed to an ECDSA signing function, 1933 which also takes the curve type, P-521, the hash type, SHA-512, and 1934 the JWS Signing Input as inputs. The result of the digital signature 1935 is the EC point (R, S), where R and S are unsigned integers. In this 1936 example, the R and S values, given as octet sequences representing 1937 big endian integers are: 1939 +--------+----------------------------------------------------------+ 1940 | Result | Value | 1941 | Name | | 1942 +--------+----------------------------------------------------------+ 1943 | R | [1, 220, 12, 129, 231, 171, 194, 209, 232, 135, 233, | 1944 | | 117, 247, 105, 122, 210, 26, 125, 192, 1, 217, 21, 82, | 1945 | | 91, 45, 240, 255, 83, 19, 34, 239, 71, 48, 157, 147, | 1946 | | 152, 105, 18, 53, 108, 163, 214, 68, 231, 62, 153, 150, | 1947 | | 106, 194, 164, 246, 72, 143, 138, 24, 50, 129, 223, 133, | 1948 | | 206, 209, 172, 63, 237, 119, 109] | 1949 | S | [0, 111, 6, 105, 44, 5, 41, 208, 128, 61, 152, 40, 92, | 1950 | | 61, 152, 4, 150, 66, 60, 69, 247, 196, 170, 81, 193, | 1951 | | 199, 78, 59, 194, 169, 16, 124, 9, 143, 42, 142, 131, | 1952 | | 48, 206, 238, 34, 175, 83, 203, 220, 159, 3, 107, 155, | 1953 | | 22, 27, 73, 111, 68, 68, 21, 238, 144, 229, 232, 148, | 1954 | | 188, 222, 59, 242, 103] | 1955 +--------+----------------------------------------------------------+ 1957 The JWS Signature is the value R || S. Encoding the signature as 1958 BASE64URL(JWS Signature) produces this value (with line breaks for 1959 display purposes only): 1961 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1962 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1963 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1965 Concatenating these values in the order Header.Payload.Signature with 1966 period ('.') characters between the parts yields this complete JWS 1967 representation using the JWS Compact Serialization (with line breaks 1968 for display purposes only): 1970 eyJhbGciOiJFUzUxMiJ9 1971 . 1972 UGF5bG9hZA 1973 . 1974 AdwMgeerwtHoh-l192l60hp9wAHZFVJbLfD_UxMi70cwnZOYaRI1bKPWROc-mZZq 1975 wqT2SI-KGDKB34XO0aw_7XdtAG8GaSwFKdCAPZgoXD2YBJZCPEX3xKpRwcdOO8Kp 1976 EHwJjyqOgzDO7iKvU8vcnwNrmxYbSW9ERBXukOXolLzeO_Jn 1978 A.4.2. Validating 1980 Since the "alg" Header Parameter is "ES512", we validate the ECDSA 1981 P-521 SHA-512 digital signature contained in the JWS Signature. 1983 Validating this JWS Signature is very similar to the previous 1984 example. We need to split the 132 member octet sequence of the JWS 1985 Signature into two 66 octet sequences, the first representing R and 1986 the second S. We then pass the public key (x, y), the signature (R, 1987 S), and the JWS Signing Input to an ECDSA signature verifier that has 1988 been configured to use the P-521 curve with the SHA-512 hash 1989 function. 1991 A.5. Example Unsecured JWS 1993 The following example JWS Protected Header declares that the encoded 1994 object is an Unsecured JWS: 1996 {"alg":"none"} 1998 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 1999 Header)) gives this value: 2001 eyJhbGciOiJub25lIn0 2003 The JWS Payload used in this example, which follows, is the same as 2004 in the previous examples. Since the BASE64URL(JWS Payload) value 2005 will therefore be the same, its computation is not repeated here. 2007 {"iss":"joe", 2008 "exp":1300819380, 2009 "http://example.com/is_root":true} 2011 The JWS Signature is the empty octet string and BASE64URL(JWS 2012 Signature) is the empty string. 2014 Concatenating these parts in the order Header.Payload.Signature with 2015 period ('.') characters between the parts yields this complete JWS 2016 (with line breaks for display purposes only): 2018 eyJhbGciOiJub25lIn0 2019 . 2020 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 2021 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 2022 . 2024 A.6. Example JWS Using JWS JSON Serialization 2026 This section contains an example using the JWS JSON Serialization. 2027 This example demonstrates the capability for conveying multiple 2028 digital signatures and/or MACs for the same payload. 2030 The JWS Payload used in this example is the same as that used in the 2031 examples in Appendix A.2 and Appendix A.3 (with line breaks for 2032 display purposes only): 2034 eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGFt 2035 cGxlLmNvbS9pc19yb290Ijp0cnVlfQ 2037 Two digital signatures are used in this example: the first using 2038 RSASSA-PKCS-v1_5 SHA-256 and the second using ECDSA P-256 SHA-256. 2039 For the first, the JWS Protected Header and key are the same as in 2040 Appendix A.2, resulting in the same JWS Signature value; therefore, 2041 its computation is not repeated here. For the second, the JWS 2042 Protected Header and key are the same as in Appendix A.3, resulting 2043 in the same JWS Signature value; therefore, its computation is not 2044 repeated here. 2046 A.6.1. JWS Per-Signature Protected Headers 2048 The JWS Protected Header value used for the first signature is: 2050 {"alg":"RS256"} 2052 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 2053 Header)) gives this value: 2055 eyJhbGciOiJSUzI1NiJ9 2057 The JWS Protected Header value used for the second signature is: 2059 {"alg":"ES256"} 2061 Encoding this JWS Protected Header as BASE64URL(UTF8(JWS Protected 2062 Header)) gives this value: 2064 eyJhbGciOiJFUzI1NiJ9 2066 A.6.2. JWS Per-Signature Unprotected Headers 2068 Key ID values are supplied for both keys using per-signature Header 2069 Parameters. The two values used to represent these Key IDs are: 2071 {"kid":"2010-12-29"} 2073 and 2075 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 2077 A.6.3. Complete JOSE Header Values 2079 Combining the protected and unprotected header values supplied, the 2080 JOSE Header values used for the first and second signatures 2081 respectively are: 2083 {"alg":"RS256", 2084 "kid":"2010-12-29"} 2086 and 2088 {"alg":"ES256", 2089 "kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"} 2091 A.6.4. Complete JWS JSON Serialization Representation 2093 The complete JSON Web Signature JSON Serialization for these values 2094 is as follows (with line breaks within values for display purposes 2095 only): 2097 {"payload": 2098 "eyJpc3MiOiJqb2UiLA0KICJleHAiOjEzMDA4MTkzODAsDQogImh0dHA6Ly9leGF 2099 tcGxlLmNvbS9pc19yb290Ijp0cnVlfQ", 2100 "signatures":[ 2101 {"protected":"eyJhbGciOiJSUzI1NiJ9", 2102 "header": 2103 {"kid":"2010-12-29"}, 2104 "signature": 2105 "cC4hiUPoj9Eetdgtv3hF80EGrhuB__dzERat0XF9g2VtQgr9PJbu3XOiZj5RZ 2106 mh7AAuHIm4Bh-0Qc_lF5YKt_O8W2Fp5jujGbds9uJdbF9CUAr7t1dnZcAcQjb 2107 KBYNX4BAynRFdiuB--f_nZLgrnbyTyWzO75vRK5h6xBArLIARNPvkSjtQBMHl 2108 b1L07Qe7K0GarZRmB_eSN9383LcOLn6_dO--xi12jzDwusC-eOkHWEsqtFZES 2109 c6BfI7noOPqvhJ1phCnvWh6IeYI2w9QOYEUipUTI8np6LbgGY9Fs98rqVt5AX 2110 LIhWkWywlVmtVrBp0igcN_IoypGlUPQGe77Rw"}, 2111 {"protected":"eyJhbGciOiJFUzI1NiJ9", 2112 "header": 2113 {"kid":"e9bc097a-ce51-4036-9562-d2ade882db0d"}, 2114 "signature": 2115 "DtEhU3ljbEg8L38VWAfUAqOyKAM6-Xx-F4GawxaepmXFCgfTjDxw5djxLa8IS 2116 lSApmWQxfKTUJqPP3-Kg6NU1Q"}] 2117 } 2119 Appendix B. "x5c" (X.509 Certificate Chain) Example 2121 The JSON array below is an example of a certificate chain that could 2122 be used as the value of an "x5c" (X.509 Certificate Chain) Header 2123 Parameter, per Section 4.1.6. Note that since these strings contain 2124 base64 encoded (not base64url encoded) values, they are allowed to 2125 contain white space and line breaks. 2127 ["MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVM 2128 xITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR2 2129 8gRGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExM 2130 TYwMTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UE 2131 CBMHQXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWR 2132 keS5jb20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYW 2133 RkeS5jb20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlc 2134 nRpZmljYXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJ 2135 KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTt 2136 wY6vj3D3HKrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqV 2137 Tr9vcyOdQmVZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aL 2138 GbqGmu75RpRSgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo 2139 7RJlbmr2EkRTcDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgW 2140 JCJjPOq8lh8BJ6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAw 2141 EAAaOCATIwggEuMB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVH 2142 SMEGDAWgBTSxLDSkdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEA 2143 MDMGCCsGAQUFBwEBBCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWR 2144 keS5jb20wRgYDVR0fBD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2 2145 RhZGR5LmNvbS9yZXBvc2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVH 2146 SAAMDgwNgYIKwYBBQUHAgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j 2147 b20vcmVwb3NpdG9yeTAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggE 2148 BANKGwOy9+aG2Z+5mC6IGOgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPI 2149 UyIXvJxwqoJKSQ3kbTJSMUA2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL 2150 5CkKSkB2XIsKd83ASe8T+5o0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9 2151 p0iRFEUOOjZv2kWzRaJBydTXRE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsx 2152 uxN89txJx9OjxUUAiKEngHUuHqDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZ 2153 EjYx8WnM25sgVjOuH0aBsXBTWVU+4=", 2154 "MIIE+zCCBGSgAwIBAgICAQ0wDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1Z 2155 hbGlDZXJ0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIE 2156 luYy4xNTAzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb 2157 24gQXV0aG9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8x 2158 IDAeBgkqhkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTA0MDYyOTE3MDY 2159 yMFoXDTI0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRoZS 2160 BHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3MgM 2161 iBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN 2162 ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XC 2163 APVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux 2164 6wwdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLO 2165 tXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWo 2166 riMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZ 2167 Eewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjggHhMIIB3TAdBgNVHQ 2168 4EFgQU0sSw0pHUTBFxs2HLPaH+3ahq1OMwgdIGA1UdIwSByjCBx6GBwaSBvjCBu 2169 zEkMCIGA1UEBxMbVmFsaUNlcnQgVmFsaWRhdGlvbiBOZXR3b3JrMRcwFQYDVQQK 2170 Ew5WYWxpQ2VydCwgSW5jLjE1MDMGA1UECxMsVmFsaUNlcnQgQ2xhc3MgMiBQb2x 2171 pY3kgVmFsaWRhdGlvbiBBdXRob3JpdHkxITAfBgNVBAMTGGh0dHA6Ly93d3cudm 2172 FsaWNlcnQuY29tLzEgMB4GCSqGSIb3DQEJARYRaW5mb0B2YWxpY2VydC5jb22CA 2173 QEwDwYDVR0TAQH/BAUwAwEB/zAzBggrBgEFBQcBAQQnMCUwIwYIKwYBBQUHMAGG 2174 F2h0dHA6Ly9vY3NwLmdvZGFkZHkuY29tMEQGA1UdHwQ9MDswOaA3oDWGM2h0dHA 2175 6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS9yb290LmNybD 2176 BLBgNVHSAERDBCMEAGBFUdIAAwODA2BggrBgEFBQcCARYqaHR0cDovL2NlcnRpZ 2177 mljYXRlcy5nb2RhZGR5LmNvbS9yZXBvc2l0b3J5MA4GA1UdDwEB/wQEAwIBBjAN 2178 BgkqhkiG9w0BAQUFAAOBgQC1QPmnHfbq/qQaQlpE9xXUhUaJwL6e4+PrxeNYiY+ 2179 Sn1eocSxI0YGyeR+sBjUZsE4OWBsUs5iB0QQeyAfJg594RAoYC5jcdnplDQ1tgM 2180 QLARzLrUc+cb53S8wGd9D0VmsfSxOaFIqII6hR8INMqzW/Rn453HWkrugp++85j 2181 09VZw==", 2182 "MIIC5zCCAlACAQEwDQYJKoZIhvcNAQEFBQAwgbsxJDAiBgNVBAcTG1ZhbGlDZXJ 2183 0IFZhbGlkYXRpb24gTmV0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNT 2184 AzBgNVBAsTLFZhbGlDZXJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0a 2185 G9yaXR5MSEwHwYDVQQDExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkq 2186 hkiG9w0BCQEWEWluZm9AdmFsaWNlcnQuY29tMB4XDTk5MDYyNjAwMTk1NFoXDTE 2187 5MDYyNjAwMTk1NFowgbsxJDAiBgNVBAcTG1ZhbGlDZXJ0IFZhbGlkYXRpb24gTm 2188 V0d29yazEXMBUGA1UEChMOVmFsaUNlcnQsIEluYy4xNTAzBgNVBAsTLFZhbGlDZ 2189 XJ0IENsYXNzIDIgUG9saWN5IFZhbGlkYXRpb24gQXV0aG9yaXR5MSEwHwYDVQQD 2190 ExhodHRwOi8vd3d3LnZhbGljZXJ0LmNvbS8xIDAeBgkqhkiG9w0BCQEWEWluZm9 2191 AdmFsaWNlcnQuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDOOnHK5a 2192 vIWZJV16vYdA757tn2VUdZZUcOBVXc65g2PFxTXdMwzzjsvUGJ7SVCCSRrCl6zf 2193 N1SLUzm1NZ9WlmpZdRJEy0kTRxQb7XBhVQ7/nHk01xC+YDgkRoKWzk2Z/M/VXwb 2194 P7RfZHM047QSv4dk+NoS/zcnwbNDu+97bi5p9wIDAQABMA0GCSqGSIb3DQEBBQU 2195 AA4GBADt/UG9vUJSZSWI4OB9L+KXIPqeCgfYrx+jFzug6EILLGACOTb2oWH+heQ 2196 C1u+mNr0HZDzTuIYEZoDJJKPTEjlbVUjP9UNV+mWwD5MlM/Mtsq2azSiGM5bUMM 2197 j4QssxsodyamEwCW/POuZ6lcg5Ktz885hZo+L7tdEy8W9ViH0Pd"] 2199 Appendix C. Notes on implementing base64url encoding without padding 2201 This appendix describes how to implement base64url encoding and 2202 decoding functions without padding based upon standard base64 2203 encoding and decoding functions that do use padding. 2205 To be concrete, example C# code implementing these functions is shown 2206 below. Similar code could be used in other languages. 2208 static string base64urlencode(byte [] arg) 2209 { 2210 string s = Convert.ToBase64String(arg); // Regular base64 encoder 2211 s = s.Split('=')[0]; // Remove any trailing '='s 2212 s = s.Replace('+', '-'); // 62nd char of encoding 2213 s = s.Replace('/', '_'); // 63rd char of encoding 2214 return s; 2215 } 2217 static byte [] base64urldecode(string arg) 2218 { 2219 string s = arg; 2220 s = s.Replace('-', '+'); // 62nd char of encoding 2221 s = s.Replace('_', '/'); // 63rd char of encoding 2222 switch (s.Length % 4) // Pad with trailing '='s 2223 { 2224 case 0: break; // No pad chars in this case 2225 case 2: s += "=="; break; // Two pad chars 2226 case 3: s += "="; break; // One pad char 2227 default: throw new System.Exception( 2228 "Illegal base64url string!"); 2229 } 2230 return Convert.FromBase64String(s); // Standard base64 decoder 2231 } 2233 As per the example code above, the number of '=' padding characters 2234 that needs to be added to the end of a base64url encoded string 2235 without padding to turn it into one with padding is a deterministic 2236 function of the length of the encoded string. Specifically, if the 2237 length mod 4 is 0, no padding is added; if the length mod 4 is 2, two 2238 '=' padding characters are added; if the length mod 4 is 3, one '=' 2239 padding character is added; if the length mod 4 is 1, the input is 2240 malformed. 2242 An example correspondence between unencoded and encoded values 2243 follows. The octet sequence below encodes into the string below, 2244 which when decoded, reproduces the octet sequence. 2245 3 236 255 224 193 2246 A-z_4ME 2248 Appendix D. Notes on Key Selection 2250 This appendix describes a set of possible algorithms for selecting 2251 the key to be used to validate the digital signature or MAC of a JWS 2252 object or for selecting the key to be used to decrypt a JWE object. 2253 This guidance describes a family of possible algorithms, rather than 2254 a single algorithm, because in different contexts, not all the 2255 sources of keys will be used, they can be tried in different orders, 2256 and sometimes not all the collected keys will be tried; hence, 2257 different algorithms will be used in different application contexts. 2259 The steps below are described for illustration purposes only; 2260 specific applications can and are likely to use different algorithms 2261 or perform some of the steps in different orders. Specific 2262 applications will frequently have a much simpler method of 2263 determining the keys to use, as there may be one or two key selection 2264 methods that are profiled for the application's use. This appendix 2265 supplements the normative information on key location in Section 6. 2267 These algorithms include the following steps. Note that the steps 2268 can be performed in any order and do not need to be treated as 2269 distinct. For example, keys can be tried as soon as they are found, 2270 rather than collecting all the keys before trying any. 2272 1. Collect the set of potentially applicable keys. Sources of keys 2273 may include: 2275 * Keys supplied by the application protocol being used. 2277 * Keys referenced by the "jku" (JWK Set URL) Header Parameter. 2279 * The key provided by the "jwk" (JSON Web Key) Header Parameter. 2281 * The key referenced by the "x5u" (X.509 URL) Header Parameter. 2283 * The key provided by the "x5c" (X.509 Certificate Chain) Header 2284 Parameter. 2286 * Other applicable keys available to the application. 2288 The order for collecting and trying keys from different key 2289 sources is typically application dependent. For example, 2290 frequently all keys from a one set of locations, such as local 2291 caches, will be tried before collecting and trying keys from 2292 other locations. 2294 2. Filter the set of collected keys. For instance, some 2295 applications will use only keys referenced by "kid" (key ID) or 2296 "x5t" (X.509 certificate SHA-1 thumbprint) parameters. If the 2297 application uses the "alg" (algorithm), "use" (public key use), 2298 or "key_ops" (key operations) parameters, keys with keys with 2299 inappropriate values of those parameters would be excluded. 2300 Additionally, keys might be filtered to include or exclude keys 2301 with certain other member values in an application specific 2302 manner. For some applications, no filtering will be applied. 2304 3. Order the set of collected keys. For instance, keys referenced 2305 by "kid" (Key ID) or "x5t" (X.509 Certificate SHA-1 Thumbprint) 2306 parameters might be tried before keys with neither of these 2307 values. Likewise, keys with certain member values might be 2308 ordered before keys with other member values. For some 2309 applications, no ordering will be applied. 2311 4. Make trust decisions about the keys. Signatures made with keys 2312 not meeting the application's trust criteria would not be 2313 accepted. Such criteria might include, but is not limited to the 2314 source of the key, whether the TLS certificate validates for keys 2315 retrieved from URLs, whether a key in an X.509 certificate is 2316 backed by a valid certificate chain, and other information known 2317 by the application. 2319 5. Attempt signature or MAC validation for a JWS object or 2320 decryption of a JWE object with some or all of the collected and 2321 possibly filtered and/or ordered keys. A limit on the number of 2322 keys to be tried might be applied. This process will normally 2323 terminate following a successful validation or decryption. 2325 Note that it is reasonable for some applications to perform signature 2326 or MAC validation prior to making a trust decision about a key, since 2327 keys for which the validation fails need no trust decision. 2329 Appendix E. Negative Test Case for "crit" Header Parameter 2331 Conforming implementations must reject input containing critical 2332 extensions that are not understood or cannot be processed. The 2333 following JWS must be rejected by all implementations, because it 2334 uses an extension Header Parameter name 2335 "http://example.invalid/UNDEFINED" that they do not understand. Any 2336 other similar input, in which the use of the value 2337 "http://example.invalid/UNDEFINED" is substituted for any other 2338 Header Parameter name not understood by the implementation, must also 2339 be rejected. 2341 The JWS Protected Header value for this JWS is: 2343 {"alg":"none", 2344 "crit":["http://example.invalid/UNDEFINED"], 2345 "http://example.invalid/UNDEFINED":true 2346 } 2348 The complete JWS that must be rejected is as follows (with line 2349 breaks for display purposes only): 2351 eyJhbGciOiJub25lIiwNCiAiY3JpdCI6WyJodHRwOi8vZXhhbXBsZS5jb20vVU5ERU 2352 ZJTkVEIl0sDQogImh0dHA6Ly9leGFtcGxlLmNvbS9VTkRFRklORUQiOnRydWUNCn0. 2353 RkFJTA. 2355 Appendix F. Detached Content 2357 In some contexts, it is useful integrity protect content that is not 2358 itself contained in a JWS object. One way to do this is create a JWS 2359 object in the normal fashion using a representation of the content as 2360 the payload, but then delete the payload representation from the JWS, 2361 and send this modified object to the recipient, rather than the JWS. 2362 When using the JWS Compact Serialization, the deletion is 2363 accomplished by replacing the second field (which contains 2364 BASE64URL(JWS Payload)) value with the empty string; when using the 2365 JWS JSON Serialization, the deletion is accomplished by deleting the 2366 "payload" member. This method assumes that the recipient can 2367 reconstruct the exact payload used in the JWS. To use the modified 2368 object, the recipient reconstructs the JWS by re-inserting the 2369 payload representation into the modified object, and uses the 2370 resulting JWS in the usual manner. Note that this method needs no 2371 support from JWS libraries, as applications can use this method by 2372 modifying the inputs and outputs of standard JWS libraries. 2374 Appendix G. Acknowledgements 2376 Solutions for signing JSON content were previously explored by Magic 2377 Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas 2378 Applications [CanvasApp], all of which influenced this draft. 2380 Thanks to Axel Nennker for his early implementation and feedback on 2381 the JWS and JWE specifications. 2383 This specification is the work of the JOSE Working Group, which 2384 includes dozens of active and dedicated participants. In particular, 2385 the following individuals contributed ideas, feedback, and wording 2386 that influenced this specification: 2388 Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick 2389 Hardt, Joe Hildebrand, Jeff Hodges, Russ Housley, Edmund Jay, Tero 2390 Kivinen, Yaron Y. Goland, Ben Laurie, James Manger, Matt Miller, 2391 Kathleen Moriarty, Tony Nadalin, Hideki Nara, Axel Nennker, John 2392 Panzer, Emmanuel Raviart, Eric Rescorla, Jim Schaad, Paul Tarjan, 2393 Hannes Tschofenig, and Sean Turner. 2395 Jim Schaad and Karen O'Donoghue chaired the JOSE working group and 2396 Sean Turner, Stephen Farrell, and Kathleen Moriarty served as 2397 Security area directors during the creation of this specification. 2399 Appendix H. Document History 2401 [[ to be removed by the RFC Editor before publication as an RFC ]] 2403 -33 2405 o Noted that certificate thumbprints are also sometimes known as 2406 certificate fingerprints. 2408 o Added an informative reference to draft-ietf-uta-tls-bcp for 2409 recommendations on improving the security of software and services 2410 using TLS. 2412 o Changed the registration review period to three weeks. 2414 o Acknowledged additional contributors. 2416 -32 2418 o Addressed Gen-ART review comments by Russ Housley. 2420 o Addressed secdir review comments by Tero Kivinen, Stephen Kent, 2421 and Scott Kelly. 2423 o Replaced the term Plaintext JWS with Unsecured JWS. 2425 -31 2426 o Reworded the language about JWS implementations ignoring the "typ" 2427 and "cty" parameters, explicitly saying that their processing is 2428 performed by JWS applications. 2430 o Added additional guidance on ciphersuites currently considered to 2431 be appropriate for use, including a reference to a recent update 2432 by the TLS working group. 2434 -30 2436 o Added subsection headings within the Overview section for the two 2437 serializations. 2439 o Added references and cleaned up the reference syntax in a few 2440 places. 2442 o Applied minor wording changes to the Security Considerations 2443 section and made other local editorial improvements. 2445 -29 2447 o Replaced the terms JWS Header, JWE Header, and JWT Header with a 2448 single JOSE Header term defined in the JWS specification. This 2449 also enabled a single Header Parameter definition to be used and 2450 reduced other areas of duplication between specifications. 2452 -28 2454 o Revised the introduction to the Security Considerations section. 2455 Also introduced additional subsection headings for security 2456 considerations items and also moved a security consideration item 2457 here from the JWA draft. 2459 o Added text about when applications typically would and would not 2460 use "typ" and "cty" header parameters. 2462 -27 2464 o Added the "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) header 2465 parameter. 2467 o Stated that any JSON inputs not conforming to the JSON-text syntax 2468 defined in RFC 7159 input MUST be rejected in their entirety. 2470 o Simplified the TLS requirements. 2472 -26 2473 o Referenced Section 6 of RFC 6125 for TLS server certificate 2474 identity validation. 2476 o Described potential sources of ambiguity in representing the JSON 2477 objects used in the examples. The octets of the actual UTF-8 2478 representations of the JSON objects used in the examples are 2479 included to remove these ambiguities. 2481 o Added a small amount of additional explanatory text to the 2482 signature validation examples to aid implementers. 2484 o Noted that octet sequences are depicted using JSON array notation. 2486 o Updated references, including to W3C specifications. 2488 -25 2490 o No changes were made, other than to the version number and date. 2492 -24 2494 o Updated the JSON reference to RFC 7159. 2496 -23 2498 o Clarified that the base64url encoding includes no line breaks, 2499 white space, or other additional characters. 2501 -22 2503 o Corrected RFC 2119 terminology usage. 2505 o Replaced references to draft-ietf-json-rfc4627bis with RFC 7158. 2507 -21 2509 o Applied review comments to the appendix "Notes on Key Selection", 2510 addressing issue #93. 2512 o Changed some references from being normative to informative, 2513 addressing issue #90. 2515 o Applied review comments to the JSON Serialization section, 2516 addressing issue #121. 2518 -20 2519 o Made terminology definitions more consistent, addressing issue 2520 #165. 2522 o Restructured the JSON Serialization section to call out the 2523 parameters used in hanging lists, addressing issue #121. 2525 o Described key filtering and refined other aspects of the text in 2526 the appendix "Notes on Key Selection", addressing issue #93. 2528 o Replaced references to RFC 4627 with draft-ietf-json-rfc4627bis, 2529 addressing issue #90. 2531 -19 2533 o Added the appendix "Notes on Validation Key Selection", addressing 2534 issue #93. 2536 o Reordered the key selection parameters. 2538 -18 2540 o Updated the mandatory-to-implement (MTI) language to say that 2541 applications using this specification need to specify what 2542 serialization and serialization features are used for that 2543 application, addressing issue #119. 2545 o Changes to address editorial and minor issues #25, #89, #97, #110, 2546 #114, #115, #116, #117, #120, and #184. 2548 o Added and used Header Parameter Description registry field. 2550 -17 2552 o Refined the "typ" and "cty" definitions to always be MIME Media 2553 Types, with the omission of "application/" prefixes recommended 2554 for brevity, addressing issue #50. 2556 o Updated the mandatory-to-implement (MTI) language to say that 2557 general-purpose implementations must implement the single 2558 signature/MAC value case for both serializations whereas special- 2559 purpose implementations can implement just one serialization if 2560 that meets the needs of the use cases the implementation is 2561 designed for, addressing issue #119. 2563 o Explicitly named all the logical components of a JWS and defined 2564 the processing rules and serializations in terms of those 2565 components, addressing issues #60, #61, and #62. 2567 o Replaced verbose repetitive phases such as "base64url encode the 2568 octets of the UTF-8 representation of X" with mathematical 2569 notation such as "BASE64URL(UTF8(X))". 2571 o Terms used in multiple documents are now defined in one place and 2572 incorporated by reference. Some lightly used or obvious terms 2573 were also removed. This addresses issue #58. 2575 -16 2577 o Changes to address editorial and minor issues #50, #98, #99, #102, 2578 #104, #106, #107, #111, and #112. 2580 -15 2582 o Clarified that it is an application decision which signatures, 2583 MACs, or plaintext values must successfully validate for the JWS 2584 to be accepted, addressing issue #35. 2586 o Corrected editorial error in "ES512" example. 2588 o Changes to address editorial and minor issues #34, #96, #100, 2589 #101, #104, #105, and #106. 2591 -14 2593 o Stated that the "signature" parameter is to be omitted in the JWS 2594 JSON Serialization when its value would be empty (which is only 2595 the case for a Plaintext JWS). 2597 -13 2599 o Made all header parameter values be per-signature/MAC, addressing 2600 issue #24. 2602 -12 2604 o Clarified that the "typ" and "cty" header parameters are used in 2605 an application-specific manner and have no effect upon the JWS 2606 processing. 2608 o Replaced the MIME types "application/jws+json" and 2609 "application/jws" with "application/jose+json" and 2610 "application/jose". 2612 o Stated that recipients MUST either reject JWSs with duplicate 2613 Header Parameter Names or use a JSON parser that returns only the 2614 lexically last duplicate member name. 2616 o Added a Serializations section with parallel treatment of the JWS 2617 Compact Serialization and the JWS JSON Serialization and also 2618 moved the former Implementation Considerations content there. 2620 -11 2622 o Added Key Identification section. 2624 o For the JWS JSON Serialization, enable header parameter values to 2625 be specified in any of three parameters: the "protected" member 2626 that is integrity protected and shared among all recipients, the 2627 "unprotected" member that is not integrity protected and shared 2628 among all recipients, and the "header" member that is not 2629 integrity protected and specific to a particular recipient. (This 2630 does not affect the JWS Compact Serialization, in which all header 2631 parameter values are in a single integrity protected JWE Header 2632 value.) 2634 o Removed suggested compact serialization for multiple digital 2635 signatures and/or MACs. 2637 o Changed the MIME type name "application/jws-js" to 2638 "application/jws+json", addressing issue #22. 2640 o Tightened the description of the "crit" (critical) header 2641 parameter. 2643 o Added a negative test case for the "crit" header parameter 2645 -10 2647 o Added an appendix suggesting a possible compact serialization for 2648 JWSs with multiple digital signatures and/or MACs. 2650 -09 2652 o Added JWS JSON Serialization, as specified by 2653 draft-jones-jose-jws-json-serialization-04. 2655 o Registered "application/jws-js" MIME type and "JWS-JS" typ header 2656 parameter value. 2658 o Defined that the default action for header parameters that are not 2659 understood is to ignore them unless specifically designated as 2660 "MUST be understood" or included in the new "crit" (critical) 2661 header parameter list. This addressed issue #6. 2663 o Changed term "JWS Secured Input" to "JWS Signing Input". 2665 o Changed from using the term "byte" to "octet" when referring to 8 2666 bit values. 2668 o Changed member name from "recipients" to "signatures" in the JWS 2669 JSON Serialization. 2671 o Added complete values using the JWS Compact Serialization for all 2672 examples. 2674 -08 2676 o Applied editorial improvements suggested by Jeff Hodges and Hannes 2677 Tschofenig. Many of these simplified the terminology used. 2679 o Clarified statements of the form "This header parameter is 2680 OPTIONAL" to "Use of this header parameter is OPTIONAL". 2682 o Added a Header Parameter Usage Location(s) field to the IANA JSON 2683 Web Signature and Encryption Header Parameters registry. 2685 o Added seriesInfo information to Internet Draft references. 2687 -07 2689 o Updated references. 2691 -06 2693 o Changed "x5c" (X.509 Certificate Chain) representation from being 2694 a single string to being an array of strings, each containing a 2695 single base64 encoded DER certificate value, representing elements 2696 of the certificate chain. 2698 o Applied changes made by the RFC Editor to RFC 6749's registry 2699 language to this specification. 2701 -05 2703 o Added statement that "StringOrURI values are compared as case- 2704 sensitive strings with no transformations or canonicalizations 2705 applied". 2707 o Indented artwork elements to better distinguish them from the body 2708 text. 2710 -04 2711 o Completed JSON Security Considerations section, including 2712 considerations about rejecting input with duplicate member names. 2714 o Completed security considerations on the use of a SHA-1 hash when 2715 computing "x5t" (x.509 certificate thumbprint) values. 2717 o Refer to the registries as the primary sources of defined values 2718 and then secondarily reference the sections defining the initial 2719 contents of the registries. 2721 o Normatively reference XML DSIG 2.0 for its security 2722 considerations. 2724 o Added this language to Registration Templates: "This name is case 2725 sensitive. Names that match other registered names in a case 2726 insensitive manner SHOULD NOT be accepted." 2728 o Reference draft-jones-jose-jws-json-serialization instead of 2729 draft-jones-json-web-signature-json-serialization. 2731 o Described additional open issues. 2733 o Applied editorial suggestions. 2735 -03 2737 o Added the "cty" (content type) header parameter for declaring type 2738 information about the secured content, as opposed to the "typ" 2739 (type) header parameter, which declares type information about 2740 this object. 2742 o Added "Collision Resistant Namespace" to the terminology section. 2744 o Reference ITU.X690.1994 for DER encoding. 2746 o Added an example JWS using ECDSA P-521 SHA-512. This has 2747 particular illustrative value because of the use of the 521 bit 2748 integers in the key and signature values. This is also an example 2749 in which the payload is not a base64url encoded JSON object. 2751 o Added an example "x5c" value. 2753 o No longer say "the UTF-8 representation of the JWS Secured Input 2754 (which is the same as the ASCII representation)". Just call it 2755 "the ASCII representation of the JWS Secured Input". 2757 o Added Registration Template sections for defined registries. 2759 o Added Registry Contents sections to populate registry values. 2761 o Changed name of the JSON Web Signature and Encryption "typ" Values 2762 registry to be the JSON Web Signature and Encryption Type Values 2763 registry, since it is used for more than just values of the "typ" 2764 parameter. 2766 o Moved registries JSON Web Signature and Encryption Header 2767 Parameters and JSON Web Signature and Encryption Type Values to 2768 the JWS specification. 2770 o Numerous editorial improvements. 2772 -02 2774 o Clarified that it is an error when a "kid" value is included and 2775 no matching key is found. 2777 o Removed assumption that "kid" (key ID) can only refer to an 2778 asymmetric key. 2780 o Clarified that JWSs with duplicate Header Parameter Names MUST be 2781 rejected. 2783 o Clarified the relationship between "typ" header parameter values 2784 and MIME types. 2786 o Registered application/jws MIME type and "JWS" typ header 2787 parameter value. 2789 o Simplified JWK terminology to get replace the "JWK Key Object" and 2790 "JWK Container Object" terms with simply "JSON Web Key (JWK)" and 2791 "JSON Web Key Set (JWK Set)" and to eliminate potential confusion 2792 between single keys and sets of keys. As part of this change, the 2793 Header Parameter Name for a public key value was changed from 2794 "jpk" (JSON Public Key) to "jwk" (JSON Web Key). 2796 o Added suggestion on defining additional header parameters such as 2797 "x5t#S256" in the future for certificate thumbprints using hash 2798 algorithms other than SHA-1. 2800 o Specify RFC 2818 server identity validation, rather than RFC 6125 2801 (paralleling the same decision in the OAuth specs). 2803 o Generalized language to refer to Message Authentication Codes 2804 (MACs) rather than Hash-based Message Authentication Codes (HMACs) 2805 unless in a context specific to HMAC algorithms. 2807 o Reformatted to give each header parameter its own section heading. 2809 -01 2811 o Moved definition of Plaintext JWSs (using "alg":"none") here from 2812 the JWT specification since this functionality is likely to be 2813 useful in more contexts that just for JWTs. 2815 o Added "jpk" and "x5c" header parameters for including JWK public 2816 keys and X.509 certificate chains directly in the header. 2818 o Clarified that this specification is defining the JWS Compact 2819 Serialization. Referenced the new JWS-JS spec, which defines the 2820 JWS JSON Serialization. 2822 o Added text "New header parameters should be introduced sparingly 2823 since an implementation that does not understand a parameter MUST 2824 reject the JWS". 2826 o Clarified that the order of the creation and validation steps is 2827 not significant in cases where there are no dependencies between 2828 the inputs and outputs of the steps. 2830 o Changed "no canonicalization is performed" to "no canonicalization 2831 need be performed". 2833 o Corrected the Magic Signatures reference. 2835 o Made other editorial improvements suggested by JOSE working group 2836 participants. 2838 -00 2840 o Created the initial IETF draft based upon 2841 draft-jones-json-web-signature-04 with no normative changes. 2843 o Changed terminology to no longer call both digital signatures and 2844 HMACs "signatures". 2846 Authors' Addresses 2848 Michael B. Jones 2849 Microsoft 2851 Email: mbj@microsoft.com 2852 URI: http://self-issued.info/ 2853 John Bradley 2854 Ping Identity 2856 Email: ve7jtb@ve7jtb.com 2857 URI: http://www.thread-safe.com/ 2859 Nat Sakimura 2860 Nomura Research Institute 2862 Email: n-sakimura@nri.co.jp 2863 URI: http://nat.sakimura.org/