idnits 2.17.1 draft-jones-json-web-encryption-01.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 (October 30, 2011) is 4555 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) == Unused Reference: 'RFC5785' is defined on line 796, but no explicit reference was found in the text -- Possible downref: Non-RFC (?) normative reference: ref. 'FIPS-197' -- 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-38A' -- Possible downref: Non-RFC (?) normative reference: ref. 'NIST-800-38D' -- Possible downref: Non-RFC (?) normative reference: ref. 'NIST-800-56A' ** 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 ** Obsolete normative reference: RFC 2818 (Obsoleted by RFC 9110) ** Downref: Normative reference to an Informational RFC: RFC 3394 ** Obsolete normative reference: RFC 3447 (Obsoleted by RFC 8017) ** 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) ** Obsolete normative reference: RFC 5785 (Obsoleted by RFC 8615) ** Downref: Normative reference to an Informational RFC: RFC 6090 ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) Summary: 12 errors (**), 0 flaws (~~), 2 warnings (==), 7 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Network Working Group M. Jones 3 Internet-Draft Microsoft 4 Intended status: Standards Track E. Rescorla 5 Expires: May 2, 2012 RTFM, Inc. 6 J. Hildebrand 7 Cisco Systems, Inc. 8 October 30, 2011 10 JSON Web Encryption (JWE) 11 draft-jones-json-web-encryption-01 13 Abstract 15 JSON Web Encryption (JWE) is a means of representing encrypted 16 content using JSON data structures. Related signature capabilities 17 are described in the separate JSON Web Signature (JWS) specification. 19 Requirements Language 21 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 22 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 23 document are to be interpreted as described in RFC 2119 [RFC2119]. 25 Status of this Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at http://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on May 2, 2012. 42 Copyright Notice 44 Copyright (c) 2011 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (http://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 60 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 61 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 4 62 3.1. Example JWE . . . . . . . . . . . . . . . . . . . . . . . 4 63 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 5 64 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 5 65 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 10 66 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 10 67 5. Message Encryption . . . . . . . . . . . . . . . . . . . . . . 10 68 6. Message Decryption . . . . . . . . . . . . . . . . . . . . . . 11 69 7. CEK Encryption . . . . . . . . . . . . . . . . . . . . . . . . 12 70 7.1. Asymmetric Encryption . . . . . . . . . . . . . . . . . . 12 71 7.2. Symmetric Encryption . . . . . . . . . . . . . . . . . . . 12 72 8. Composition . . . . . . . . . . . . . . . . . . . . . . . . . 12 73 9. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 12 74 9.1. Encrypting a JWE with TBD . . . . . . . . . . . . . . . . 14 75 9.2. Additional Algorithms . . . . . . . . . . . . . . . . . . 14 76 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 14 77 11. Security Considerations . . . . . . . . . . . . . . . . . . . 15 78 11.1. Unicode Comparison Security Issues . . . . . . . . . . . . 15 79 12. Open Issues and Things To Be Done (TBD) . . . . . . . . . . . 16 80 13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 17 81 13.1. Normative References . . . . . . . . . . . . . . . . . . . 17 82 13.2. Informative References . . . . . . . . . . . . . . . . . . 19 83 Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 20 84 A.1. JWE Example using TBD Algorithm . . . . . . . . . . . . . 20 85 A.1.1. Encrypting . . . . . . . . . . . . . . . . . . . . . . 20 86 A.1.2. Decrypting . . . . . . . . . . . . . . . . . . . . . . 20 87 Appendix B. Algorithm Identifier Cross-Reference . . . . . . . . 20 88 Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 23 89 Appendix D. Document History . . . . . . . . . . . . . . . . . . 23 90 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 24 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. A 99 related signature capability is described in a separate JSON Web 100 Signature (JWS) [JWS] specification. 102 2. Terminology 104 JSON Web Encryption (JWE) A data structure representing an encrypted 105 version of a Plaintext. The structure consists of three parts: 106 the JWE Header, the JWE Encrypted Key, and the JWE Ciphertext. 108 Plaintext The bytes to be encrypted - a.k.a., the message. 110 Ciphertext The encrypted version of the Plaintext. 112 Content Encryption Key (CEK) A symmetric key generated to encrypt 113 the Plaintext for the recipient to produce the Ciphertext, which 114 is encrypted to the recipient as the JWE Encrypted Key. 116 JWE Header A string containing a JSON object that describes the 117 encryption operations applied to create the JWE Encrypted Key and 118 the JWE Ciphertext. 120 JWE Encrypted Key The Content Encryption Key (CEK) is encrypted with 121 the intended recipient's key and the resulting encrypted content 122 is recorded as a byte array, which is referred to as the JWE 123 Encrypted Key. 125 JWE Ciphertext A byte array containing the Ciphertext. 127 Encoded JWE Header Base64url encoding of the bytes of the UTF-8 RFC 128 3629 [RFC3629] representation of the JWE Header. 130 Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted 131 Key. 133 Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext. 135 Header Parameter Names The names of the members within the JWE 136 Header. 138 Header Parameter Values The values of the members within the JWE 139 Header. 141 Base64url Encoding For the purposes of this specification, this term 142 always refers to the URL- and filename-safe Base64 encoding 143 described in RFC 4648 [RFC4648], Section 5, with the (non URL- 144 safe) '=' padding characters omitted, as permitted by Section 3.2. 145 (See Appendix C of [JWS] for notes on implementing base64url 146 encoding without padding.) 148 3. JSON Web Encryption (JWE) Overview 150 JWE represents encrypted content using JSON data structures and 151 base64url encoding. The representation consists of three parts: the 152 JWE Header, the JWE Encrypted Key, and the JWE Ciphertext. The three 153 parts are base64url-encoded for transmission, and typically 154 represented as the concatenation of the encoded strings in that 155 order, with the three strings being separated by period ('.') 156 characters, as is done when used in JSON Web Tokens (JWTs) [JWT]. 158 JWE utilizes encryption to ensure the confidentiality of the contents 159 of the Plaintext. JWE does not add a content integrity check if not 160 provided by the underlying encryption algorithm. If such a check is 161 needed, an algorithm providing it such as AES-GCM [NIST-800-38D] can 162 be used, or alternatively, it can be provided through composition by 163 encrypting a representation of the signed content. 165 3.1. Example JWE 167 The following example JWE Header declares that: 169 o the Content Encryption Key is encrypted to the recipient using the 170 RSA-PKCS1_1.5 algorithm to produce the JWE Encrypted Key, 172 o the Plaintext is encrypted using the AES-256-GCM algorithm to 173 produce the JWE Ciphertext, 175 o the specified 64-bit Initialization Vector with the base64url 176 encoding "__79_Pv6-fg" was used, and 178 o the thumbprint of the X.509 certificate that corresponds to the 179 key used to encrypt the JWE has the base64url encoding 180 "7noOPq-hJ1_hCnvWh6IeYI2w9Q0". 182 {"alg":"RSA1_5", 183 "enc":"A256GCM", 184 "iv":"__79_Pv6-fg", 185 "x5t":"7noOPq-hJ1_hCnvWh6IeYI2w9Q0"} 187 Base64url encoding the bytes of the UTF-8 representation of the JWE 188 Header yields this Encoded JWE Header value: 189 TBD 191 TBD: Finish this example by showing generation of a Content 192 Encryption Key (CEK), using the CEK to encrypt the Plaintext to 193 produce the Ciphertext (and base64url encoding it), and using the 194 recipient's key to encrypt the CEK to produce the JWE Encrypted Key 195 (and base64url encoding it). 197 4. JWE Header 199 The members of the JWE Header describe the encryption applied to the 200 Plaintext. Implementations MUST understand the entire contents of 201 the header; otherwise, the JWE MUST be rejected for processing. 203 The member names within the JWE Header are referred to as Header 204 Parameter Names. These names MUST be unique. The corresponding 205 values are referred to as Header Parameter Values. 207 4.1. Reserved Header Parameter Names 209 The following header parameter names are reserved. All the names are 210 short because a core goal of JWE is for the representations to be 211 compact. 213 TBD: Describe the relationship between the JWS and JWE header 214 parameters - especially the "alg" parameter, which can contain either 215 signature algorithms (from JWS) or encryption algorithms (from JWE), 216 and the key reference parameters "jku", "kid", "x5u", and "x5t". 218 +-----------+--------+-------------+--------------------------------+ 219 | Header | JSON | Header | Header Parameter Semantics | 220 | Parameter | Value | Parameter | | 221 | Name | Type | Syntax | | 222 +-----------+--------+-------------+--------------------------------+ 223 | alg | string | StringOrURI | The "alg" (algorithm) header | 224 | | | | parameter identifies the | 225 | | | | cryptographic algorithm used | 226 | | | | to secure the JWE Encrypted | 227 | | | | Key. A list of reserved "alg" | 228 | | | | values is presented in | 229 | | | | Table 3. The processing of | 230 | | | | the "alg" (algorithm) header | 231 | | | | parameter requires that the | 232 | | | | value of the "alg" header | 233 | | | | parameter MUST be one that is | 234 | | | | both supported and for which | 235 | | | | there exists a key for use | 236 | | | | with that algorithm associated | 237 | | | | with the intended recipient. | 238 | | | | The "alg" value is case | 239 | | | | sensitive. This header | 240 | | | | parameter is REQUIRED. | 241 | enc | string | StringOrURI | The "enc" (encryption method) | 242 | | | | header parameter identifies | 243 | | | | the symmetric encryption | 244 | | | | algorithm used to secure the | 245 | | | | Ciphertext. A list of | 246 | | | | reserved "enc" values is | 247 | | | | presented in Table 4. The | 248 | | | | processing of the "enc" | 249 | | | | (encryption method) header | 250 | | | | parameter requires that the | 251 | | | | value of the "enc" header | 252 | | | | parameter MUST be one that is | 253 | | | | supported. The "enc" value is | 254 | | | | case sensitive. This header | 255 | | | | parameter is REQUIRED. | 256 | iv | string | String | Initialization Vector ("iv") | 257 | | | | value for algorithms requiring | 258 | | | | it, represented as a base64url | 259 | | | | encoded string. This header | 260 | | | | parameter is OPTIONAL. | 261 | epk | object | JWK Key | Ephemeral Public Key ("epk") | 262 | | | Object | value created by the | 263 | | | | originator for the use in | 264 | | | | ECDH-ES RFC 6090 [RFC6090] | 265 | | | | encryption. This key is | 266 | | | | represented in the same manner | 267 | | | | as a JSON Web Key [JWK] JWK | 268 | | | | Key Object value, containing | 269 | | | | "curve", "x", and "y" members. | 270 | | | | The inclusion of the JWK Key | 271 | | | | Object "algorithm" member is | 272 | | | | OPTIONAL. This header | 273 | | | | parameter is OPTIONAL. | 274 | zip | string | String | Compression algorithm ("zip") | 275 | | | | applied to the Plaintext | 276 | | | | before encryption, if any. | 277 | | | | This specification defines the | 278 | | | | value "GZIP" to refer to the | 279 | | | | encoding format produced by | 280 | | | | the file compression program | 281 | | | | "gzip" (GNU zip) as described | 282 | | | | in [RFC1952]; this format is a | 283 | | | | Lempel-Ziv coding (LZ77) with | 284 | | | | a 32 bit CRC. If no "zip" | 285 | | | | parameter is present, or its | 286 | | | | value is "none", no | 287 | | | | compression is applied to the | 288 | | | | Plaintext before encryption. | 289 | | | | The "zip" value is case | 290 | | | | sensitive. This header | 291 | | | | parameter is OPTIONAL. | 292 | jku | string | URL | The "jku" (JSON Web Key URL) | 293 | | | | header parameter is an | 294 | | | | absolute URL that refers to a | 295 | | | | resource for a set of | 296 | | | | JSON-encoded public keys, one | 297 | | | | of which corresponds to the | 298 | | | | key that was used to encrypt | 299 | | | | the JWE. The keys MUST be | 300 | | | | encoded as described in the | 301 | | | | JSON Web Key (JWK) [JWK] | 302 | | | | specification. The protocol | 303 | | | | used to acquire the resource | 304 | | | | MUST provide integrity | 305 | | | | protection. An HTTP GET | 306 | | | | request to retrieve the | 307 | | | | certificate MUST use TLS RFC | 308 | | | | 2818 [RFC2818] RFC 5246 | 309 | | | | [RFC5246] with server | 310 | | | | authentication RFC 6125 | 311 | | | | [RFC6125]. This header | 312 | | | | parameter is OPTIONAL. | 313 | kid | string | String | The "kid" (key ID) header | 314 | | | | parameter is a hint indicating | 315 | | | | which key was used to encrypt | 316 | | | | the JWE. This allows | 317 | | | | originators to explicitly | 318 | | | | signal a change of key to | 319 | | | | recipients. The | 320 | | | | interpretation of the contents | 321 | | | | of the "kid" parameter is | 322 | | | | unspecified. This header | 323 | | | | parameter is OPTIONAL. | 324 | x5u | string | URL | The "x5u" (X.509 URL) header | 325 | | | | parameter is an absolute URL | 326 | | | | that refers to a resource for | 327 | | | | the X.509 public key | 328 | | | | certificate or certificate | 329 | | | | chain corresponding to the key | 330 | | | | used to encrypt the JWE. The | 331 | | | | identified resource MUST | 332 | | | | provide a representation of | 333 | | | | the certificate or certificate | 334 | | | | chain that conforms to RFC | 335 | | | | 5280 [RFC5280] in PEM encoded | 336 | | | | form RFC 1421 [RFC1421]. The | 337 | | | | protocol used to acquire the | 338 | | | | resource MUST provide | 339 | | | | integrity protection. An HTTP | 340 | | | | GET request to retrieve the | 341 | | | | certificate MUST use TLS RFC | 342 | | | | 2818 [RFC2818] RFC 5246 | 343 | | | | [RFC5246] with server | 344 | | | | authentication RFC 6125 | 345 | | | | [RFC6125]. This header | 346 | | | | parameter is OPTIONAL. | 347 | x5t | string | String | The "x5t" (x.509 certificate | 348 | | | | thumbprint) header parameter | 349 | | | | provides a base64url encoded | 350 | | | | SHA-1 thumbprint (a.k.a. | 351 | | | | digest) of the DER encoding of | 352 | | | | the X.509 certificate that | 353 | | | | corresponds to the key that | 354 | | | | was used to encrypt the JWE. | 355 | | | | This header parameter is | 356 | | | | OPTIONAL. | 357 | typ | string | String | The "typ" (type) header | 358 | | | | parameter is used to declare | 359 | | | | the type of the encrypted | 360 | | | | content. The "typ" value is | 361 | | | | case sensitive. This header | 362 | | | | parameter is OPTIONAL. | 363 +-----------+--------+-------------+--------------------------------+ 365 Table 1: Reserved Header Parameter Definitions 367 Additional reserved header parameter names MAY be defined via the 368 IANA JSON Web Encryption Header Parameters registry, as per 369 Section 10. The syntax values used above are defined as follows: 371 +-------------+-----------------------------------------------------+ 372 | Syntax Name | Syntax Definition | 373 +-------------+-----------------------------------------------------+ 374 | String | Any string value MAY be used. | 375 | StringOrURI | Any string value MAY be used but a value containing | 376 | | a ":" character MUST be a URI as defined in RFC | 377 | | 3986 [RFC3986]. | 378 | URL | A URL as defined in RFC 1738 [RFC1738]. | 379 +-------------+-----------------------------------------------------+ 381 Table 2: Header Parameter Syntax Definitions 383 4.2. Public Header Parameter Names 385 Additional header parameter names can be defined by those using JWE. 386 However, in order to prevent collisions, any new header parameter 387 name or algorithm value SHOULD either be defined in the IANA JSON Web 388 Encryption Header Parameters registry or be defined as a URI that 389 contains a collision resistant namespace. In each case, the definer 390 of the name or value MUST take reasonable precautions to make sure 391 they are in control of the part of the namespace they use to define 392 the header parameter name. 394 New header parameters should be introduced sparingly, as they can 395 result in non-interoperable JWEs. 397 4.3. Private Header Parameter Names 399 A producer and consumer of a JWE may agree to any header parameter 400 name that is not a Reserved Name Section 4.1 or a Public Name 401 Section 4.2. Unlike Public Names, these private names are subject to 402 collision and should be used with caution. 404 New header parameters should be introduced sparingly, as they can 405 result in non-interoperable JWEs. 407 5. Message Encryption 409 The message encryption process is as follows: 411 1. Generate a random Content Encryption Key (CEK). The CEK MUST 412 have a length at least equal to that of the required encryption 413 keys and MUST be generated randomly. See RFC 4086 [RFC4086] for 414 considerations on generating random values. 416 2. Encrypt the CEK for the recipient (see Section 7). 418 3. Generate a random IV (if required for the algorithm). 420 4. Compress the Plaintext if a "zip" parameter was included. 422 5. Serialize the (compressed) Plaintext into a bitstring M. 424 6. Encrypt M using the CEK and IV to form the bitstring C. 426 7. Set the Encoded JWE Ciphertext equal to the base64url encoded 427 representation of C. 429 8. Create the JWE Header containing the encryption parameters used. 431 9. Base64url encoded the UTF-8 representation of the JWE Header to 432 create the Encoded JWE Header. 434 10. The three encoded parts, taken together, are the result of the 435 encryption. 437 6. Message Decryption 439 The message decryption process is the reverse of the encryption 440 process. If any of these steps fails, the JWE MUST be rejected. 442 1. The Encoded JWE Header, the Encoded JWE Encrypted Key, and the 443 Encoded JWE Ciphertext MUST be successfully base64url decoded 444 following the restriction that no padding characters have been 445 used. 447 2. The resulting JWE Header MUST be completely valid JSON syntax 448 conforming to RFC 4627 [RFC4627]. 450 3. The resulting JWE Header MUST be validated to only include 451 parameters and values whose syntax and semantics are both 452 understood and supported. 454 4. Verify that the JWE Header appears to reference a key known to 455 the recipient. 457 5. Decrypt the JWE Encrypted Key to produce the CEK. 459 6. Decrypt the binary representation of the JWE Ciphertext using the 460 CEK. 462 7. Uncompress the result of the previous step, if a "zip" parameter 463 was included. 465 8. Output the result. 467 7. CEK Encryption 469 JWE supports two forms of CEK encryption: 471 o Asymmetric encryption under the recipient's public key. 473 o Symmetric encryption under a shared key. 475 7.1. Asymmetric Encryption 477 In the asymmetric encryption mode, the CEK is encrypted under the 478 recipient's public key. The asymmetric encryption modes defined for 479 use with this in this specification are listed in in Table 3. 481 7.2. Symmetric Encryption 483 In the symmetric encryption mode, the CEK is encrypted under a 484 symmetric key shared between the sender and receiver. The symmetric 485 encryption modes defined for use with this in this specification are 486 listed in in Table 3. For GCM, the random 64-bit IV is prepended to 487 the ciphertext. 489 8. Composition 491 This document does not specify a combination signed and encrypted 492 mode. However, because the contents of a message can be arbitrary, 493 encryption and data origin authentication can be provided by 494 recursively encapsulating multiple JWE and JWS messages. In general, 495 senders SHOULD sign the message and then encrypt the result (thus 496 encrypting the signature). This prevents attacks in which the 497 signature is stripped, leaving just an encrypted message, as well as 498 providing privacy for the signer. 500 9. Encrypting JWEs with Cryptographic Algorithms 502 JWE uses cryptographic algorithms to encrypt the Content Encryption 503 Key (CEK) and the Plaintext. This section specifies a set of 504 specific algorithms for these purposes. 506 The table below Table 3 is the set of "alg" header parameter values 507 that are reserved by this specification. These algorithms are used 508 to encrypt the CEK, which produces the JWE Encrypted Key. 510 +-----------+-------------------------------------------------------+ 511 | alg | Encryption Algorithm | 512 | Parameter | | 513 | Value | | 514 +-----------+-------------------------------------------------------+ 515 | RSA1_5 | RSA using RSA-PKCS1-1.5 padding, as defined in RFC | 516 | | 3447 [RFC3447] | 517 | RSA-OAEP | RSA using Optimal Asymmetric Encryption Padding | 518 | | (OAEP), as defined in RFC 3447 [RFC3447] | 519 | ECDH-ES | Elliptic Curve Diffie-Hellman Ephemeral Static, as | 520 | | defined in RFC 6090 [RFC6090], and using the Concat | 521 | | KDF, as defined in [NIST-800-56A], where the Digest | 522 | | Method is SHA-256 | 523 | A128KW | Advanced Encryption Standard (AES) Key Wrap Algorithm | 524 | | using 128 bit keys, as defined in RFC 3394 [RFC3394] | 525 | A256KW | Advanced Encryption Standard (AES) Key Wrap Algorithm | 526 | | using 256 bit keys, as defined in RFC 3394 [RFC3394] | 527 | A128GCM | Advanced Encryption Standard (AES) using 128 bit keys | 528 | | in Galois/Counter Mode, as defined in [FIPS-197] and | 529 | | [NIST-800-38D] | 530 | A256GCM | Advanced Encryption Standard (AES) using 256 bit keys | 531 | | in Galois/Counter Mode, as defined in [FIPS-197] and | 532 | | [NIST-800-38D] | 533 +-----------+-------------------------------------------------------+ 535 Table 3: JWE Reserved alg Parameter Values 537 The table below Table 4 is the set of "enc" header parameter values 538 that are reserved by this specification. These algorithms are used 539 to encrypt the Plaintext, which produces the Ciphertext. 541 +-----------+-------------------------------------------------------+ 542 | enc | Symmetric Encryption Algorithm | 543 | Parameter | | 544 | Value | | 545 +-----------+-------------------------------------------------------+ 546 | A128CBC | Advanced Encryption Standard (AES) using 128 bit keys | 547 | | in Cipher Block Chaining mode, as defined in | 548 | | [FIPS-197] and [NIST-800-38A] | 549 | A256CBC | Advanced Encryption Standard (AES) using 256 bit keys | 550 | | in Cipher Block Chaining mode, as defined in | 551 | | [FIPS-197] and [NIST-800-38A] | 552 | A128GCM | Advanced Encryption Standard (AES) using 128 bit keys | 553 | | in Galois/Counter Mode, as defined in [FIPS-197] and | 554 | | [NIST-800-38D] | 555 | A256GCM | Advanced Encryption Standard (AES) using 256 bit keys | 556 | | in Galois/Counter Mode, as defined in [FIPS-197] and | 557 | | [NIST-800-38D] | 558 +-----------+-------------------------------------------------------+ 560 Table 4: JWE Reserved enc Parameter Values 562 Of these algorithms, only RSA-PKCS1-1.5 with 2048 bit keys, AES-128- 563 CBC, and AES-256-CBC MUST be implemented by conforming 564 implementations. It is RECOMMENDED that implementations also support 565 ECDH-ES with 256 bit keys, AES-128-GCM, and AES-256-GCM. Support for 566 other algorithms and key sizes is OPTIONAL. 568 9.1. Encrypting a JWE with TBD 570 TBD: Descriptions of the particulars of each specified algorithm go 571 here. 573 9.2. Additional Algorithms 575 Additional algorithms MAY be used to protect JWEs with corresponding 576 "alg" and "enc" header parameter values being defined to refer to 577 them. New "alg" and "enc" header parameter values SHOULD either be 578 defined in the IANA JSON Web Encryption Algorithms registry or be a 579 URI that contains a collision resistant namespace. In particular, 580 the use of algorithm identifiers defined in 581 [W3C.REC-xmlenc-core-20021210], [W3C.CR-xmlenc-core1-20110303], and 582 related specifications is permitted. 584 10. IANA Considerations 586 This specification calls for: 588 o A new IANA registry entitled "JSON Web Encryption Header 589 Parameters" for reserved header parameter names is defined in 590 Section 4.1. Inclusion in the registry is RFC Required in the RFC 591 5226 [RFC5226] sense for reserved JWE header parameter names that 592 are intended to be interoperable between implementations. The 593 registry will just record the reserved header parameter name and a 594 pointer to the RFC that defines it. This specification defines 595 inclusion of the header parameter names defined in Table 1. 597 o A new IANA registry entitled "JSON Web Encryption Algorithms" for 598 reserved values used with the "alg" and "enc" header parameter 599 values, as defined in Section 9.2. Inclusion in the registry is 600 RFC Required in the RFC 5226 [RFC5226] sense. The registry will 601 record the "alg" or "enc" value and a pointer to the RFC that 602 defines it. This specification defines inclusion of the algorithm 603 values defined in Table 3 and Table 4. 605 11. Security Considerations 607 TBD: Lots of work to do here. We need to remember to look into any 608 issues relating to security and JSON parsing. One wonders just how 609 secure most JSON parsing libraries are. Were they ever hardened for 610 security scenarios? If not, what kind of holes does that open up? 611 Also, we need to walk through the JSON standard and see what kind of 612 issues we have especially around comparison of names. For instance, 613 comparisons of header parameter names and other parameters must occur 614 after they are unescaped. Need to also put in text about: Importance 615 of keeping secrets secret. Rotating keys. Strengths and weaknesses 616 of the different algorithms. 618 TBD: Need to put in text about why strict JSON validation is 619 necessary. Basically, that if malformed JSON is received then the 620 intent of the sender is impossible to reliably discern. One example 621 of malformed JSON that MUST be rejected is an object in which the 622 same member name occurs multiple times. 624 TBD: We need a section on generating randomness in browsers - it's 625 easy to screw up. 627 When utilizing TLS to retrieve information, the authority providing 628 the resource MUST be authenticated and the information retrieved MUST 629 be free from modification. 631 11.1. Unicode Comparison Security Issues 633 Header parameter names in JWEs are Unicode strings. For security 634 reasons, the representations of these names must be compared verbatim 635 after performing any escape processing (as per RFC 4627 [RFC4627], 636 Section 2.5). 638 This means, for instance, that these JSON strings must compare as 639 being equal ("enc", "\u0065nc"), whereas these must all compare as 640 being not equal to the first set or to each other ("ENC", "Enc", 641 "en\u0043"). 643 JSON strings MAY contain characters outside the Unicode Basic 644 Multilingual Plane. For instance, the G clef character (U+1D11E) may 645 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWE 646 implementations SHOULD ensure that characters outside the Basic 647 Multilingual Plane are preserved and compared correctly; 648 alternatively, if this is not possible due to these characters 649 exercising limitations present in the underlying JSON implementation, 650 then input containing them MUST be rejected. 652 12. Open Issues and Things To Be Done (TBD) 654 The following items remain to be done in this draft: 656 o Describe the relationship between the JWE, JWS, and JWT header 657 parameters. In particular, point out that the set of "alg" values 658 defined by each must be compatible and non-overlapping. 660 o Consider whether we want to define composite signing/encryption 661 operations (as was the consensus to do at IIW, as documented at 662 http://self-issued.info/?p=378). 664 o Consider whether reusing the JWS "jku", "kid", "x5u", and "x5t" 665 parameters is the right thing to do, particularly as it 666 effectively precludes specifying composite operations. 668 o Consider whether to add parameters for directly including keys in 669 the header, either as JWK Key Objects, or X.509 cert values, or 670 both. 672 o Consider whether to add version numbers. 674 o Consider which of the open issues from the JWS and JWT specs also 675 apply here. 677 o Think about how to best describe the concept currently described 678 as "the bytes of the UTF-8 representation of". Possible terms to 679 use instead of "bytes of" include "byte sequence", "octet series", 680 and "octet sequence". Also consider whether we want to add an 681 overall clarifying statement somewhere in each spec something like 682 "every place we say 'the UTF-8 representation of X', we mean 'the 683 bytes of the UTF-8 representation of X'". That would potentially 684 allow us to omit the "the bytes of" part everywhere else. 686 o Finish the Security Considerations section. 688 o Write a note in the Security Considerations section about how 689 "x5t" (x.509 certificate thumbprint) should be deprecated because 690 of known problems with SHA-1. 692 o Should StringOrURI use IRIs rather than RFC 3986 URIs? 694 o Provide a more robust description of the use of the IV. The 695 current statement "For GCM, the random 64-bit IV is prepended to 696 the ciphertext" in the Symmetric Encryption section is almost 697 certainly out of place. 699 o It would be good to say somewhere, in normative language, that 700 eventually the algorithms and/or key sizes currently specified 701 will no longer be considered sufficiently secure and will be 702 removed. Therefore, implementers MUST be prepared for this 703 eventuality. 705 o Consider whether a media type should be proposed, such as 706 "application/jwe". 708 o Should we define the use of RFC 5649 key wrapping functions, which 709 allow arbitrary key sizes, in addition to the current use of RFC 710 3394 key wrapping functions, which require that keys be multiples 711 of 64 bits? Is this needed in practice? 713 13. References 715 13.1. Normative References 717 [FIPS-197] 718 National Institute of Standards and Technology (NIST), 719 "Advanced Encryption Standard (AES)", FIPS PUB 197, 720 November 2001. 722 [JWK] Jones, M., "JSON Web Key (JWK)", October 2011. 724 [JWS] Jones, M., Balfanz, D., Bradley, J., Goland, Y., Panzer, 725 J., Sakimura, N., and P. Tarjan, "JSON Web Signature 726 (JWS)", October 2011. 728 [NIST-800-38A] 729 National Institute of Standards and Technology (NIST), 730 "Recommendation for Block Cipher Modes of Operation", 731 NIST PUB 800-38A, December 2001. 733 [NIST-800-38D] 734 National Institute of Standards and Technology (NIST), 735 "Recommendation for Block Cipher Modes of Operation: 736 Galois/Counter Mode (GCM) and GMAC", NIST PUB 800-38D, 737 December 2001. 739 [NIST-800-56A] 740 National Institute of Standards and Technology (NIST), 741 "Recommendation for Pair-Wise Key Establishment Schemes 742 Using Discrete Logarithm Cryptography (Revised)", NIST PUB 743 800-56A, March 2007. 745 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 746 Mail: Part I: Message Encryption and Authentication 747 Procedures", RFC 1421, February 1993. 749 [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform 750 Resource Locators (URL)", RFC 1738, December 1994. 752 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 753 Randers-Pehrson, "GZIP file format specification version 754 4.3", RFC 1952, May 1996. 756 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 757 Requirement Levels", BCP 14, RFC 2119, March 1997. 759 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 761 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 762 (AES) Key Wrap Algorithm", RFC 3394, September 2002. 764 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 765 Standards (PKCS) #1: RSA Cryptography Specifications 766 Version 2.1", RFC 3447, February 2003. 768 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 769 10646", STD 63, RFC 3629, November 2003. 771 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 772 Resource Identifier (URI): Generic Syntax", STD 66, 773 RFC 3986, January 2005. 775 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 776 Requirements for Security", BCP 106, RFC 4086, June 2005. 778 [RFC4627] Crockford, D., "The application/json Media Type for 779 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 781 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 782 Encodings", RFC 4648, October 2006. 784 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 785 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 786 May 2008. 788 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 789 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 791 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 792 Housley, R., and W. Polk, "Internet X.509 Public Key 793 Infrastructure Certificate and Certificate Revocation List 794 (CRL) Profile", RFC 5280, May 2008. 796 [RFC5785] Nottingham, M. and E. Hammer-Lahav, "Defining Well-Known 797 Uniform Resource Identifiers (URIs)", RFC 5785, 798 April 2010. 800 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 801 Curve Cryptography Algorithms", RFC 6090, February 2011. 803 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 804 Verification of Domain-Based Application Service Identity 805 within Internet Public Key Infrastructure Using X.509 806 (PKIX) Certificates in the Context of Transport Layer 807 Security (TLS)", RFC 6125, March 2011. 809 13.2. Informative References 811 [I-D.rescorla-jsms] 812 Rescorla, E. and J. Hildebrand, "JavaScript Message 813 Security Format", draft-rescorla-jsms-00 (work in 814 progress), March 2011. 816 [JCA] Oracle, "Java Cryptography Architecture", 2011. 818 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 819 September 2010. 821 [JWT] Jones, M., Balfanz, D., Bradley, J., Goland, Y., Panzer, 822 J., Sakimura, N., and P. Tarjan, "JSON Web Token (JWT)", 823 October 2011. 825 [RFC3275] Eastlake, D., Reagle, J., and D. Solo, "(Extensible Markup 826 Language) XML-Signature Syntax and Processing", RFC 3275, 827 March 2002. 829 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 830 RFC 5652, September 2009. 832 [W3C.CR-xmlenc-core1-20110303] 833 Hirsch, F., Reagle, J., Eastlake, D., and T. Roessler, 834 "XML Encryption Syntax and Processing Version 1.1", World 835 Wide Web Consortium CR CR-xmlenc-core1-20110303, 836 March 2011, 837 . 839 [W3C.REC-xmlenc-core-20021210] 840 Eastlake, D. and J. Reagle, "XML Encryption Syntax and 841 Processing", World Wide Web Consortium Recommendation REC- 842 xmlenc-core-20021210, December 2002, 843 . 845 Appendix A. JWE Examples 847 This section provides several examples of JWEs. 849 A.1. JWE Example using TBD Algorithm 851 A.1.1. Encrypting 853 TBD: Demonstrate encryption steps with this algorithm 855 A.1.2. Decrypting 857 TBD: Demonstrate decryption steps with this algorithm 859 Appendix B. Algorithm Identifier Cross-Reference 861 This appendix contains a table cross-referencing the "alg" and "enc" 862 values used in this specification with the equivalent identifiers 863 used by other standards and software packages. See XML DSIG 864 [RFC3275] and Java Cryptography Architecture [JCA] for more 865 information about the names defined by those documents. 867 +---------+------+-------------------------+-------------------+----+ 868 | Algorit | JWE | XML ENC | JCA | OI | 869 | hm | | | | D | 870 +---------+------+-------------------------+-------------------+----+ 871 | RSA | RSA1 | http://www.w3.org/2001/ | RSA/ECB/PKCS1Padd | TB | 872 | using | _5 | 04/xmlenc#rsa-1_5 | ing | D | 873 | RSA-PKC | | | | | 874 | S1-1.5 | | | | | 875 | paddin | | | | | 876 | g | | | | | 877 | RSA | RSA- | http://www.w3.org/2001/ | RSA/ECB/OAEPWithS | TB | 878 | using | OAEP | 04/xmlenc#rsa-oaep-mgf1 | HA-1AndMGF1Paddin | D | 879 | Optimal | | p | g | | 880 | Asymmet | | | | | 881 | ric | | | | | 882 | Encryp | | | | | 883 | tion | | | | | 884 | Paddi | | | | | 885 | ng(OAEP | | | | | 886 | ) | | | | | 887 | Ellipti | ECDH | http://www.w3.org/2009/ | TBD | TB | 888 | cCurve | -ES | xmlenc11#ECDH-ES | | D | 889 | Diffie | | | | | 890 | -Hellma | | | | | 891 | n Ephem | | | | | 892 | eral | | | | | 893 | Stat | | | | | 894 | ic | | | | | 895 | Advance | A128 | http://www.w3.org/2001/ | TBD | TB | 896 | d | KW | 04/xmlenc#kw-aes128 | | D | 897 | Encryp | | | | | 898 | tion | | | | | 899 | Stand | | | | | 900 | ard(AES | | | | | 901 | ) Key | | | | | 902 | Wrap | | | | | 903 | Algo | | | | | 904 | rithm R | | | | | 905 | FC 339 | | | | | 906 | 4 [RF | | | | | 907 | C3394] | | | | | 908 | using12 | | | | | 909 | 8 bitke | | | | | 910 | ys | | | | | 911 | Advance | A256 | http://www.w3.org/2001/ | TBD | TB | 912 | d | KW | 04/xmlenc#kw-aes256 | | D | 913 | Encryp | | | | | 914 | tion | | | | | 915 | Stand | | | | | 916 | ard(AES | | | | | 917 | ) Key | | | | | 918 | Wrap | | | | | 919 | Algo | | | | | 920 | rithm R | | | | | 921 | FC 339 | | | | | 922 | 4 [RF | | | | | 923 | C3394] | | | | | 924 | using25 | | | | | 925 | 6 bitke | | | | | 926 | ys | | | | | 927 | Advance | A128 | http://www.w3.org/2001/ | AES/CBC/PKCS5Padd | TB | 928 | d | CBC | 04/xmlenc#aes128-cbc | ing | D | 929 | Encryp | | | | | 930 | tion | | | | | 931 | Stand | | | | | 932 | ard(AES | | | | | 933 | ) usin | | | | | 934 | g 128 | | | | | 935 | bitkeys | | | | | 936 | inCiph | | | | | 937 | er Bloc | | | | | 938 | k Chai | | | | | 939 | ningmod | | | | | 940 | e | | | | | 941 | Advance | A256 | http://www.w3.org/2001/ | AES/CBC/PKCS5Padd | TB | 942 | d | CBC | 04/xmlenc#aes256-cbc | ing | D | 943 | Encryp | | | | | 944 | tion | | | | | 945 | Stand | | | | | 946 | ard(AES | | | | | 947 | ) usin | | | | | 948 | g 256 | | | | | 949 | bitkeys | | | | | 950 | inCiph | | | | | 951 | er Bloc | | | | | 952 | k Chai | | | | | 953 | ningmod | | | | | 954 | e | | | | | 955 | Advance | A128 | http://www.w3.org/2009/ | AES/GCM/NoPadding | TB | 956 | d | GCM | xmlenc11#aes128-gcm | | D | 957 | Encryp | | | | | 958 | tion | | | | | 959 | Stand | | | | | 960 | ard(AES | | | | | 961 | ) usin | | | | | 962 | g 128 | | | | | 963 | bitkeys | | | | | 964 | inGalo | | | | | 965 | is/Coun | | | | | 966 | ter Mod | | | | | 967 | e | | | | | 968 | Advance | A256 | http://www.w3.org/2009/ | AES/GCM/NoPadding | TB | 969 | d | GCM | xmlenc11#aes256-gcm | | D | 970 | Encryp | | | | | 971 | tion | | | | | 972 | Stand | | | | | 973 | ard(AES | | | | | 974 | ) usin | | | | | 975 | g 256 | | | | | 976 | bitkeys | | | | | 977 | inGalo | | | | | 978 | is/Coun | | | | | 979 | ter Mod | | | | | 980 | e | | | | | 981 +---------+------+-------------------------+-------------------+----+ 983 Table 5: Algorithm Identifier Cross-Reference 985 Appendix C. Acknowledgements 987 Solutions for encrypting JSON content were also explored by [JSS] and 988 [I-D.rescorla-jsms], both of which significantly influenced this 989 draft. This draft attempts to explicitly reuse as much from 990 [W3C.CR-xmlenc-core1-20110303] and RFC 5652 [RFC5652] as possible, 991 while utilizing simple compact JSON-based data structures. 993 Special thanks are due to John Bradley and Nat Sakimura for the 994 discussions that helped inform the content of this specification and 995 to Eric Rescorla and Joe Hildebrand for allowing the reuse of some of 996 the text from [I-D.rescorla-jsms] in this document. 998 Appendix D. Document History 1000 -01 1001 o Changed type of Ephemeral Public Key ("epk") from string to JSON 1002 object, so that a JWK Key Object value can be used directly. 1004 o Specified that the Digest Method for ECDH-ES is SHA-256. (The 1005 specification was previously silent about the choice of digest 1006 method.) 1008 o The "jku" and "x5u" URLs are now required to be absolute URLs. 1010 o Removed this unnecessary language from the "kid" description: 1011 "Omitting this parameter is equivalent to setting it to an empty 1012 string". 1014 o Use the same language as RFC 2616 does when describing "GZIP" 1015 message compression. 1017 -00 1019 o First encryption draft based upon consensus decisions at IIW 1020 documented at http://self-issued.info/?p=378. The ability to 1021 provide encryption for JSON Web Tokens (JWTs) [JWT] is a primary 1022 use case. 1024 Authors' Addresses 1026 Michael B. Jones 1027 Microsoft 1029 Email: mbj@microsoft.com 1030 URI: http://self-issued.info/ 1032 Eric Rescorla 1033 RTFM, Inc. 1035 Email: ekr@rtfm.com 1037 Joe Hildebrand 1038 Cisco Systems, Inc. 1040 Email: jhildebr@cisco.com