idnits 2.17.1 draft-jones-json-web-encryption-02.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 (December 13, 2011) is 4516 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. '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) ** Downref: Normative reference to an Informational RFC: RFC 6090 ** Obsolete normative reference: RFC 6125 (Obsoleted by RFC 9525) Summary: 11 errors (**), 0 flaws (~~), 1 warning (==), 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: June 15, 2012 RTFM, Inc. 6 J. Hildebrand 7 Cisco Systems, Inc. 8 December 13, 2011 10 JSON Web Encryption (JWE) 11 draft-jones-json-web-encryption-02 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 June 15, 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 . . . . . . . . . . . . . . . . . . . . 19 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 representing 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. 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 (with line breaks for 189 display purposes only): 190 eyJhbGciOiJSU0ExXzUiLA0KICJlbmMiOiJBMjU2R0NNIiwNCiAiaXYiOiJfXzc5 191 X1B2Ni1mZyIsDQogIng1dCI6Ijdub09QcS1oSjFfaENudldoNkllWUkydzlRMCJ9 193 TBD: Finish this example by showing generation of a Content 194 Encryption Key (CEK), using the CEK to encrypt the Plaintext to 195 produce the Ciphertext (and base64url encoding it), and using the 196 recipient's key to encrypt the CEK to produce the JWE Encrypted Key 197 (and base64url encoding it). 199 4. JWE Header 201 The members of the JSON object represented by the JWE Header describe 202 the encryption applied to the Plaintext and optionally additional 203 properties of the JWE. The Header Parameter Names within this object 204 MUST be unique. Implementations MUST understand the entire contents 205 of the header; otherwise, the JWE MUST be rejected for processing. 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 defined "alg" | 228 | | | | values is presented in | 229 | | | | Table 3. The processing of | 230 | | | | the "alg" (algorithm) header | 231 | | | | parameter requires that the | 232 | | | | value MUST be one that is both | 233 | | | | supported and for which there | 234 | | | | exists a key for use with that | 235 | | | | algorithm associated with the | 236 | | | | intended recipient. The "alg" | 237 | | | | value is case sensitive. This | 238 | | | | header parameter is REQUIRED. | 239 | enc | string | StringOrURI | The "enc" (encryption method) | 240 | | | | header parameter identifies | 241 | | | | the symmetric encryption | 242 | | | | algorithm used to secure the | 243 | | | | Ciphertext. A list of defined | 244 | | | | "enc" values is presented in | 245 | | | | Table 4. The processing of | 246 | | | | the "enc" (encryption method) | 247 | | | | header parameter requires that | 248 | | | | the value MUST be one that is | 249 | | | | supported. The "enc" value is | 250 | | | | case sensitive. This header | 251 | | | | parameter is REQUIRED. | 252 | iv | string | String | Initialization Vector ("iv") | 253 | | | | value for algorithms requiring | 254 | | | | it, represented as a base64url | 255 | | | | encoded string. This header | 256 | | | | parameter is OPTIONAL. | 257 | epk | object | JWK Key | Ephemeral Public Key ("epk") | 258 | | | Object | value created by the | 259 | | | | originator for the use in | 260 | | | | ECDH-ES RFC 6090 [RFC6090] | 261 | | | | encryption. This key is | 262 | | | | represented in the same manner | 263 | | | | as a JSON Web Key [JWK] JWK | 264 | | | | Key Object value, containing | 265 | | | | "crv" (curve), "x", and "y" | 266 | | | | members. The inclusion of the | 267 | | | | JWK Key Object "alg" | 268 | | | | (algorithm) member is | 269 | | | | OPTIONAL. This header | 270 | | | | parameter is OPTIONAL. | 271 | zip | string | String | Compression algorithm ("zip") | 272 | | | | applied to the Plaintext | 273 | | | | before encryption, if any. | 274 | | | | This specification defines the | 275 | | | | value "GZIP" to refer to the | 276 | | | | encoding format produced by | 277 | | | | the file compression program | 278 | | | | "gzip" (GNU zip) as described | 279 | | | | in [RFC1952]; this format is a | 280 | | | | Lempel-Ziv coding (LZ77) with | 281 | | | | a 32 bit CRC. If no "zip" | 282 | | | | parameter is present, or its | 283 | | | | value is "none", no | 284 | | | | compression is applied to the | 285 | | | | Plaintext before encryption. | 286 | | | | The "zip" value is case | 287 | | | | sensitive. This header | 288 | | | | parameter is OPTIONAL. | 289 | jku | string | URL | The "jku" (JSON Web Key URL) | 290 | | | | header parameter is an | 291 | | | | absolute URL that refers to a | 292 | | | | resource for a set of | 293 | | | | JSON-encoded public keys, one | 294 | | | | of which corresponds to the | 295 | | | | key that was used to encrypt | 296 | | | | the JWE. The keys MUST be | 297 | | | | encoded as described in the | 298 | | | | JSON Web Key (JWK) [JWK] | 299 | | | | specification. The protocol | 300 | | | | used to acquire the resource | 301 | | | | MUST provide integrity | 302 | | | | protection. An HTTP GET | 303 | | | | request to retrieve the | 304 | | | | certificate MUST use TLS RFC | 305 | | | | 2818 [RFC2818] RFC 5246 | 306 | | | | [RFC5246] with server | 307 | | | | authentication RFC 6125 | 308 | | | | [RFC6125]. This header | 309 | | | | parameter is OPTIONAL. | 310 | kid | string | String | The "kid" (key ID) header | 311 | | | | parameter is a hint indicating | 312 | | | | which key was used to encrypt | 313 | | | | the JWE. This allows | 314 | | | | originators to explicitly | 315 | | | | signal a change of key to | 316 | | | | recipients. The | 317 | | | | interpretation of the contents | 318 | | | | of the "kid" parameter is | 319 | | | | unspecified. This header | 320 | | | | parameter is OPTIONAL. | 321 | x5u | string | URL | The "x5u" (X.509 URL) header | 322 | | | | parameter is an absolute URL | 323 | | | | that refers to a resource for | 324 | | | | the X.509 public key | 325 | | | | certificate or certificate | 326 | | | | chain corresponding to the key | 327 | | | | used to encrypt the JWE. The | 328 | | | | identified resource MUST | 329 | | | | provide a representation of | 330 | | | | the certificate or certificate | 331 | | | | chain that conforms to RFC | 332 | | | | 5280 [RFC5280] in PEM encoded | 333 | | | | form RFC 1421 [RFC1421]. The | 334 | | | | protocol used to acquire the | 335 | | | | resource MUST provide | 336 | | | | integrity protection. An HTTP | 337 | | | | GET request to retrieve the | 338 | | | | certificate MUST use TLS RFC | 339 | | | | 2818 [RFC2818] RFC 5246 | 340 | | | | [RFC5246] with server | 341 | | | | authentication RFC 6125 | 342 | | | | [RFC6125]. This header | 343 | | | | parameter is OPTIONAL. | 344 | x5t | string | String | The "x5t" (x.509 certificate | 345 | | | | thumbprint) header parameter | 346 | | | | provides a base64url encoded | 347 | | | | SHA-1 thumbprint (a.k.a. | 348 | | | | digest) of the DER encoding of | 349 | | | | the X.509 certificate that | 350 | | | | corresponds to the key that | 351 | | | | was used to encrypt the JWE. | 352 | | | | This header parameter is | 353 | | | | OPTIONAL. | 354 | typ | string | String | The "typ" (type) header | 355 | | | | parameter is used to declare | 356 | | | | the type of the encrypted | 357 | | | | content. The "typ" value is | 358 | | | | case sensitive. This header | 359 | | | | parameter is OPTIONAL. | 360 +-----------+--------+-------------+--------------------------------+ 362 Table 1: Reserved Header Parameter Definitions 364 Additional reserved header parameter names MAY be defined via the 365 IANA JSON Web Encryption Header Parameters registry, as per 366 Section 10. The syntax values used above are defined as follows: 368 +-------------+-----------------------------------------------------+ 369 | Syntax Name | Syntax Definition | 370 +-------------+-----------------------------------------------------+ 371 | String | Any string value MAY be used. | 372 | StringOrURI | Any string value MAY be used but a value containing | 373 | | a ":" character MUST be a URI as defined in RFC | 374 | | 3986 [RFC3986]. | 375 | URL | A URL as defined in RFC 1738 [RFC1738]. | 376 +-------------+-----------------------------------------------------+ 378 Table 2: Header Parameter Syntax Definitions 380 4.2. Public Header Parameter Names 382 Additional header parameter names can be defined by those using JWE. 383 However, in order to prevent collisions, any new header parameter 384 name or algorithm value SHOULD either be defined in the IANA JSON Web 385 Encryption Header Parameters registry or be defined as a URI that 386 contains a collision resistant namespace. In each case, the definer 387 of the name or value needs to take reasonable precautions to make 388 sure they are in control of the part of the namespace they use to 389 define the header parameter name. 391 New header parameters should be introduced sparingly, as they can 392 result in non-interoperable JWEs. 394 4.3. Private Header Parameter Names 396 A producer and consumer of a JWE may agree to any header parameter 397 name that is not a Reserved Name Section 4.1 or a Public Name 398 Section 4.2. Unlike Public Names, these private names are subject to 399 collision and should be used with caution. 401 New header parameters should be introduced sparingly, as they can 402 result in non-interoperable JWEs. 404 5. Message Encryption 406 The message encryption process is as follows: 408 1. Generate a random Content Encryption Key (CEK). The CEK MUST 409 have a length at least equal to that of the required encryption 410 keys and MUST be generated randomly. See RFC 4086 [RFC4086] for 411 considerations on generating random values. 413 2. Encrypt the CEK for the recipient (see Section 7). 415 3. Generate a random IV (if required for the algorithm). 417 4. Compress the Plaintext if a "zip" parameter was included. 419 5. Serialize the (compressed) Plaintext into a bitstring M. 421 6. Encrypt M using the CEK and IV to form the bitstring C. 423 7. Set the Encoded JWE Ciphertext equal to the base64url encoded 424 representation of C. 426 8. Create a JWE Header containing the encryption parameters used. 427 Note that white space is explicitly allowed in the 428 representation and no canonicalization is performed before 429 encoding. 431 9. Base64url encode the bytes of the UTF-8 representation of the 432 JWE Header to 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 defined by this specification. These algorithms are used to 508 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 Defined "alg" Parameter Values 537 The table below Table 4 is the set of "enc" header parameter values 538 that are defined by this specification. These algorithms are used to 539 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 Defined "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 using each specified 571 algorithm go 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, it 580 is permissible to use the algorithm identifiers defined in XML 581 Encryption [W3C.REC-xmlenc-core-20021210], XML Encryption 1.1 582 [W3C.CR-xmlenc-core1-20110303], and related specifications as "alg" 583 and "enc" values. 585 10. IANA Considerations 587 This specification calls for: 589 o A new IANA registry entitled "JSON Web Encryption Header 590 Parameters" for reserved header parameter names is defined in 591 Section 4.1. Inclusion in the registry is RFC Required in the RFC 592 5226 [RFC5226] sense for reserved JWE header parameter names that 593 are intended to be interoperable between implementations. The 594 registry will just record the reserved header parameter name and a 595 pointer to the RFC that defines it. This specification defines 596 inclusion of the header parameter names defined in Table 1. 598 o A new IANA registry entitled "JSON Web Encryption Algorithms" for 599 values used with the "alg" and "enc" header parameters is defined 600 in Section 9.2. Inclusion in the registry is RFC Required in the 601 RFC 5226 [RFC5226] sense. The registry will record the "alg" or 602 "enc" value and a pointer to the RFC that defines it. This 603 specification defines inclusion of the algorithm values defined in 604 Table 3 and Table 4. 606 11. Security Considerations 608 TBD: Lots of work to do here. We need to remember to look into any 609 issues relating to security and JSON parsing. One wonders just how 610 secure most JSON parsing libraries are. Were they ever hardened for 611 security scenarios? If not, what kind of holes does that open up? 612 Also, we need to walk through the JSON standard and see what kind of 613 issues we have especially around comparison of names. For instance, 614 comparisons of header parameter names and other parameters must occur 615 after they are unescaped. Need to also put in text about: Importance 616 of keeping secrets secret. Rotating keys. Strengths and weaknesses 617 of the different algorithms. 619 TBD: Need to put in text about why strict JSON validation is 620 necessary. Basically, that if malformed JSON is received then the 621 intent of the sender is impossible to reliably discern. One example 622 of malformed JSON that MUST be rejected is an object in which the 623 same member name occurs multiple times. 625 TBD: We need a section on generating randomness in browsers - it's 626 easy to screw up. 628 When utilizing TLS to retrieve information, the authority providing 629 the resource MUST be authenticated and the information retrieved MUST 630 be free from modification. 632 11.1. Unicode Comparison Security Issues 634 Header parameter names in JWEs are Unicode strings. For security 635 reasons, the representations of these names must be compared verbatim 636 after performing any escape processing (as per RFC 4627 [RFC4627], 637 Section 2.5). 639 This means, for instance, that these JSON strings must compare as 640 being equal ("enc", "\u0065nc"), whereas these must all compare as 641 being not equal to the first set or to each other ("ENC", "Enc", 642 "en\u0043"). 644 JSON strings MAY contain characters outside the Unicode Basic 645 Multilingual Plane. For instance, the G clef character (U+1D11E) may 646 be represented in a JSON string as "\uD834\uDD1E". Ideally, JWE 647 implementations SHOULD ensure that characters outside the Basic 648 Multilingual Plane are preserved and compared correctly; 649 alternatively, if this is not possible due to these characters 650 exercising limitations present in the underlying JSON implementation, 651 then input containing them MUST be rejected. 653 12. Open Issues and Things To Be Done (TBD) 655 The following items remain to be done in this draft: 657 o Describe the relationship between the JWE, JWS, and JWT header 658 parameters. In particular, point out that the set of "alg" values 659 defined by each must be compatible and non-overlapping. 661 o Consider whether we want to define composite signing/encryption 662 operations (as was the consensus to do at IIW, as documented at 663 http://self-issued.info/?p=378). This would provide both 664 confidentiality and integrity. 666 o Consider whether reusing the JWS "jku", "kid", "x5u", and "x5t" 667 parameters is the right thing to do, particularly as it 668 effectively precludes specifying composite operations. 670 o Consider whether to add parameters for directly including keys in 671 the header, either as JWK Key Objects, or X.509 cert values, or 672 both. 674 o Consider whether to add version numbers. 676 o Consider which of the open issues from the JWS and JWT specs also 677 apply here. 679 o Think about how to best describe the concept currently described 680 as "the bytes of the UTF-8 representation of". Possible terms to 681 use instead of "bytes of" include "byte sequence", "octet series", 682 and "octet sequence". Also consider whether we want to add an 683 overall clarifying statement somewhere in each spec something like 684 "every place we say 'the UTF-8 representation of X', we mean 'the 685 bytes of the UTF-8 representation of X'". That would potentially 686 allow us to omit the "the bytes of" part everywhere else. 688 o Finish the Security Considerations section. 690 o Write a note in the Security Considerations section about how 691 "x5t" (x.509 certificate thumbprint) should be deprecated because 692 of known problems with SHA-1. 694 o Should StringOrURI use IRIs rather than RFC 3986 URIs? 695 o Provide a more robust description of the use of the IV. The 696 current statement "For GCM, the random 64-bit IV is prepended to 697 the ciphertext" in the Symmetric Encryption section is almost 698 certainly out of place. 700 o It would be good to say somewhere, in normative language, that 701 eventually the algorithms and/or key sizes currently specified 702 will no longer be considered sufficiently secure and will be 703 removed. Therefore, implementers MUST be prepared for this 704 eventuality. 706 o Should we define the use of RFC 5649 key wrapping functions, which 707 allow arbitrary key sizes, in addition to the current use of RFC 708 3394 key wrapping functions, which require that keys be multiples 709 of 64 bits? Is this needed in practice? 711 13. References 713 13.1. Normative References 715 [FIPS-197] 716 National Institute of Standards and Technology (NIST), 717 "Advanced Encryption Standard (AES)", FIPS PUB 197, 718 November 2001. 720 [JWK] Jones, M., "JSON Web Key (JWK)", December 2011. 722 [JWS] Jones, M., Balfanz, D., Bradley, J., Goland, Y., Panzer, 723 J., Sakimura, N., and P. Tarjan, "JSON Web Signature 724 (JWS)", December 2011. 726 [NIST-800-38A] 727 National Institute of Standards and Technology (NIST), 728 "Recommendation for Block Cipher Modes of Operation", 729 NIST PUB 800-38A, December 2001. 731 [NIST-800-38D] 732 National Institute of Standards and Technology (NIST), 733 "Recommendation for Block Cipher Modes of Operation: 734 Galois/Counter Mode (GCM) and GMAC", NIST PUB 800-38D, 735 December 2001. 737 [NIST-800-56A] 738 National Institute of Standards and Technology (NIST), 739 "Recommendation for Pair-Wise Key Establishment Schemes 740 Using Discrete Logarithm Cryptography (Revised)", NIST PUB 741 800-56A, March 2007. 743 [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic 744 Mail: Part I: Message Encryption and Authentication 745 Procedures", RFC 1421, February 1993. 747 [RFC1738] Berners-Lee, T., Masinter, L., and M. McCahill, "Uniform 748 Resource Locators (URL)", RFC 1738, December 1994. 750 [RFC1952] Deutsch, P., Gailly, J-L., Adler, M., Deutsch, L., and G. 751 Randers-Pehrson, "GZIP file format specification version 752 4.3", RFC 1952, May 1996. 754 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 755 Requirement Levels", BCP 14, RFC 2119, March 1997. 757 [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000. 759 [RFC3394] Schaad, J. and R. Housley, "Advanced Encryption Standard 760 (AES) Key Wrap Algorithm", RFC 3394, September 2002. 762 [RFC3447] Jonsson, J. and B. Kaliski, "Public-Key Cryptography 763 Standards (PKCS) #1: RSA Cryptography Specifications 764 Version 2.1", RFC 3447, February 2003. 766 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 767 10646", STD 63, RFC 3629, November 2003. 769 [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform 770 Resource Identifier (URI): Generic Syntax", STD 66, 771 RFC 3986, January 2005. 773 [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness 774 Requirements for Security", BCP 106, RFC 4086, June 2005. 776 [RFC4627] Crockford, D., "The application/json Media Type for 777 JavaScript Object Notation (JSON)", RFC 4627, July 2006. 779 [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data 780 Encodings", RFC 4648, October 2006. 782 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 783 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 784 May 2008. 786 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 787 (TLS) Protocol Version 1.2", RFC 5246, August 2008. 789 [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., 790 Housley, R., and W. Polk, "Internet X.509 Public Key 791 Infrastructure Certificate and Certificate Revocation List 792 (CRL) Profile", RFC 5280, May 2008. 794 [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic 795 Curve Cryptography Algorithms", RFC 6090, February 2011. 797 [RFC6125] Saint-Andre, P. and J. Hodges, "Representation and 798 Verification of Domain-Based Application Service Identity 799 within Internet Public Key Infrastructure Using X.509 800 (PKIX) Certificates in the Context of Transport Layer 801 Security (TLS)", RFC 6125, March 2011. 803 13.2. Informative References 805 [I-D.rescorla-jsms] 806 Rescorla, E. and J. Hildebrand, "JavaScript Message 807 Security Format", draft-rescorla-jsms-00 (work in 808 progress), March 2011. 810 [JCA] Oracle, "Java Cryptography Architecture", 2011. 812 [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", 813 September 2010. 815 [JWT] Jones, M., Balfanz, D., Bradley, J., Goland, Y., Panzer, 816 J., Sakimura, N., and P. Tarjan, "JSON Web Token (JWT)", 817 December 2011. 819 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 820 RFC 5652, September 2009. 822 [W3C.CR-xmlenc-core1-20110303] 823 Hirsch, F., Roessler, T., Reagle, J., and D. Eastlake, 824 "XML Encryption Syntax and Processing Version 1.1", World 825 Wide Web Consortium CR CR-xmlenc-core1-20110303, 826 March 2011, 827 . 829 [W3C.REC-xmlenc-core-20021210] 830 Eastlake, D. and J. Reagle, "XML Encryption Syntax and 831 Processing", World Wide Web Consortium Recommendation REC- 832 xmlenc-core-20021210, December 2002, 833 . 835 Appendix A. JWE Examples 837 This section provides several examples of JWEs. 839 A.1. JWE Example using TBD Algorithm 841 A.1.1. Encrypting 843 TBD: Demonstrate encryption steps with this algorithm 845 A.1.2. Decrypting 847 TBD: Demonstrate decryption steps with this algorithm 849 Appendix B. Algorithm Identifier Cross-Reference 851 This appendix contains a table cross-referencing the "alg" and "enc" 852 values used in this specification with the equivalent identifiers 853 used by other standards and software packages. See XML Encryption 854 [W3C.REC-xmlenc-core-20021210], XML Encryption 1.1 855 [W3C.CR-xmlenc-core1-20110303], and Java Cryptography Architecture 856 [JCA] for more information about the names defined by those 857 documents. 859 +---------+-------+---------------------------+---------------------+ 860 | Algorit | JWE | XML ENC | JCA | 861 | hm | | | | 862 +---------+-------+---------------------------+---------------------+ 863 | RSA | RSA1_ | http://www.w3.org/2001/04 | RSA/ECB/PKCS1Paddin | 864 | using | 5 | /xmlenc#rsa-1_5 | g | 865 | RSA-PKC | | | | 866 | S1-1.5 | | | | 867 | paddin | | | | 868 | g | | | | 869 | RSA | RSA-O | http://www.w3.org/2001/04 | RSA/ECB/OAEPWithSHA | 870 | using | AEP | /xmlenc#rsa-oaep-mgf1p | -1AndMGF1Padding | 871 | Optimal | | | | 872 | Asymmet | | | | 873 | ric | | | | 874 | Encryp | | | | 875 | tion | | | | 876 | Paddi | | | | 877 | ng(OAEP | | | | 878 | ) | | | | 879 | Ellipti | ECDH- | http://www.w3.org/2009/xm | TBD | 880 | cCurve | ES | lenc11#ECDH-ES | | 881 | Diffie | | | | 882 | -Hellma | | | | 883 | n Ephem | | | | 884 | eral | | | | 885 | Stat | | | | 886 | ic | | | | 887 | Advance | A128K | http://www.w3.org/2001/04 | TBD | 888 | d | W | /xmlenc#kw-aes128 | | 889 | Encryp | | | | 890 | tion | | | | 891 | Stand | | | | 892 | ard(AES | | | | 893 | ) Key | | | | 894 | Wrap | | | | 895 | Algo | | | | 896 | rithm R | | | | 897 | FC 339 | | | | 898 | 4 [RF | | | | 899 | C3394] | | | | 900 | using12 | | | | 901 | 8 bitke | | | | 902 | ys | | | | 903 | Advance | A256K | http://www.w3.org/2001/04 | TBD | 904 | d | W | /xmlenc#kw-aes256 | | 905 | Encryp | | | | 906 | tion | | | | 907 | Stand | | | | 908 | ard(AES | | | | 909 | ) Key | | | | 910 | Wrap | | | | 911 | Algo | | | | 912 | rithm R | | | | 913 | FC 339 | | | | 914 | 4 [RF | | | | 915 | C3394] | | | | 916 | using25 | | | | 917 | 6 bitke | | | | 918 | ys | | | | 919 | Advance | A128C | http://www.w3.org/2001/04 | AES/CBC/PKCS5Paddin | 920 | d | BC | /xmlenc#aes128-cbc | g | 921 | Encryp | | | | 922 | tion | | | | 923 | Stand | | | | 924 | ard(AES | | | | 925 | ) usin | | | | 926 | g 128 | | | | 927 | bitkeys | | | | 928 | inCiph | | | | 929 | er Bloc | | | | 930 | k Chai | | | | 931 | ningmod | | | | 932 | e | | | | 933 | Advance | A256C | http://www.w3.org/2001/04 | AES/CBC/PKCS5Paddin | 934 | d | BC | /xmlenc#aes256-cbc | g | 935 | Encryp | | | | 936 | tion | | | | 937 | Stand | | | | 938 | ard(AES | | | | 939 | ) usin | | | | 940 | g 256 | | | | 941 | bitkeys | | | | 942 | inCiph | | | | 943 | er Bloc | | | | 944 | k Chai | | | | 945 | ningmod | | | | 946 | e | | | | 947 | Advance | A128G | http://www.w3.org/2009/xm | AES/GCM/NoPadding | 948 | d | CM | lenc11#aes128-gcm | | 949 | Encryp | | | | 950 | tion | | | | 951 | Stand | | | | 952 | ard(AES | | | | 953 | ) usin | | | | 954 | g 128 | | | | 955 | bitkeys | | | | 956 | inGalo | | | | 957 | is/Coun | | | | 958 | ter Mod | | | | 959 | e | | | | 960 | Advance | A256G | http://www.w3.org/2009/xm | AES/GCM/NoPadding | 961 | d | CM | lenc11#aes256-gcm | | 962 | Encryp | | | | 963 | tion | | | | 964 | Stand | | | | 965 | ard(AES | | | | 966 | ) usin | | | | 967 | g 256 | | | | 968 | bitkeys | | | | 969 | inGalo | | | | 970 | is/Coun | | | | 971 | ter Mod | | | | 972 | e | | | | 973 +---------+-------+---------------------------+---------------------+ 975 Table 5: Algorithm Identifier Cross-Reference 977 Appendix C. Acknowledgements 979 Solutions for encrypting JSON content were also explored by [JSS] and 980 [I-D.rescorla-jsms], both of which significantly influenced this 981 draft. This draft attempts to explicitly reuse as much from XML 982 Encryption 1.1 [W3C.CR-xmlenc-core1-20110303] and RFC 5652 [RFC5652] 983 as possible, while utilizing simple compact JSON-based data 984 structures. 986 Special thanks are due to John Bradley and Nat Sakimura for the 987 discussions that helped inform the content of this specification and 988 to Eric Rescorla and Joe Hildebrand for allowing the reuse of some of 989 the text from [I-D.rescorla-jsms] in this document. 991 Appendix D. Document History 993 -02 995 o Update to use short JWK Key Object names in Ephemeral Public Keys. 997 o Moved "MUST" requirements from the Overview to later in the spec. 999 o Respect line length restrictions in examples. 1001 o Applied other editorial improvements. 1003 -01 1004 o Changed type of Ephemeral Public Key ("epk") from string to JSON 1005 object, so that a JWK Key Object value can be used directly. 1007 o Specified that the Digest Method for ECDH-ES is SHA-256. (The 1008 specification was previously silent about the choice of digest 1009 method.) 1011 o The "jku" and "x5u" URLs are now required to be absolute URLs. 1013 o Removed this unnecessary language from the "kid" description: 1014 "Omitting this parameter is equivalent to setting it to an empty 1015 string". 1017 o Use the same language as RFC 2616 does when describing "GZIP" 1018 message compression. 1020 -00 1022 o First encryption draft based upon consensus decisions at IIW 1023 documented at http://self-issued.info/?p=378. The ability to 1024 provide encryption for JSON Web Tokens (JWTs) [JWT] is a primary 1025 use case. 1027 Authors' Addresses 1029 Michael B. Jones 1030 Microsoft 1032 Email: mbj@microsoft.com 1033 URI: http://self-issued.info/ 1035 Eric Rescorla 1036 RTFM, Inc. 1038 Email: ekr@rtfm.com 1040 Joe Hildebrand 1041 Cisco Systems, Inc. 1043 Email: jhildebr@cisco.com