idnits 2.17.00 (12 Aug 2021) /tmp/idnits51929/draft-ietf-jose-json-web-encryption-00.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 (January 16, 2012) is 3777 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) -- Possible downref: Non-RFC (?) normative reference: ref. 'JWA' -- Possible downref: Non-RFC (?) normative reference: ref. 'JWK' -- Possible downref: Non-RFC (?) normative reference: ref. 'JWS' -- Possible downref: Non-RFC (?) normative reference: ref. 'NIST-800-38D' ** Downref: Normative reference to an Historic RFC: RFC 1421 ** Obsolete normative reference: RFC 1738 (Obsoleted by RFC 4248, RFC 4266) ** Downref: Normative reference to an Informational RFC: RFC 1952 ** Downref: Normative reference to an Informational RFC: RFC 2818 ** Obsolete normative reference: RFC 4627 (Obsoleted by RFC 7158, RFC 7159) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 5246 (Obsoleted by RFC 8446) ** Downref: Normative reference to an Informational RFC: RFC 6090 Summary: 8 errors (**), 0 flaws (~~), 1 warning (==), 5 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 E. Rescorla 5 Expires: July 19, 2012 RTFM, Inc. 6 J. Hildebrand 7 Cisco Systems, Inc. 8 January 16, 2012 10 JSON Web Encryption (JWE) 11 draft-ietf-jose-json-web-encryption-00 13 Abstract 15 JSON Web Encryption (JWE) is a means of representing encrypted 16 content using JSON data structures. Cryptographic algorithms and 17 identifiers used with this specification are enumerated in the 18 separate JSON Web Algorithms (JWA) specification. Related digital 19 signature and HMAC capabilities are described in the separate JSON 20 Web Signature (JWS) specification. 22 Requirements Language 24 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 25 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 26 document are to be interpreted as described in RFC 2119 [RFC2119]. 28 Status of this Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at http://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on July 19, 2012. 45 Copyright Notice 47 Copyright (c) 2012 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents 52 (http://trustee.ietf.org/license-info) in effect on the date of 53 publication of this document. Please review these documents 54 carefully, as they describe your rights and restrictions with respect 55 to this document. Code Components extracted from this document must 56 include Simplified BSD License text as described in Section 4.e of 57 the Trust Legal Provisions and are provided without warranty as 58 described in the Simplified BSD License. 60 Table of Contents 62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 63 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 64 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 4 65 3.1. Example JWE . . . . . . . . . . . . . . . . . . . . . . . 4 66 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 5 67 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 5 68 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 10 69 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 10 70 5. Message Encryption . . . . . . . . . . . . . . . . . . . . . . 10 71 6. Message Decryption . . . . . . . . . . . . . . . . . . . . . . 11 72 7. CEK Encryption . . . . . . . . . . . . . . . . . . . . . . . . 12 73 7.1. Asymmetric Encryption . . . . . . . . . . . . . . . . . . 12 74 7.2. Symmetric Encryption . . . . . . . . . . . . . . . . . . . 12 75 8. Composition . . . . . . . . . . . . . . . . . . . . . . . . . 12 76 9. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 12 77 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 78 11. Security Considerations . . . . . . . . . . . . . . . . . . . 13 79 11.1. Unicode Comparison Security Issues . . . . . . . . . . . . 14 80 12. Open Issues and Things To Be Done (TBD) . . . . . . . . . . . 14 81 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 15 82 13.1. Normative References . . . . . . . . . . . . . . . . . . . 15 83 13.2. Informative References . . . . . . . . . . . . . . . . . . 17 84 Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 17 85 A.1. JWE Example using TBD Algorithm . . . . . . . . . . . . . 17 86 A.1.1. Encrypting . . . . . . . . . . . . . . . . . . . . . . 17 87 A.1.2. Decrypting . . . . . . . . . . . . . . . . . . . . . . 17 88 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 17 89 Appendix C. Document History . . . . . . . . . . . . . . . . . . 18 90 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 18 92 1. Introduction 94 JSON Web Encryption (JWE) is a compact encryption format intended for 95 space constrained environments such as HTTP Authorization headers and 96 URI query parameters. It provides a wrapper for encrypted content 97 using JSON RFC 4627 [RFC4627] data structures. The JWE encryption 98 mechanisms are independent of the type of content being encrypted. 99 Cryptographic algorithms and identifiers used with this specification 100 are enumerated in the separate JSON Web Algorithms (JWA) [JWA] 101 specification. Related digital signature and HMAC capabilities are 102 described in the separate JSON Web Signature (JWS) [JWS] 103 specification. 105 2. Terminology 107 JSON Web Encryption (JWE) A data structure representing an encrypted 108 version of a Plaintext. The structure consists of three parts: 109 the JWE Header, the JWE Encrypted Key, and the JWE Ciphertext. 111 Plaintext The bytes to be encrypted - a.k.a., the message. 113 Ciphertext The encrypted version of the Plaintext. 115 Content Encryption Key (CEK) A symmetric key generated to encrypt 116 the Plaintext for the recipient to produce the Ciphertext, which 117 is encrypted to the recipient as the JWE Encrypted Key. 119 JWE Header A string representing a JSON object that describes the 120 encryption operations applied to create the JWE Encrypted Key and 121 the JWE Ciphertext. 123 JWE Encrypted Key The Content Encryption Key (CEK) is encrypted with 124 the intended recipient's key and the resulting encrypted content 125 is recorded as a byte array, which is referred to as the JWE 126 Encrypted Key. 128 JWE Ciphertext A byte array containing the Ciphertext. 130 Encoded JWE Header Base64url encoding of the bytes of the UTF-8 RFC 131 3629 [RFC3629] representation of the JWE Header. 133 Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted 134 Key. 136 Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext. 138 Header Parameter Names The names of the members within the JWE 139 Header. 141 Header Parameter Values The values of the members within the JWE 142 Header. 144 Base64url Encoding For the purposes of this specification, this term 145 always refers to the URL- and filename-safe Base64 encoding 146 described in RFC 4648 [RFC4648], Section 5, with the (non URL- 147 safe) '=' padding characters omitted, as permitted by Section 3.2. 148 (See Appendix B of [JWS] for notes on implementing base64url 149 encoding without padding.) 151 3. JSON Web Encryption (JWE) Overview 153 JWE represents encrypted content using JSON data structures and 154 base64url encoding. The representation consists of three parts: the 155 JWE Header, the JWE Encrypted Key, and the JWE Ciphertext. The three 156 parts are base64url-encoded for transmission, and typically 157 represented as the concatenation of the encoded strings in that 158 order, with the three strings being separated by period ('.') 159 characters. 161 JWE utilizes encryption to ensure the confidentiality of the contents 162 of the Plaintext. JWE does not add a content integrity check if not 163 provided by the underlying encryption algorithm. If such a check is 164 needed, an algorithm providing it such as AES-GCM [NIST-800-38D] can 165 be used, or alternatively, it can be provided through composition by 166 encrypting a representation of the digitally signed or HMACed 167 content. 169 3.1. Example JWE 171 The following example JWE Header declares that: 173 o the Content Encryption Key is encrypted to the recipient using the 174 RSA-PKCS1_1.5 algorithm to produce the JWE Encrypted Key, 176 o the Plaintext is encrypted using the AES-256-GCM algorithm to 177 produce the JWE Ciphertext, 179 o the specified 64-bit Initialization Vector with the base64url 180 encoding "__79_Pv6-fg" was used, and 182 o the thumbprint of the X.509 certificate that corresponds to the 183 key used to encrypt the JWE has the base64url encoding 184 "7noOPq-hJ1_hCnvWh6IeYI2w9Q0". 186 {"alg":"RSA1_5", 187 "enc":"A256GCM", 188 "iv":"__79_Pv6-fg", 189 "x5t":"7noOPq-hJ1_hCnvWh6IeYI2w9Q0"} 191 Base64url encoding the bytes of the UTF-8 representation of the JWE 192 Header yields this Encoded JWE Header value (with line breaks for 193 display purposes only): 194 eyJhbGciOiJSU0ExXzUiLA0KICJlbmMiOiJBMjU2R0NNIiwNCiAiaXYiOiJfXzc5 195 X1B2Ni1mZyIsDQogIng1dCI6Ijdub09QcS1oSjFfaENudldoNkllWUkydzlRMCJ9 197 TBD: Finish this example by showing generation of a Content 198 Encryption Key (CEK), using the CEK to encrypt the Plaintext to 199 produce the Ciphertext (and base64url encoding it), and using the 200 recipient's key to encrypt the CEK to produce the JWE Encrypted Key 201 (and base64url encoding it). 203 4. JWE Header 205 The members of the JSON object represented by the JWE Header describe 206 the encryption applied to the Plaintext and optionally additional 207 properties of the JWE. The Header Parameter Names within this object 208 MUST be unique. Implementations MUST understand the entire contents 209 of the header; otherwise, the JWE MUST be rejected. 211 4.1. Reserved Header Parameter Names 213 The following header parameter names are reserved. All the names are 214 short because a core goal of JWE is for the representations to be 215 compact. 217 TBD: Describe the relationship between the JWS and JWE header 218 parameters - especially the "alg" parameter, which can contain 219 digital signature or HMAC algorithms (from JWS) or encryption 220 algorithms (from JWE), and the key reference parameters "jku", "kid", 221 "x5u", and "x5t". 223 +-----------+--------+-------------+--------------------------------+ 224 | Header | JSON | Header | Header Parameter Semantics | 225 | Parameter | Value | Parameter | | 226 | Name | Type | Syntax | | 227 +-----------+--------+-------------+--------------------------------+ 228 | alg | string | StringOrURI | The "alg" (algorithm) header | 229 | | | | parameter identifies the | 230 | | | | cryptographic algorithm used | 231 | | | | to secure the JWE Encrypted | 232 | | | | Key. A list of defined | 233 | | | | encryption "alg" values is | 234 | | | | presented in Section 4, Table | 235 | | | | 2 of the JSON Web Algorithms | 236 | | | | (JWA) [JWA] specification. | 237 | | | | The processing of the "alg" | 238 | | | | (algorithm) header parameter | 239 | | | | requires that the value MUST | 240 | | | | be one that is both supported | 241 | | | | and for which there exists a | 242 | | | | key for use with that | 243 | | | | algorithm associated with the | 244 | | | | intended recipient. The "alg" | 245 | | | | value is case sensitive. This | 246 | | | | header parameter is REQUIRED. | 247 | enc | string | StringOrURI | The "enc" (encryption method) | 248 | | | | header parameter identifies | 249 | | | | the symmetric encryption | 250 | | | | algorithm used to secure the | 251 | | | | Ciphertext. A list of defined | 252 | | | | "enc" values is presented in | 253 | | | | Section 4, Table 3 of the JSON | 254 | | | | Web Algorithms (JWA) [JWA] | 255 | | | | specification. The processing | 256 | | | | of the "enc" (encryption | 257 | | | | method) header parameter | 258 | | | | requires that the value MUST | 259 | | | | be one that is supported. The | 260 | | | | "enc" value is case sensitive. | 261 | | | | This header parameter is | 262 | | | | REQUIRED. | 263 | iv | string | String | Initialization Vector ("iv") | 264 | | | | value for algorithms requiring | 265 | | | | it, represented as a base64url | 266 | | | | encoded string. This header | 267 | | | | parameter is OPTIONAL. | 268 | epk | object | JWK Key | Ephemeral Public Key ("epk") | 269 | | | Object | value created by the | 270 | | | | originator for the use in | 271 | | | | ECDH-ES RFC 6090 [RFC6090] | 272 | | | | encryption. This key is | 273 | | | | represented in the same manner | 274 | | | | as a JSON Web Key [JWK] JWK | 275 | | | | Key Object value, containing | 276 | | | | "crv" (curve), "x", and "y" | 277 | | | | members. The inclusion of the | 278 | | | | JWK Key Object "alg" | 279 | | | | (algorithm) member is | 280 | | | | OPTIONAL. This header | 281 | | | | parameter is OPTIONAL. | 282 | zip | string | String | Compression algorithm ("zip") | 283 | | | | applied to the Plaintext | 284 | | | | before encryption, if any. | 285 | | | | This specification defines the | 286 | | | | value "GZIP" to refer to the | 287 | | | | encoding format produced by | 288 | | | | the file compression program | 289 | | | | "gzip" (GNU zip) as described | 290 | | | | in [RFC1952]; this format is a | 291 | | | | Lempel-Ziv coding (LZ77) with | 292 | | | | a 32 bit CRC. If no "zip" | 293 | | | | parameter is present, or its | 294 | | | | value is "none", no | 295 | | | | compression is applied to the | 296 | | | | Plaintext before encryption. | 297 | | | | The "zip" value is case | 298 | | | | sensitive. This header | 299 | | | | parameter is OPTIONAL. | 300 | jku | string | URL | The "jku" (JSON Web Key URL) | 301 | | | | header parameter is an | 302 | | | | absolute URL that refers to a | 303 | | | | resource for a set of | 304 | | | | JSON-encoded public keys, one | 305 | | | | of which corresponds to the | 306 | | | | key that was used to encrypt | 307 | | | | the JWE. The keys MUST be | 308 | | | | encoded as described in the | 309 | | | | JSON Web Key (JWK) [JWK] | 310 | | | | specification. The protocol | 311 | | | | used to acquire the resource | 312 | | | | MUST provide integrity | 313 | | | | protection. An HTTP GET | 314 | | | | request to retrieve the | 315 | | | | certificate MUST use TLS RFC | 316 | | | | 2818 [RFC2818] RFC 5246 | 317 | | | | [RFC5246] with server | 318 | | | | authentication RFC 6125 | 319 | | | | [RFC6125]. This header | 320 | | | | parameter is OPTIONAL. | 321 | kid | string | String | The "kid" (key ID) header | 322 | | | | parameter is a hint indicating | 323 | | | | which key was used to encrypt | 324 | | | | the JWE. This allows | 325 | | | | originators to explicitly | 326 | | | | signal a change of key to | 327 | | | | recipients. The | 328 | | | | interpretation of the contents | 329 | | | | of the "kid" parameter is | 330 | | | | unspecified. This header | 331 | | | | parameter is OPTIONAL. | 332 | x5u | string | URL | The "x5u" (X.509 URL) header | 333 | | | | parameter is an absolute URL | 334 | | | | that refers to a resource for | 335 | | | | the X.509 public key | 336 | | | | certificate or certificate | 337 | | | | chain corresponding to the key | 338 | | | | used to encrypt the JWE. The | 339 | | | | identified resource MUST | 340 | | | | provide a representation of | 341 | | | | the certificate or certificate | 342 | | | | chain that conforms to RFC | 343 | | | | 5280 [RFC5280] in PEM encoded | 344 | | | | form RFC 1421 [RFC1421]. The | 345 | | | | protocol used to acquire the | 346 | | | | resource MUST provide | 347 | | | | integrity protection. An HTTP | 348 | | | | GET request to retrieve the | 349 | | | | certificate MUST use TLS RFC | 350 | | | | 2818 [RFC2818] RFC 5246 | 351 | | | | [RFC5246] with server | 352 | | | | authentication RFC 6125 | 353 | | | | [RFC6125]. This header | 354 | | | | parameter is OPTIONAL. | 355 | x5t | string | String | The "x5t" (x.509 certificate | 356 | | | | thumbprint) header parameter | 357 | | | | provides a base64url encoded | 358 | | | | SHA-1 thumbprint (a.k.a. | 359 | | | | digest) of the DER encoding of | 360 | | | | the X.509 certificate that | 361 | | | | corresponds to the key that | 362 | | | | was used to encrypt the JWE. | 363 | | | | This header parameter is | 364 | | | | OPTIONAL. | 365 | typ | string | String | The "typ" (type) header | 366 | | | | parameter is used to declare | 367 | | | | the type of the encrypted | 368 | | | | content. The "typ" value is | 369 | | | | case sensitive. This header | 370 | | | | parameter is OPTIONAL. | 371 +-----------+--------+-------------+--------------------------------+ 373 Table 1: Reserved Header Parameter Definitions 375 Additional reserved header parameter names MAY be defined via the 376 IANA JSON Web Encryption Header Parameters registry, as per 377 Section 10. The syntax values used above are defined as follows: 379 +-------------+-----------------------------------------------------+ 380 | Syntax Name | Syntax Definition | 381 +-------------+-----------------------------------------------------+ 382 | String | Any string value MAY be used. | 383 | StringOrURI | Any string value MAY be used but a value containing | 384 | | a ":" character MUST be a URI as defined in RFC | 385 | | 3986 [RFC3986]. | 386 | URL | A URL as defined in RFC 1738 [RFC1738]. | 387 +-------------+-----------------------------------------------------+ 389 Table 2: Header Parameter Syntax Definitions 391 4.2. Public Header Parameter Names 393 Additional header parameter names can be defined by those using JWE. 394 However, in order to prevent collisions, any new header parameter 395 name or algorithm value SHOULD either be defined in the IANA JSON Web 396 Encryption Header Parameters registry or be defined as a URI that 397 contains a collision resistant namespace. In each case, the definer 398 of the name or value needs to take reasonable precautions to make 399 sure they are in control of the part of the namespace they use to 400 define the header parameter name. 402 New header parameters should be introduced sparingly, as they can 403 result in non-interoperable JWEs. 405 4.3. Private Header Parameter Names 407 A producer and consumer of a JWE may agree to any header parameter 408 name that is not a Reserved Name Section 4.1 or a Public Name 409 Section 4.2. Unlike Public Names, these private names are subject to 410 collision and should be used with caution. 412 New header parameters should be introduced sparingly, as they can 413 result in non-interoperable JWEs. 415 5. Message Encryption 417 The message encryption process is as follows: 419 1. Generate a random Content Encryption Key (CEK). The CEK MUST 420 have a length at least equal to that of the required encryption 421 keys and MUST be generated randomly. See RFC 4086 [RFC4086] for 422 considerations on generating random values. 424 2. Encrypt the CEK for the recipient (see Section 7). 426 3. Generate a random IV (if required for the algorithm). 428 4. Compress the Plaintext if a "zip" parameter was included. 430 5. Serialize the (compressed) Plaintext into a bitstring M. 432 6. Encrypt M using the CEK and IV to form the bitstring C. 434 7. Set the Encoded JWE Ciphertext equal to the base64url encoded 435 representation of C. 437 8. Create a JWE Header containing the encryption parameters used. 438 Note that white space is explicitly allowed in the 439 representation and no canonicalization is performed before 440 encoding. 442 9. Base64url encode the bytes of the UTF-8 representation of the 443 JWE Header to create the Encoded JWE Header. 445 10. The three encoded parts, taken together, are the result of the 446 encryption. 448 6. Message Decryption 450 The message decryption process is the reverse of the encryption 451 process. If any of these steps fails, the JWE MUST be rejected. 453 1. The Encoded JWE Header, the Encoded JWE Encrypted Key, and the 454 Encoded JWE Ciphertext MUST be successfully base64url decoded 455 following the restriction that no padding characters have been 456 used. 458 2. The resulting JWE Header MUST be completely valid JSON syntax 459 conforming to RFC 4627 [RFC4627]. 461 3. The resulting JWE Header MUST be validated to only include 462 parameters and values whose syntax and semantics are both 463 understood and supported. 465 4. Verify that the JWE Header appears to reference a key known to 466 the recipient. 468 5. Decrypt the JWE Encrypted Key to produce the CEK. 470 6. Decrypt the binary representation of the JWE Ciphertext using the 471 CEK. 473 7. Uncompress the result of the previous step, if a "zip" parameter 474 was included. 476 8. Output the result. 478 7. CEK Encryption 480 JWE supports two forms of CEK encryption: 482 o Asymmetric encryption under the recipient's public key. 484 o Symmetric encryption under a shared key. 486 7.1. Asymmetric Encryption 488 In the asymmetric encryption mode, the CEK is encrypted under the 489 recipient's public key. The asymmetric encryption modes defined for 490 use with this in this specification are listed in Section 4, Table 2 491 of the JSON Web Algorithms (JWA) [JWA] specification. 493 7.2. Symmetric Encryption 495 In the symmetric encryption mode, the CEK is encrypted under a 496 symmetric key shared between the sender and receiver. The symmetric 497 encryption modes defined for use with this in this specification are 498 listed in Section 4, Table 2 of the JSON Web Algorithms (JWA) [JWA] 499 specification. For GCM, the random 64-bit IV is prepended to the 500 ciphertext. 502 8. Composition 504 This document does not specify a combination integrity and encrypted 505 mode. However, because the contents of a message can be arbitrary, 506 encryption and data origin authentication can be provided by 507 recursively encapsulating multiple JWE and JWS messages. In general, 508 senders SHOULD digitally sign or HMAC the message and then encrypt 509 the result (thus encrypting the digital signature or HMAC). This 510 prevents attacks in which the digital signature or HMAC is stripped, 511 leaving just an encrypted message, as well as providing privacy for 512 signers. 514 9. Encrypting JWEs with Cryptographic Algorithms 516 JWE uses cryptographic algorithms to encrypt the Content Encryption 517 Key (CEK) and the Plaintext. The JSON Web Algorithms (JWA) [JWA] 518 specification enumerates a set of cryptographic algorithms and 519 identifiers to be used with this specification. Specifically, 520 Section 4, Table 2 enumerates a set of "alg" (algorithm) header 521 parameter values and Section 4, Table 3 enumerates a set of "enc" 522 (encryption method) header parameter values intended for use this 523 specification. It also describes the semantics and operations that 524 are specific to these algorithms and algorithm families. 526 Public keys employed for encryption can be identified using the 527 Header Parameter methods described in Section 4.1 or can be 528 distributed using methods that are outside the scope of this 529 specification. 531 10. IANA Considerations 533 This specification calls for: 535 o A new IANA registry entitled "JSON Web Encryption Header 536 Parameters" for reserved header parameter names is defined in 537 Section 4.1. Inclusion in the registry is RFC Required in the RFC 538 5226 [RFC5226] sense for reserved JWE header parameter names that 539 are intended to be interoperable between implementations. The 540 registry will just record the reserved header parameter name and a 541 pointer to the RFC that defines it. This specification defines 542 inclusion of the header parameter names defined in Table 1. 544 11. Security Considerations 546 TBD: Lots of work to do here. We need to remember to look into any 547 issues relating to security and JSON parsing. One wonders just how 548 secure most JSON parsing libraries are. Were they ever hardened for 549 security scenarios? If not, what kind of holes does that open up? 550 Also, we need to walk through the JSON standard and see what kind of 551 issues we have especially around comparison of names. For instance, 552 comparisons of header parameter names and other parameters must occur 553 after they are unescaped. Need to also put in text about: Importance 554 of keeping secrets secret. Rotating keys. Strengths and weaknesses 555 of the different algorithms. 557 TBD: Need to put in text about why strict JSON validation is 558 necessary. Basically, that if malformed JSON is received then the 559 intent of the sender is impossible to reliably discern. One example 560 of malformed JSON that MUST be rejected is an object in which the 561 same member name occurs multiple times. 563 TBD: We need a section on generating randomness in browsers - it's 564 easy to screw up. 566 When utilizing TLS to retrieve information, the authority providing 567 the resource MUST be authenticated and the information retrieved MUST 568 be free from modification. 570 11.1. Unicode Comparison Security Issues 572 Header parameter names in JWEs are Unicode strings. For security 573 reasons, the representations of these names must be compared verbatim 574 after performing any escape processing (as per RFC 4627 [RFC4627], 575 Section 2.5). 577 This means, for instance, that these JSON strings must compare as 578 being equal ("enc", "\u0065nc"), whereas these must all compare as 579 being not equal to the first set or to each other ("ENC", "Enc", 580 "en\u0043"). 582 JSON strings MAY contain characters outside the Unicode Basic 583 Multilingual Plane. For instance, the G clef character (U+1D11E) may 584 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWE 585 implementations SHOULD ensure that characters outside the Basic 586 Multilingual Plane are preserved and compared correctly; 587 alternatively, if this is not possible due to these characters 588 exercising limitations present in the underlying JSON implementation, 589 then input containing them MUST be rejected. 591 12. Open Issues and Things To Be Done (TBD) 593 The following items remain to be done in this draft: 595 o Describe the relationship between the JWE, JWS, and JWT header 596 parameters. In particular, point out that the set of "alg" values 597 defined by each must be compatible and non-overlapping. 599 o Consider whether we want to define composite integrity/encryption 600 operations (as was the consensus to do at IIW, as documented at 601 http://self-issued.info/?p=378). This would provide both 602 confidentiality and integrity. 604 o Consider whether reusing the JWS "jku", "kid", "x5u", and "x5t" 605 parameters is the right thing to do, particularly as it 606 effectively precludes specifying composite operations. 608 o Consider whether to add parameters for directly including keys in 609 the header, either as JWK Key Objects, or X.509 cert values, or 610 both. 612 o Consider whether to add version numbers. 614 o Consider which of the open issues from the JWS and JWT specs also 615 apply here. 617 o Think about how to best describe the concept currently described 618 as "the bytes of the UTF-8 representation of". Possible terms to 619 use instead of "bytes of" include "byte sequence", "octet series", 620 and "octet sequence". Also consider whether we want to add an 621 overall clarifying statement somewhere in each spec something like 622 "every place we say 'the UTF-8 representation of X', we mean 'the 623 bytes of the UTF-8 representation of X'". That would potentially 624 allow us to omit the "the bytes of" part everywhere else. 626 o Finish the Security Considerations section. 628 o Write a note in the Security Considerations section about how 629 "x5t" (x.509 certificate thumbprint) should be deprecated because 630 of known problems with SHA-1. 632 o Should StringOrURI use IRIs rather than RFC 3986 URIs? 634 o Provide a more robust description of the use of the IV. The 635 current statement "For GCM, the random 64-bit IV is prepended to 636 the ciphertext" in the Symmetric Encryption section is almost 637 certainly out of place. 639 13. References 641 13.1. Normative References 643 [JWA] Jones, M., "JSON Web Algorithms (JWA)", January 2012. 645 [JWK] Jones, M., "JSON Web Key (JWK)", January 2012. 647 [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 648 Signature (JWS)", January 2012. 650 [NIST-800-38D] 651 National Institute of Standards and Technology (NIST), 652 "Recommendation for Block Cipher Modes of Operation: 653 Galois/Counter Mode (GCM) and GMAC", NIST PUB 800-38D, 654 December 2001. 656 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 657 Mail: Part I: Message Encryption and Authentication 658 Procedures", RFC 1421, February 1993. 660 [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform 661 Resource Locators (URL)", RFC 1738, December 1994. 663 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 664 Randers-Pehrson, "GZIP file format specification version 665 4.3", RFC 1952, May 1996. 667 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 668 Requirement Levels", BCP 14, RFC 2119, March 1997. 670 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 672 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 673 10646", STD 63, RFC 3629, November 2003. 675 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 676 Resource Identifier (URI): Generic Syntax", STD 66, 677 RFC 3986, January 2005. 679 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 680 Requirements for Security", BCP 106, RFC 4086, June 2005. 682 [RFC4627] Crockford, D., "The application/json Media Type for 683 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 685 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 686 Encodings", RFC 4648, October 2006. 688 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 689 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 690 May 2008. 692 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 693 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 695 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 696 Housley, R., and W. Polk, "Internet X.509 Public Key 697 Infrastructure Certificate and Certificate Revocation List 698 (CRL) Profile", RFC 5280, May 2008. 700 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 701 Curve Cryptography Algorithms", RFC 6090, February 2011. 703 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 704 Verification of Domain-Based Application Service Identity 705 within Internet Public Key Infrastructure Using X.509 706 (PKIX) Certificates in the Context of Transport Layer 707 Security (TLS)", RFC 6125, March 2011. 709 13.2. Informative References 711 [I-D.rescorla-jsms] 712 Rescorla, E. and J. Hildebrand, "JavaScript Message 713 Security Format", draft-rescorla-jsms-00 (work in 714 progress), March 2011. 716 [JSE] Bradley, J. and N. Sakimura (editor), "JSON Simple 717 Encryption", September 2010. 719 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 720 RFC 5652, September 2009. 722 [W3C.CR-xmlenc-core1-20110303] 723 Hirsch, F., Roessler, T., Reagle, J., and D. Eastlake, 724 "XML Encryption Syntax and Processing Version 1.1", World 725 Wide Web Consortium CR CR-xmlenc-core1-20110303, 726 March 2011, 727 . 729 Appendix A. JWE Examples 731 This section provides several examples of JWEs. 733 A.1. JWE Example using TBD Algorithm 735 A.1.1. Encrypting 737 TBD: Demonstrate encryption steps with this algorithm 739 A.1.2. Decrypting 741 TBD: Demonstrate decryption steps with this algorithm 743 Appendix B. Acknowledgements 745 Solutions for encrypting JSON content were also explored by JSON 746 Simple Encryption [JSE] and JavaScript Message Security Format 747 [I-D.rescorla-jsms], both of which significantly influenced this 748 draft. This draft attempts to explicitly reuse as many of the 749 relevant concepts from XML Encryption 1.1 750 [W3C.CR-xmlenc-core1-20110303] and RFC 5652 [RFC5652] as possible, 751 while utilizing simple compact JSON-based data structures. 753 Special thanks are due to John Bradley and Nat Sakimura for the 754 discussions that helped inform the content of this specification and 755 to Eric Rescorla and Joe Hildebrand for allowing the reuse of text 756 from [I-D.rescorla-jsms] in this document. 758 Appendix C. Document History 760 -00 762 o Created the initial IETF draft based upon 763 draft-jones-json-web-encryption-02 with no normative changes. 765 o Changed terminology to no longer call both digital signatures and 766 HMACs "signatures". 768 Authors' Addresses 770 Michael B. Jones 771 Microsoft 773 Email: mbj@microsoft.com 774 URI: http://self-issued.info/ 776 Eric Rescorla 777 RTFM, Inc. 779 Email: ekr@rtfm.com 781 Joe Hildebrand 782 Cisco Systems, Inc. 784 Email: jhildebr@cisco.com