idnits 2.17.1 draft-ietf-httpbis-encryption-encoding-06.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 22, 2016) is 2680 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. 'FIPS180-4' ** Downref: Normative reference to an Informational RFC: RFC 5869 ** Obsolete normative reference: RFC 7230 (Obsoleted by RFC 9110, RFC 9112) ** Obsolete normative reference: RFC 7231 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 7233 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7235 (Obsoleted by RFC 9110) -- Obsolete informational reference (is this intentional?): RFC 7540 (Obsoleted by RFC 9113) Summary: 3 errors (**), 0 flaws (~~), 1 warning (==), 6 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 HTTP Working Group M. Thomson 3 Internet-Draft Mozilla 4 Intended status: Standards Track December 22, 2016 5 Expires: June 25, 2017 7 Encrypted Content-Encoding for HTTP 8 draft-ietf-httpbis-encryption-encoding-06 10 Abstract 12 This memo introduces a content coding for HTTP that allows message 13 payloads to be encrypted. 15 Note to Readers 17 Discussion of this draft takes place on the HTTP working group 18 mailing list (ietf-http-wg@w3.org), which is archived at 19 https://lists.w3.org/Archives/Public/ietf-http-wg/ . 21 Working Group information can be found at http://httpwg.github.io/ ; 22 source code and issues list for this draft can be found at 23 https://github.com/httpwg/http-extensions/labels/encryption . 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 25, 2017. 42 Copyright Notice 44 Copyright (c) 2016 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 . . . . . . . . . . . . . . . . . . . . . . . . 2 60 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 3 61 2. The "aes128gcm" HTTP Content Coding . . . . . . . . . . . . . 3 62 2.1. Encryption Content Coding Header . . . . . . . . . . . . 5 63 2.2. Content Encryption Key Derivation . . . . . . . . . . . . 6 64 2.3. Nonce Derivation . . . . . . . . . . . . . . . . . . . . 6 65 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 7 66 3.1. Encryption of a Response . . . . . . . . . . . . . . . . 7 67 3.2. Encryption with Multiple Records . . . . . . . . . . . . 8 68 4. Security Considerations . . . . . . . . . . . . . . . . . . . 8 69 4.1. Key and Nonce Reuse . . . . . . . . . . . . . . . . . . . 9 70 4.2. Data Encryption Limits . . . . . . . . . . . . . . . . . 9 71 4.3. Content Integrity . . . . . . . . . . . . . . . . . . . . 10 72 4.4. Leaking Information in Headers . . . . . . . . . . . . . 10 73 4.5. Poisoning Storage . . . . . . . . . . . . . . . . . . . . 11 74 4.6. Sizing and Timing Attacks . . . . . . . . . . . . . . . . 11 75 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 76 5.1. The "aes128gcm" HTTP Content Coding . . . . . . . . . . . 11 77 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 78 6.1. Normative References . . . . . . . . . . . . . . . . . . 12 79 6.2. Informative References . . . . . . . . . . . . . . . . . 12 80 Appendix A. JWE Mapping . . . . . . . . . . . . . . . . . . . . 13 81 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 14 82 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 14 84 1. Introduction 86 It is sometimes desirable to encrypt the contents of a HTTP message 87 (request or response) so that when the payload is stored (e.g., with 88 a HTTP PUT), only someone with the appropriate key can read it. 90 For example, it might be necessary to store a file on a server 91 without exposing its contents to that server. Furthermore, that same 92 file could be replicated to other servers (to make it more resistant 93 to server or network failure), downloaded by clients (to make it 94 available offline), etc. without exposing its contents. 96 These uses are not met by the use of TLS [RFC5246], since it only 97 encrypts the channel between the client and server. 99 This document specifies a content coding (Section 3.1.2 of [RFC7231]) 100 for HTTP to serve these and other use cases. 102 This content coding is not a direct adaptation of message-based 103 encryption formats - such as those that are described by [RFC4880], 104 [RFC5652], [RFC7516], and [XMLENC] - which are not suited to stream 105 processing, which is necessary for HTTP. The format described here 106 cleaves more closely to the lower level constructs described in 107 [RFC5116]. 109 To the extent that message-based encryption formats use the same 110 primitives, the format can be considered as sequence of encrypted 111 messages with a particular profile. For instance, Appendix A 112 explains how the format is congruent with a sequence of JSON Web 113 Encryption [RFC7516] values with a fixed header. 115 This mechanism is likely only a small part of a larger design that 116 uses content encryption. How clients and servers acquire and 117 identify keys will depend on the use case. In particular, a key 118 management system is not described. 120 1.1. Notational Conventions 122 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 123 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 124 document are to be interpreted as described in [RFC2119]. 126 Base64url encoding is defined in Section 2 of [RFC7515]. 128 2. The "aes128gcm" HTTP Content Coding 130 The "aes128gcm" HTTP content coding indicates that a payload has been 131 encrypted using Advanced Encryption Standard (AES) in Galois/Counter 132 Mode (GCM) as identified as AEAD_AES_128_GCM in [RFC5116], 133 Section 5.1. The AEAD_AES_128_GCM algorithm uses a 128 bit content 134 encryption key. 136 Using this content coding requires knowledge of a key. How this key 137 is acquired is not defined in this document. 139 The "aes128gcm" content coding uses a single fixed set of encryption 140 primitives. Cipher suite agility is achieved by defining a new 141 content coding scheme. This ensures that only the HTTP Accept- 142 Encoding header field is necessary to negotiate the use of 143 encryption. 145 The "aes128gcm" content coding uses a fixed record size. The final 146 encoding consists of a header (see Section 2.1), zero or more fixed 147 size encrypted records, and a partial record. The partial record 148 MUST be shorter than the fixed record size. 150 The record size determines the length of each portion of plaintext 151 that is enciphered, with the exception of the final record, which is 152 necessarily smaller. The record size ("rs") is included in the 153 content coding header (see Section 2.1). 155 +-----------+ content of rs octets minus padding 156 | data | less padding (2-65537) and tag (16); 157 +-----------+ the last record is smaller 158 | 159 v 160 +-----+-----------+ add padding to get rs-16 octets; 161 | pad | data | the last record contains 162 +-----+-----------+ up to rs minus 17 octets 163 | 164 v 165 +--------------------+ encrypt with AEAD_AES_128_GCM; 166 | ciphertext | final size is rs; 167 +--------------------+ the last record is smaller 169 AEAD_AES_128_GCM produces ciphertext 16 octets longer than its input 170 plaintext. Therefore, the unencrypted content of each record is 171 shorter than the record size by 16 octets. If the final record ends 172 on a record boundary, the encoder MUST append a record that contains 173 contains only padding and is smaller than the full record size. A 174 receiver MUST fail to decrypt if the final record ciphertext is less 175 than 18 octets in size or equal to the record size. Valid records 176 always contain at least a padding length of 2 octets and a 16 octet 177 authentication tag. 179 Each record contains a 2 octet padding length and between 0 and 65535 180 octets of padding, inserted into a record before the content. The 181 padding length is a two octet unsigned integer in network byte order; 182 padding is that number of zero-valued octets. A receiver MUST fail 183 to decrypt if any padding octet is non-zero, or a record has more 184 padding than the record size can accommodate. 186 The nonce for each record is a 96-bit value constructed from the 187 record sequence number and the input keying material. Nonce 188 derivation is covered in Section 2.3. 190 The additional data passed to each invocation of AEAD_AES_128_GCM is 191 a zero-length octet sequence. 193 A consequence of this record structure is that range requests 194 [RFC7233] and random access to encrypted payload bodies are possible 195 at the granularity of the record size. Partial records at the ends 196 of a range cannot be decrypted. Thus, it is best if range requests 197 start and end on record boundaries. Note however that random access 198 to specific parts of encrypted data could be confounded by the 199 presence of padding. 201 Selecting the record size most appropriate for a given situation 202 requires a trade-off. A smaller record size allows decrypted octets 203 to be released more rapidly, which can be appropriate for 204 applications that depend on responsiveness. Smaller records also 205 reduce the additional data required if random access into the 206 ciphertext is needed. Applications that depend on being able to pad 207 by arbitrary amounts cannot increase the record size beyond 65537 208 octets. 210 Applications that don't depending on streaming, random access, or 211 arbitrary padding can use larger records, or even a single record. A 212 larger record size reduces the processing and data overheads. 214 2.1. Encryption Content Coding Header 216 The content coding uses a header block that includes all parameters 217 needed to decrypt the content (other than the key). The header block 218 is placed in the body of a message ahead of the sequence of records. 220 +-----------+--------+-----------+---------------+ 221 | salt (16) | rs (4) | idlen (1) | keyid (idlen) | 222 +-----------+--------+-----------+---------------+ 224 salt: The "salt" parameter comprises the first 16 octets of the 225 "aes128gcm" content coding header. The same "salt" parameter 226 value MUST NOT be reused for two different payload bodies that 227 have the same input keying material; generating a random salt for 228 every application of the content coding ensures that content 229 encryption key reuse is highly unlikely. 231 rs: The "rs" or record size parameter contains an unsigned 32-bit 232 integer in network byte order that describes the record size in 233 octets. Note that it is therefore impossible to exceed the 234 2^36-31 limit on plaintext input to AEAD_AES_128_GCM. Values 235 smaller than 19 are invalid. 237 keyid: The "keyid" parameter can be used to identify the keying 238 material that is used. Recipients that receive a message are 239 expected to know how to retrieve keys; the "keyid" parameter might 240 be input to that process. A "keyid" parameter SHOULD be a UTF-8 241 [RFC3629] encoded string, particularly where the identifier might 242 need to appear in a textual form. 244 2.2. Content Encryption Key Derivation 246 In order to allow the reuse of keying material for multiple different 247 HTTP messages, a content encryption key is derived for each message. 248 The content encryption key is derived from the "salt" parameter using 249 the HMAC-based key derivation function (HKDF) described in [RFC5869] 250 using the SHA-256 hash algorithm [FIPS180-4]. 252 The value of the "salt" parameter is the salt input to HKDF function. 253 The keying material identified by the "keyid" parameter is the input 254 keying material (IKM) to HKDF. Input keying material is expected to 255 be provided to recipients separately. The extract phase of HKDF 256 therefore produces a pseudorandom key (PRK) as follows: 258 PRK = HMAC-SHA-256(salt, IKM) 260 The info parameter to HKDF is set to the ASCII-encoded string 261 "Content-Encoding: aes128gcm" and a single zero octet: 263 cek_info = "Content-Encoding: aes128gcm" || 0x00 265 Note: Concatenation of octet sequences is represented by the "||" 266 operator. 268 AEAD_AES_128_GCM requires a 16 octet (128 bit) content encryption key 269 (CEK), so the length (L) parameter to HKDF is 16. The second step of 270 HKDF can therefore be simplified to the first 16 octets of a single 271 HMAC: 273 CEK = HMAC-SHA-256(PRK, cek_info || 0x01) 275 2.3. Nonce Derivation 277 The nonce input to AEAD_AES_128_GCM is constructed for each record. 278 The nonce for each record is a 12 octet (96 bit) value that is 279 produced from the record sequence number and a value derived from the 280 input keying material. 282 The input keying material and salt values are input to HKDF with 283 different info and length parameters. 285 The length (L) parameter is 12 octets. The info parameter for the 286 nonce is the ASCII-encoded string "Content-Encoding: nonce", 287 terminated by a a single zero octet: 289 nonce_info = "Content-Encoding: nonce" || 0x00 291 The result is combined with the record sequence number - using 292 exclusive or - to produce the nonce. The record sequence number 293 (SEQ) is a 96-bit unsigned integer in network byte order that starts 294 at zero. 296 Thus, the final nonce for each record is a 12 octet value: 298 NONCE = HMAC-SHA-256(PRK, nonce_info || 0x01) XOR SEQ 300 This nonce construction prevents removal or reordering of records. 301 However, it permits truncation of the tail of the sequence (see 302 Section 2 for how this is avoided). 304 3. Examples 306 This section shows a few examples of the encrypted content coding. 308 Note: All binary values in the examples in this section use base64url 309 encoding [RFC7515]. This includes the bodies of requests. 310 Whitespace and line wrapping is added to fit formatting constraints. 312 3.1. Encryption of a Response 314 Here, a successful HTTP GET response has been encrypted. This uses a 315 record size of 4096 and no padding (just the 2 octet padding length), 316 so only a partial record is present. The input keying material is 317 identified by an empty string (that is, the "keyid" field in the 318 header is zero octets in length). 320 The encrypted data in this example is the UTF-8 encoded string "I am 321 the walrus". The input keying material is the value 322 "B33e_VeFrOyIHwFTIfmesA" (in base64url). The content body contains a 323 single record and is shown here using base64url encoding for 324 presentation reasons. 326 HTTP/1.1 200 OK 327 Content-Type: application/octet-stream 328 Content-Length: 54 329 Content-Encoding: aes128gcm 331 sJvlboCWzB5jr8hI_q9cOQAAEAAANSmxkSVa0-MiNNuF77YHSs-iwaNe_OK0qfmO 332 c7NT5WSW 334 Note that the media type has been changed to "application/octet- 335 stream" to avoid exposing information about the content. 336 Alternatively (and equivalently), the Content-Type header field can 337 be omitted. 339 Intermediate values for this example (all shown in base64): 341 salt (from header) = sJvlboCWzB5jr8hI_q9cOQ 342 PRK = MLAQxt_DHjM15cdlyU1oUnjq7TFlzToGTkdRmvvxVBw 343 CEK = v31u7VGV3soO3wNaMaIdhg 344 NONCE = XOaygzko98zjUFTJ 345 plaintext = AABJIGFtIHRoZSB3YWxydXM 347 3.2. Encryption with Multiple Records 349 This example shows the same message with input keying material of 350 "BO3ZVPxUlnLORbVGMpbT1Q". In this example, the plaintext is split 351 into records of 26 octets each (that is, the "rs" field in the header 352 is 26). The first record includes a single octet of padding. This 353 means that there are 7 octets of message in the first record, and 8 354 in the second. This causes the end of the content to align with a 355 record boundary, forcing the creation of a third record that contains 356 only two octets of the padding length. 358 HTTP/1.1 200 OK 359 Content-Length: 93 360 Content-Encoding: aes128gcm 362 uNCkWiNYzKTnBN9ji3-qWAAAABoCYTGHOqYFz-0in3dpb-VE2GfBngkaPy6bZus_ 363 qLF79s6zQyTSsA0iLOKyd3JqVIwprNzVatRCWZGUx_qsFbJBCQu62RqQuR2d 365 4. Security Considerations 367 This mechanism assumes the presence of a key management framework 368 that is used to manage the distribution of keys between valid senders 369 and receivers. Defining key management is part of composing this 370 mechanism into a larger application, protocol, or framework. 372 Implementation of cryptography - and key management in particular - 373 can be difficult. For instance, implementations need to account for 374 the potential for exposing keying material on side channels, such as 375 might be exposed by the time it takes to perform a given operation. 376 The requirements for a good implementation of cryptographic 377 algorithms can change over time. 379 4.1. Key and Nonce Reuse 381 Encrypting different plaintext with the same content encryption key 382 and nonce in AES-GCM is not safe [RFC5116]. The scheme defined here 383 uses a fixed progression of nonce values. Thus, a new content 384 encryption key is needed for every application of the content coding. 385 Since input keying material can be reused, a unique "salt" parameter 386 is needed to ensure a content encryption key is not reused. 388 If a content encryption key is reused - that is, if input keying 389 material and salt are reused - this could expose the plaintext and 390 the authentication key, nullifying the protection offered by 391 encryption. Thus, if the same input keying material is reused, then 392 the salt parameter MUST be unique each time. This ensures that the 393 content encryption key is not reused. An implementation SHOULD 394 generate a random salt parameter for every message; a counter could 395 achieve the same result. 397 4.2. Data Encryption Limits 399 There are limits to the data that AEAD_AES_128_GCM can encipher. The 400 maximum value for the record size is limited by the size of the "rs" 401 field in the header (see Section 2.1), which ensures that the 2^36-31 402 limit for a single application of AEAD_AES_128_GCM is not reached 403 [RFC5116]. In order to preserve a 2^-40 probability of 404 indistinguishability under chosen plaintext attack (IND-CPA), the 405 total amount of plaintext that can be enciphered MUST be less than 406 2^44.5 blocks of 16 octets [AEBounds]. 408 If the record size is a multiple of 16 octets, this means 398 409 terabytes can be encrypted safely, including padding and overhead. 410 However, if the record size is not a multiple of 16 octets, the total 411 amount of data that can be safely encrypted is reduced because 412 partial AES blocks are encrypted. The worst case is a record size of 413 19 octets, for which at most 74 terabytes of plaintext can be 414 encrypted, of which at least two-thirds is padding. 416 4.3. Content Integrity 418 This mechanism only provides content origin authentication. The 419 authentication tag only ensures that an entity with access to the 420 content encryption key produced the encrypted data. 422 Any entity with the content encryption key can therefore produce 423 content that will be accepted as valid. This includes all recipients 424 of the same HTTP message. 426 Furthermore, any entity that is able to modify both the Encryption 427 header field and the HTTP message body can replace the contents. 428 Without the content encryption key or the input keying material, 429 modifications to or replacement of parts of a payload body are not 430 possible. 432 4.4. Leaking Information in Headers 434 Because only the payload body is encrypted, information exposed in 435 header fields is visible to anyone who can read the HTTP message. 436 This could expose side-channel information. 438 For example, the Content-Type header field can leak information about 439 the payload body. 441 There are a number of strategies available to mitigate this threat, 442 depending upon the application's threat model and the users' 443 tolerance for leaked information: 445 1. Determine that it is not an issue. For example, if it is 446 expected that all content stored will be "application/json", or 447 another very common media type, exposing the Content-Type header 448 field could be an acceptable risk. 450 2. If it is considered sensitive information and it is possible to 451 determine it through other means (e.g., out of band, using hints 452 in other representations, etc.), omit the relevant headers, and/ 453 or normalize them. In the case of Content-Type, this could be 454 accomplished by always sending Content-Type: application/octet- 455 stream (the most generic media type), or no Content-Type at all. 457 3. If it is considered sensitive information and it is not possible 458 to convey it elsewhere, encapsulate the HTTP message using the 459 application/http media type (Section 8.3.2 of [RFC7230]), 460 encrypting that as the payload of the "outer" message. 462 4.5. Poisoning Storage 464 This mechanism only offers encryption of content; it does not perform 465 authentication or authorization, which still needs to be performed 466 (e.g., by HTTP authentication [RFC7235]). 468 This is especially relevant when a HTTP PUT request is accepted by a 469 server; if the request is unauthenticated, it becomes possible for a 470 third party to deny service and/or poison the store. 472 4.6. Sizing and Timing Attacks 474 Applications using this mechanism need to be aware that the size of 475 encrypted messages, as well as their timing, HTTP methods, URIs and 476 so on, may leak sensitive information. 478 This risk can be mitigated through the use of the padding that this 479 mechanism provides. Alternatively, splitting up content into 480 segments and storing the separately might reduce exposure. HTTP/2 481 [RFC7540] combined with TLS [RFC5246] might be used to hide the size 482 of individual messages. 484 Developing a padding strategy is difficult. A good padding strategy 485 can depend on context. Common strategies include padding to a small 486 set of fixed lengths, padding to multiples of a values, or padding to 487 powers of 2. Even a good strategy can still cause size information 488 to leak if processing activity of a recipient can be observed. This 489 is especially true if the trailing records of a message contain only 490 padding. Distributing non-padding data is recommended to avoid 491 leaking size information. 493 5. IANA Considerations 495 5.1. The "aes128gcm" HTTP Content Coding 497 This memo registers the "aes128gcm" HTTP content coding in the HTTP 498 Content Codings Registry, as detailed in Section 2. 500 o Name: aes128gcm 502 o Description: AES-GCM encryption with a 128-bit content encryption 503 key 505 o Reference: this specification 507 6. References 509 6.1. Normative References 511 [FIPS180-4] 512 Department of Commerce, National., "NIST FIPS 180-4, 513 Secure Hash Standard", March 2012, 514 . 517 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 518 Requirement Levels", BCP 14, RFC 2119, 519 DOI 10.17487/RFC2119, March 1997, 520 . 522 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 523 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 524 2003, . 526 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 527 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 528 . 530 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 531 Key Derivation Function (HKDF)", RFC 5869, 532 DOI 10.17487/RFC5869, May 2010, 533 . 535 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 536 Protocol (HTTP/1.1): Message Syntax and Routing", 537 RFC 7230, DOI 10.17487/RFC7230, June 2014, 538 . 540 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 541 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 542 DOI 10.17487/RFC7231, June 2014, 543 . 545 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 546 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 547 2015, . 549 6.2. Informative References 551 [AEBounds] 552 Luykx, A. and K. Paterson, "Limits on Authenticated 553 Encryption Use in TLS", March 2016, 554 . 556 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 557 Thayer, "OpenPGP Message Format", RFC 4880, 558 DOI 10.17487/RFC4880, November 2007, 559 . 561 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 562 (TLS) Protocol Version 1.2", RFC 5246, 563 DOI 10.17487/RFC5246, August 2008, 564 . 566 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 567 RFC 5652, DOI 10.17487/RFC5652, September 2009, 568 . 570 [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 571 "Hypertext Transfer Protocol (HTTP/1.1): Range Requests", 572 RFC 7233, DOI 10.17487/RFC7233, June 2014, 573 . 575 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 576 Protocol (HTTP/1.1): Authentication", RFC 7235, 577 DOI 10.17487/RFC7235, June 2014, 578 . 580 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 581 RFC 7516, DOI 10.17487/RFC7516, May 2015, 582 . 584 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 585 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 586 DOI 10.17487/RFC7540, May 2015, 587 . 589 [XMLENC] Eastlake, D., Reagle, J., Hirsch, F., Roessler, T., 590 Imamura, T., Dillaway, B., Simon, E., Yiu, K., and M. 591 Nystroem, "XML Encryption Syntax and Processing", W3C 592 Recommendation REC-xmlenc-core1-20130411 , January 2013, 593 . 595 Appendix A. JWE Mapping 597 The "aes128gcm" content coding can be considered as a sequence of 598 JSON Web Encryption (JWE) objects [RFC7516], each corresponding to a 599 single fixed size record that includes leading padding. The 600 following transformations are applied to a JWE object that might be 601 expressed using the JWE Compact Serialization: 603 o The JWE Protected Header is fixed to the value { "alg": "dir", 604 "enc": "A128GCM" }, describing direct encryption using AES-GCM 605 with a 128-bit content encryption key. This header is not 606 transmitted, it is instead implied by the value of the Content- 607 Encoding header field. 609 o The JWE Encrypted Key is empty, as stipulated by the direct 610 encryption algorithm. 612 o The JWE Initialization Vector ("iv") for each record is set to the 613 exclusive or of the 96-bit record sequence number, starting at 614 zero, and a value derived from the input keying material (see 615 Section 2.3). This value is also not transmitted. 617 o The final value is the concatenated header, JWE Ciphertext, and 618 JWE Authentication Tag, all expressed without base64url encoding. 619 The "." separator is omitted, since the length of these fields is 620 known. 622 Thus, the example in Section 3.1 can be rendered using the JWE 623 Compact Serialization as: 625 eyAiYWxnIjogImRpciIsICJlbmMiOiAiQTEyOEdDTSIgfQ..31iQYc1v4a36EgyJ. 626 NSmxkSVa0-MiNNuF77YHSs8.osGjXvzitKn5jnOzU-Vklg 628 Where the first line represents the fixed JWE Protected Header, an 629 empty JWE Encrypted Key, and the algorithmically-determined JWE 630 Initialization Vector. The second line contains the encoded body, 631 split into JWE Ciphertext and JWE Authentication Tag. 633 Appendix B. Acknowledgements 635 Mark Nottingham was an original author of this document. 637 The following people provided valuable input: Richard Barnes, David 638 Benjamin, Peter Beverloo, JR Conlin, Mike Jones, Stephen Farrell, 639 Adam Langley, John Mattsson, Julian Reschke, Eric Rescorla, Jim 640 Schaad, and Magnus Westerlund. 642 Author's Address 644 Martin Thomson 645 Mozilla 647 Email: martin.thomson@gmail.com