idnits 2.17.1 draft-ietf-httpbis-encryption-encoding-05.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 21, 2016) is 2676 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 21, 2016 5 Expires: June 24, 2017 7 Encrypted Content-Encoding for HTTP 8 draft-ietf-httpbis-encryption-encoding-05 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 24, 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 . . . . . . . . . . . . . . . . . . . . 9 72 4.4. Leaking Information in Headers . . . . . . . . . . . . . 10 73 4.5. Poisoning Storage . . . . . . . . . . . . . . . . . . . . 10 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 . . . . . . . . . . . . . . . . . . . . . . . . . 11 78 6.1. Normative References . . . . . . . . . . . . . . . . . . 11 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 is rs octets minus padding 156 | data | of between 2 and 65537 octets; 157 +-----------+ the last record is smaller 158 | 159 v 160 +-----+-----------+ add padding to get rs octets; 161 | pad | data | the last record contains 162 +-----+-----------+ up to rs minus 1 octets 163 | 164 v 165 +--------------------+ encrypt with AEAD_AES_128_GCM; 166 | ciphertext | final size is rs plus 16 octets 167 +--------------------+ the last record is smaller 169 AEAD_AES_128_GCM produces ciphertext 16 octets longer than its input 170 plaintext. Therefore, the length of each enciphered record other 171 than the last is equal to the value of the "rs" parameter plus 16 172 octets. If the final record ends on a record boundary, the encoder 173 MUST append a record that contains contains only padding and is 174 smaller than the full record size. A receiver MUST fail to decrypt 175 if the final record ciphertext is less than 18 octets in size or 176 equal to the record size plus 16 (that is, the size of a full 177 encrypted record). Valid records always contain at least two octets 178 of padding and a 16 octet authentication tag. 180 Each record contains a 2 octet padding length field and between 0 and 181 65535 octets of padding, inserted into a record before the enciphered 182 content. The padding length is a two octet unsigned integer in 183 network byte order; padding is that number of zero-valued octets. A 184 receiver MUST fail to decrypt if any padding octet is non-zero, or a 185 record has more padding than the record size can accommodate. 187 The nonce for each record is a 96-bit value constructed from the 188 record sequence number and the input keying material. Nonce 189 derivation is covered in Section 2.3. 191 The additional data passed to each invocation of AEAD_AES_128_GCM is 192 a zero-length octet sequence. 194 A consequence of this record structure is that range requests 195 [RFC7233] and random access to encrypted payload bodies are possible 196 at the granularity of the record size. Partial records at the ends 197 of a range cannot be decrypted. Thus, it is best if range requests 198 start and end on record boundaries. Note however that random access 199 to specific parts of encrypted data could be confounded by the 200 presence of padding. 202 Selecting the record size most appropriate for a given situation 203 requires a trade-off. A smaller record size allows decrypted octets 204 to be released more rapidly, which can be appropriate for 205 applications that depend on responsiveness. Smaller records also 206 reduce the additional data required if random access into the 207 ciphertext is needed. Applications that depend on being able to pad 208 by arbitrary amounts cannot increase the record size beyond 65537 209 octets. 211 Applications that don't depending on streaming, random access, or 212 arbitrary padding can use larger records, or even a single record. A 213 larger record size reduces the processing and data overheads. 215 2.1. Encryption Content Coding Header 217 The content coding uses a header block that includes all parameters 218 needed to decrypt the content (other than the key). The header block 219 is placed in the body of a message ahead of the sequence of records. 221 +-----------+--------+-----------+---------------+ 222 | salt (16) | rs (4) | idlen (1) | keyid (idlen) | 223 +-----------+--------+-----------+---------------+ 225 salt: The "salt" parameter comprises the first 16 octets of the 226 "aes128gcm" content coding header. The same "salt" parameter 227 value MUST NOT be reused for two different payload bodies that 228 have the same input keying material; generating a random salt for 229 every application of the content coding ensures that content 230 encryption key reuse is highly unlikely. 232 rs: The "rs" or record size parameter contains an unsigned 32-bit 233 integer in network byte order that describes the record size in 234 octets. Note that it is therefore impossible to exceed the 235 2^36-31 limit on plaintext input to AEAD_AES_128_GCM. Values 236 smaller than 3 are invalid. 238 keyid: The "keyid" parameter can be used to identify the keying 239 material that is used. Recipients that receive a message are 240 expected to know how to retrieve keys; the "keyid" parameter might 241 be input to that process. 243 2.2. Content Encryption Key Derivation 245 In order to allow the reuse of keying material for multiple different 246 HTTP messages, a content encryption key is derived for each message. 247 The content encryption key is derived from the "salt" parameter using 248 the HMAC-based key derivation function (HKDF) described in [RFC5869] 249 using the SHA-256 hash algorithm [FIPS180-4]. 251 The value of the "salt" parameter is the salt input to HKDF function. 252 The keying material identified by the "keyid" parameter is the input 253 keying material (IKM) to HKDF. Input keying material is expected to 254 be provided to recipients separately. The extract phase of HKDF 255 therefore produces a pseudorandom key (PRK) as follows: 257 PRK = HMAC-SHA-256(salt, IKM) 259 The info parameter to HKDF is set to the ASCII-encoded string 260 "Content-Encoding: aes128gcm" and a single zero octet: 262 cek_info = "Content-Encoding: aes128gcm" || 0x00 264 Note: Concatenation of octet sequences is represented by the "||" 265 operator. 267 AEAD_AES_128_GCM requires a 16 octet (128 bit) content encryption key 268 (CEK), so the length (L) parameter to HKDF is 16. The second step of 269 HKDF can therefore be simplified to the first 16 octets of a single 270 HMAC: 272 CEK = HMAC-SHA-256(PRK, cek_info || 0x01) 274 2.3. Nonce Derivation 276 The nonce input to AEAD_AES_128_GCM is constructed for each record. 277 The nonce for each record is a 12 octet (96 bit) value that is 278 produced from the record sequence number and a value derived from the 279 input keying material. 281 The input keying material and salt values are input to HKDF with 282 different info and length parameters. 284 The length (L) parameter is 12 octets. The info parameter for the 285 nonce is the ASCII-encoded string "Content-Encoding: nonce", 286 terminated by a a single zero octet: 288 nonce_info = "Content-Encoding: nonce" || 0x00 290 The result is combined with the record sequence number - using 291 exclusive or - to produce the nonce. The record sequence number 292 (SEQ) is a 96-bit unsigned integer in network byte order that starts 293 at zero. 295 Thus, the final nonce for each record is a 12 octet value: 297 NONCE = HMAC-SHA-256(PRK, nonce_info || 0x01) XOR SEQ 299 This nonce construction prevents removal or reordering of records. 300 However, it permits truncation of the tail of the sequence (see 301 Section 2 for how this is avoided). 303 3. Examples 305 This section shows a few examples of the encrypted content coding. 307 Note: All binary values in the examples in this section use base64url 308 encoding [RFC7515]. This includes the bodies of requests. 309 Whitespace and line wrapping is added to fit formatting constraints. 311 3.1. Encryption of a Response 313 Here, a successful HTTP GET response has been encrypted. This uses a 314 record size of 4096 and no padding (just the 2 octet padding length), 315 so only a partial record is present. The input keying material is 316 identified by an empty string (that is, the "keyid" field in the 317 header is zero octets in length). 319 The encrypted data in this example is the UTF-8 encoded string "I am 320 the walrus". The input keying material is the value 321 "B33e_VeFrOyIHwFTIfmesA" (in base64url). The content body contains a 322 single record and is shown here using base64url encoding for 323 presentation reasons. 325 HTTP/1.1 200 OK 326 Content-Type: application/octet-stream 327 Content-Length: 54 328 Content-Encoding: aes128gcm 330 sJvlboCWzB5jr8hI_q9cOQAAEAAANSmxkSVa0-MiNNuF77YHSs-iwaNe_OK0qfmO 331 c7NT5WSW 333 Note that the media type has been changed to "application/octet- 334 stream" to avoid exposing information about the content. 335 Alternatively (and equivalently), the Content-Type header field can 336 be omitted. 338 Intermediate values for this example (all shown in base64): 340 salt (from header) = sJvlboCWzB5jr8hI_q9cOQ 341 PRK = MLAQxt_DHjM15cdlyU1oUnjq7TFlzToGTkdRmvvxVBw 342 CEK = v31u7VGV3soO3wNaMaIdhg 343 NONCE = XOaygzko98zjUFTJ 344 plaintext = AABJIGFtIHRoZSB3YWxydXM 346 3.2. Encryption with Multiple Records 348 This example shows the same message with input keying material of 349 "BO3ZVPxUlnLORbVGMpbT1Q". In this example, the plaintext is split 350 into records of 10 octets each (that is, the "rs" field in the header 351 is 10). The first record includes a single octet of padding. This 352 means that there are 7 octets of message in the first record, and 8 353 in the second. This causes the end of the content to align with a 354 record boundary, forcing the creation of a third record that contains 355 only two octets of the padding length. 357 HTTP/1.1 200 OK 358 Content-Length: 93 359 Content-Encoding: aes128gcm 361 uNCkWiNYzKTnBN9ji3-qWAAAAAoCYTGHOqYFz-0in3dpb-VE2GfBngkaPy6bZus_ 362 qLF79s6zQyTSsA0iLOKyd3JqVIwprNzVatRCWZGUx_qsFbJBCQu62RqQuR2d 364 4. Security Considerations 366 This mechanism assumes the presence of a key management framework 367 that is used to manage the distribution of keys between valid senders 368 and receivers. Defining key management is part of composing this 369 mechanism into a larger application, protocol, or framework. 371 Implementation of cryptography - and key management in particular - 372 can be difficult. For instance, implementations need to account for 373 the potential for exposing keying material on side channels, such as 374 might be exposed by the time it takes to perform a given operation. 375 The requirements for a good implementation of cryptographic 376 algorithms can change over time. 378 4.1. Key and Nonce Reuse 380 Encrypting different plaintext with the same content encryption key 381 and nonce in AES-GCM is not safe [RFC5116]. The scheme defined here 382 uses a fixed progression of nonce values. Thus, a new content 383 encryption key is needed for every application of the content coding. 384 Since input keying material can be reused, a unique "salt" parameter 385 is needed to ensure a content encryption key is not reused. 387 If a content encryption key is reused - that is, if input keying 388 material and salt are reused - this could expose the plaintext and 389 the authentication key, nullifying the protection offered by 390 encryption. Thus, if the same input keying material is reused, then 391 the salt parameter MUST be unique each time. This ensures that the 392 content encryption key is not reused. An implementation SHOULD 393 generate a random salt parameter for every message; a counter could 394 achieve the same result. 396 4.2. Data Encryption Limits 398 There are limits to the data that AEAD_AES_128_GCM can encipher. The 399 maximum value for the record size is limited by the size of the "rs" 400 field in the header (see Section 2.1), which ensures that the 2^36-31 401 limit for a single application of AEAD_AES_128_GCM is not reached 402 [RFC5116]. In order to preserve a 2^-40 probability of 403 indistinguishability under chosen plaintext attack (IND-CPA), the 404 total amount of plaintext that can be enciphered MUST be less than 405 2^44.5 blocks of 16 octets [AEBounds]. 407 If rs is a multiple of 16 octets, this means 398 terabytes can be 408 encrypted safely, including padding and overhead. However, if the 409 record size is not a multiple of 16 octets, the total amount of data 410 that can be safely encrypted is reduced proportionally. The worst 411 case is a record size of 3 octets, for which at most 74 terabytes of 412 plaintext can be encrypted, of which at least two-thirds is padding. 414 4.3. Content Integrity 416 This mechanism only provides content origin authentication. The 417 authentication tag only ensures that an entity with access to the 418 content encryption key produced the encrypted data. 420 Any entity with the content encryption key can therefore produce 421 content that will be accepted as valid. This includes all recipients 422 of the same HTTP message. 424 Furthermore, any entity that is able to modify both the Encryption 425 header field and the HTTP message body can replace the contents. 426 Without the content encryption key or the input keying material, 427 modifications to or replacement of parts of a payload body are not 428 possible. 430 4.4. Leaking Information in Headers 432 Because only the payload body is encrypted, information exposed in 433 header fields is visible to anyone who can read the HTTP message. 434 This could expose side-channel information. 436 For example, the Content-Type header field can leak information about 437 the payload body. 439 There are a number of strategies available to mitigate this threat, 440 depending upon the application's threat model and the users' 441 tolerance for leaked information: 443 1. Determine that it is not an issue. For example, if it is 444 expected that all content stored will be "application/json", or 445 another very common media type, exposing the Content-Type header 446 field could be an acceptable risk. 448 2. If it is considered sensitive information and it is possible to 449 determine it through other means (e.g., out of band, using hints 450 in other representations, etc.), omit the relevant headers, and/ 451 or normalize them. In the case of Content-Type, this could be 452 accomplished by always sending Content-Type: application/octet- 453 stream (the most generic media type), or no Content-Type at all. 455 3. If it is considered sensitive information and it is not possible 456 to convey it elsewhere, encapsulate the HTTP message using the 457 application/http media type (Section 8.3.2 of [RFC7230]), 458 encrypting that as the payload of the "outer" message. 460 4.5. Poisoning Storage 462 This mechanism only offers encryption of content; it does not perform 463 authentication or authorization, which still needs to be performed 464 (e.g., by HTTP authentication [RFC7235]). 466 This is especially relevant when a HTTP PUT request is accepted by a 467 server; if the request is unauthenticated, it becomes possible for a 468 third party to deny service and/or poison the store. 470 4.6. Sizing and Timing Attacks 472 Applications using this mechanism need to be aware that the size of 473 encrypted messages, as well as their timing, HTTP methods, URIs and 474 so on, may leak sensitive information. 476 This risk can be mitigated through the use of the padding that this 477 mechanism provides. Alternatively, splitting up content into 478 segments and storing the separately might reduce exposure. HTTP/2 479 [RFC7540] combined with TLS [RFC5246] might be used to hide the size 480 of individual messages. 482 Developing a padding strategy is difficult. A good padding strategy 483 can depend on context. Common strategies include padding to a small 484 set of fixed lengths, padding to multiples of a values, or padding to 485 powers of 2. Even a good strategy can still cause size information 486 to leak if processing activity of a recipient can be observed. This 487 is especially true if the trailing records of a message contain only 488 padding. Distributing non-padding data is recommended to avoid 489 leaking size information. 491 5. IANA Considerations 493 5.1. The "aes128gcm" HTTP Content Coding 495 This memo registers the "aes128gcm" HTTP content coding in the HTTP 496 Content Codings Registry, as detailed in Section 2. 498 o Name: aes128gcm 500 o Description: AES-GCM encryption with a 128-bit content encryption 501 key 503 o Reference: this specification 505 6. References 507 6.1. Normative References 509 [FIPS180-4] 510 Department of Commerce, National., "NIST FIPS 180-4, 511 Secure Hash Standard", March 2012, 512 . 515 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 516 Requirement Levels", BCP 14, RFC 2119, 517 DOI 10.17487/RFC2119, March 1997, 518 . 520 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 521 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 522 . 524 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 525 Key Derivation Function (HKDF)", RFC 5869, 526 DOI 10.17487/RFC5869, May 2010, 527 . 529 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 530 Protocol (HTTP/1.1): Message Syntax and Routing", 531 RFC 7230, DOI 10.17487/RFC7230, June 2014, 532 . 534 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 535 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 536 DOI 10.17487/RFC7231, June 2014, 537 . 539 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 540 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 541 2015, . 543 6.2. Informative References 545 [AEBounds] 546 Luykx, A. and K. Paterson, "Limits on Authenticated 547 Encryption Use in TLS", March 2016, 548 . 550 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 551 Thayer, "OpenPGP Message Format", RFC 4880, 552 DOI 10.17487/RFC4880, November 2007, 553 . 555 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 556 (TLS) Protocol Version 1.2", RFC 5246, 557 DOI 10.17487/RFC5246, August 2008, 558 . 560 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 561 RFC 5652, DOI 10.17487/RFC5652, September 2009, 562 . 564 [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 565 "Hypertext Transfer Protocol (HTTP/1.1): Range Requests", 566 RFC 7233, DOI 10.17487/RFC7233, June 2014, 567 . 569 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 570 Protocol (HTTP/1.1): Authentication", RFC 7235, 571 DOI 10.17487/RFC7235, June 2014, 572 . 574 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 575 RFC 7516, DOI 10.17487/RFC7516, May 2015, 576 . 578 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 579 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 580 DOI 10.17487/RFC7540, May 2015, 581 . 583 [XMLENC] Eastlake, D., Reagle, J., Hirsch, F., Roessler, T., 584 Imamura, T., Dillaway, B., Simon, E., Yiu, K., and M. 585 Nystroem, "XML Encryption Syntax and Processing", W3C 586 Recommendation REC-xmlenc-core1-20130411 , January 2013, 587 . 589 Appendix A. JWE Mapping 591 The "aes128gcm" content coding can be considered as a sequence of 592 JSON Web Encryption (JWE) objects [RFC7516], each corresponding to a 593 single fixed size record that includes leading padding. The 594 following transformations are applied to a JWE object that might be 595 expressed using the JWE Compact Serialization: 597 o The JWE Protected Header is fixed to the value { "alg": "dir", 598 "enc": "A128GCM" }, describing direct encryption using AES-GCM 599 with a 128-bit content encryption key. This header is not 600 transmitted, it is instead implied by the value of the Content- 601 Encoding header field. 603 o The JWE Encrypted Key is empty, as stipulated by the direct 604 encryption algorithm. 606 o The JWE Initialization Vector ("iv") for each record is set to the 607 exclusive or of the 96-bit record sequence number, starting at 608 zero, and a value derived from the input keying material (see 609 Section 2.3). This value is also not transmitted. 611 o The final value is the concatenated header, JWE Ciphertext, and 612 JWE Authentication Tag, all expressed without base64url encoding. 613 The "." separator is omitted, since the length of these fields is 614 known. 616 Thus, the example in Section 3.1 can be rendered using the JWE 617 Compact Serialization as: 619 eyAiYWxnIjogImRpciIsICJlbmMiOiAiQTEyOEdDTSIgfQ..31iQYc1v4a36EgyJ. 620 NSmxkSVa0-MiNNuF77YHSs8.osGjXvzitKn5jnOzU-Vklg 622 Where the first line represents the fixed JWE Protected Header, an 623 empty JWE Encrypted Key, and the algorithmically-determined JWE 624 Initialization Vector. The second line contains the encoded body, 625 split into JWE Ciphertext and JWE Authentication Tag. 627 Appendix B. Acknowledgements 629 Mark Nottingham was an original author of this document. 631 The following people provided valuable input: Richard Barnes, David 632 Benjamin, Peter Beverloo, JR Conlin, Mike Jones, Stephen Farrell, 633 Adam Langley, John Mattsson, Julian Reschke, Eric Rescorla, Jim 634 Schaad, and Magnus Westerlund. 636 Author's Address 638 Martin Thomson 639 Mozilla 641 Email: martin.thomson@gmail.com