idnits 2.17.1 draft-ietf-httpbis-encryption-encoding-07.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 (February 13, 2017) is 2629 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 February 13, 2017 5 Expires: August 17, 2017 7 Encrypted Content-Encoding for HTTP 8 draft-ietf-httpbis-encryption-encoding-07 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 August 17, 2017. 42 Copyright Notice 44 Copyright (c) 2017 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. Message Truncation . . . . . . . . . . . . . . . . . . . 9 70 4.2. Key and Nonce Reuse . . . . . . . . . . . . . . . . . . . 9 71 4.3. Data Encryption Limits . . . . . . . . . . . . . . . . . 9 72 4.4. Content Integrity . . . . . . . . . . . . . . . . . . . . 10 73 4.5. Leaking Information in Header Fields . . . . . . . . . . 10 74 4.6. Poisoning Storage . . . . . . . . . . . . . . . . . . . . 11 75 4.7. Sizing and Timing Attacks . . . . . . . . . . . . . . . . 11 76 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 11 77 5.1. The "aes128gcm" HTTP Content Coding . . . . . . . . . . . 11 78 6. References . . . . . . . . . . . . . . . . . . . . . . . . . 12 79 6.1. Normative References . . . . . . . . . . . . . . . . . . 12 80 6.2. Informative References . . . . . . . . . . . . . . . . . 13 81 Appendix A. JWE Mapping . . . . . . . . . . . . . . . . . . . . 14 82 Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 14 83 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 15 85 1. Introduction 87 It is sometimes desirable to encrypt the contents of a HTTP message 88 (request or response) so that when the payload is stored (e.g., with 89 a HTTP PUT), only someone with the appropriate key can read it. 91 For example, it might be necessary to store a file on a server 92 without exposing its contents to that server. Furthermore, that same 93 file could be replicated to other servers (to make it more resistant 94 to server or network failure), downloaded by clients (to make it 95 available offline), etc. without exposing its contents. 97 These uses are not met by the use of TLS [RFC5246], since it only 98 encrypts the channel between the client and server. 100 This document specifies a content coding (Section 3.1.2 of [RFC7231]) 101 for HTTP to serve these and other use cases. 103 This content coding is not a direct adaptation of message-based 104 encryption formats - such as those that are described by [RFC4880], 105 [RFC5652], [RFC7516], and [XMLENC] - which are not suited to stream 106 processing, which is necessary for HTTP. The format described here 107 follows more closely to the lower level constructs described in 108 [RFC5116]. 110 To the extent that message-based encryption formats use the same 111 primitives, the format can be considered as sequence of encrypted 112 messages with a particular profile. For instance, Appendix A 113 explains how the format is congruent with a sequence of JSON Web 114 Encryption [RFC7516] values with a fixed header. 116 This mechanism is likely only a small part of a larger design that 117 uses content encryption. How clients and servers acquire and 118 identify keys will depend on the use case. In particular, a key 119 management system is not described. 121 1.1. Notational Conventions 123 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 124 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 125 document are to be interpreted as described in [RFC2119]. 127 Base64url encoding is defined in Section 2 of [RFC7515]. 129 2. The "aes128gcm" HTTP Content Coding 131 The "aes128gcm" HTTP content coding indicates that a payload has been 132 encrypted using Advanced Encryption Standard (AES) in Galois/Counter 133 Mode (GCM) as identified as AEAD_AES_128_GCM in [RFC5116], 134 Section 5.1. The AEAD_AES_128_GCM algorithm uses a 128 bit content 135 encryption key. 137 Using this content coding requires knowledge of a key. How this key 138 is acquired is not defined in this document. 140 The "aes128gcm" content coding uses a single fixed set of encryption 141 primitives. Cipher suite agility is achieved by defining a new 142 content coding scheme. This ensures that only the HTTP Accept- 143 Encoding header field is necessary to negotiate the use of 144 encryption. 146 The "aes128gcm" content coding uses a fixed record size. The final 147 encoding consists of a header (see Section 2.1) and zero or more 148 fixed size encrypted records; the final record can be smaller than 149 the record size. 151 The record size determines the length of each portion of plaintext 152 that is enciphered. The record size ("rs") is included in the 153 content coding header (see Section 2.1). 155 +-----------+ content 156 | data | any length up to rs-17 octets 157 +-----------+ 158 | 159 v 160 +-----------+-----+ add a delimiter octet (0x01 or 0x02) 161 | data | pad | the 0x00-valued octets to rs-16 162 +-----------+-----+ (or less on the last record) 163 | 164 v 165 +--------------------+ encrypt with AEAD_AES_128_GCM; 166 | ciphertext | final size is rs; 167 +--------------------+ the last record can be 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. Valid records always 172 contain at least a padding delimiter octet and a 16 octet 173 authentication tag. 175 Each record contains a single padding delimiter octet followed by any 176 number of zero octets. The last record uses a padding delimiter 177 octet set to the value 2, all other records have a padding delimiter 178 octet value of 1. A decrypter MUST fail if the unencrypted content 179 of a record is all zero-valued. A decrypter MUST fail if the last 180 record contains a padding delimiter with a value other than 2; a 181 decrypter MUST fail if any record other than the last contains a 182 padding delimiter with a value other than 1. 184 The nonce for each record is a 96-bit value constructed from the 185 record sequence number and the input keying material. Nonce 186 derivation is covered in Section 2.3. 188 The additional data passed to each invocation of AEAD_AES_128_GCM is 189 a zero-length octet sequence. 191 A consequence of this record structure is that range requests 192 [RFC7233] and random access to encrypted payload bodies are possible 193 at the granularity of the record size. Partial records at the ends 194 of a range cannot be decrypted. Thus, it is best if range requests 195 start and end on record boundaries. Note however that random access 196 to specific parts of encrypted data could be confounded by the 197 presence of padding. 199 Selecting the record size most appropriate for a given situation 200 requires a trade-off. A smaller record size allows decrypted octets 201 to be released more rapidly, which can be appropriate for 202 applications that depend on responsiveness. Smaller records also 203 reduce the additional data required if random access into the 204 ciphertext is needed. 206 Applications that don't depending on streaming, random access, or 207 arbitrary padding can use larger records, or even a single record. A 208 larger record size reduces processing and data overheads. 210 2.1. Encryption Content Coding Header 212 The content coding uses a header block that includes all parameters 213 needed to decrypt the content (other than the key). The header block 214 is placed in the body of a message ahead of the sequence of records. 216 +-----------+--------+-----------+---------------+ 217 | salt (16) | rs (4) | idlen (1) | keyid (idlen) | 218 +-----------+--------+-----------+---------------+ 220 salt: The "salt" parameter comprises the first 16 octets of the 221 "aes128gcm" content coding header. The same "salt" parameter 222 value MUST NOT be reused for two different payload bodies that 223 have the same input keying material; generating a random salt for 224 every application of the content coding ensures that content 225 encryption key reuse is highly unlikely. 227 rs: The "rs" or record size parameter contains an unsigned 32-bit 228 integer in network byte order that describes the record size in 229 octets. Note that it is therefore impossible to exceed the 230 2^36-31 limit on plaintext input to AEAD_AES_128_GCM. Values 231 smaller than 18 are invalid. 233 keyid: The "keyid" parameter can be used to identify the keying 234 material that is used. Recipients that receive a message are 235 expected to know how to retrieve keys; the "keyid" parameter might 236 be input to that process. A "keyid" parameter SHOULD be a UTF-8 237 [RFC3629] encoded string, particularly where the identifier might 238 need to appear in a textual form. 240 2.2. Content Encryption Key Derivation 242 In order to allow the reuse of keying material for multiple different 243 HTTP messages, a content encryption key is derived for each message. 244 The content encryption key is derived from the "salt" parameter using 245 the HMAC-based key derivation function (HKDF) described in [RFC5869] 246 using the SHA-256 hash algorithm [FIPS180-4]. 248 The value of the "salt" parameter is the salt input to HKDF function. 249 The keying material identified by the "keyid" parameter is the input 250 keying material (IKM) to HKDF. Input keying material is expected to 251 be provided to recipients separately. The extract phase of HKDF 252 therefore produces a pseudorandom key (PRK) as follows: 254 PRK = HMAC-SHA-256(salt, IKM) 256 The info parameter to HKDF is set to the ASCII-encoded string 257 "Content-Encoding: aes128gcm" and a single zero octet: 259 cek_info = "Content-Encoding: aes128gcm" || 0x00 261 Note: Concatenation of octet sequences is represented by the "||" 262 operator. 264 AEAD_AES_128_GCM requires a 16 octet (128 bit) content encryption key 265 (CEK), so the length (L) parameter to HKDF is 16. The second step of 266 HKDF can therefore be simplified to the first 16 octets of a single 267 HMAC: 269 CEK = HMAC-SHA-256(PRK, cek_info || 0x01) 271 2.3. Nonce Derivation 273 The nonce input to AEAD_AES_128_GCM is constructed for each record. 274 The nonce for each record is a 12 octet (96 bit) value that is 275 derived from the record sequence number, input keying material, and 276 salt. 278 The input keying material and salt values are input to HKDF with 279 different info and length parameters. 281 The length (L) parameter is 12 octets. The info parameter for the 282 nonce is the ASCII-encoded string "Content-Encoding: nonce", 283 terminated by a a single zero octet: 285 nonce_info = "Content-Encoding: nonce" || 0x00 287 The result is combined with the record sequence number - using 288 exclusive or - to produce the nonce. The record sequence number 289 (SEQ) is a 96-bit unsigned integer in network byte order that starts 290 at zero. 292 Thus, the final nonce for each record is a 12 octet value: 294 NONCE = HMAC-SHA-256(PRK, nonce_info || 0x01) XOR SEQ 296 This nonce construction prevents removal or reordering of records. 297 However, it permits truncation of the tail of the sequence (see 298 Section 2 for how this is avoided). 300 3. Examples 302 This section shows a few examples of the encrypted content coding. 304 Note: All binary values in the examples in this section use base64url 305 encoding [RFC7515]. This includes the bodies of requests. 306 Whitespace and line wrapping is added to fit formatting constraints. 308 3.1. Encryption of a Response 310 Here, a successful HTTP GET response has been encrypted. This uses a 311 record size of 4096 and no padding (just the single octet padding 312 delimiter), so only a partial record is present. The input keying 313 material is identified by an empty string (that is, the "keyid" field 314 in the header is zero octets in length). 316 The encrypted data in this example is the UTF-8 encoded string "I am 317 the walrus". The input keying material is the value "yqdlZ- 318 tYemfogSmv7Ws5PQ" (in base64url). The 54 octet content body contains 319 a single record and is shown here using 71 base64url characters for 320 presentation reasons. 322 HTTP/1.1 200 OK 323 Content-Type: application/octet-stream 324 Content-Length: 54 325 Content-Encoding: aes128gcm 327 I1BsxtFttlv3u_Oo94xnmwAAEAAA-NAVub2qFgBEuQKRapoZu-IxkIva3MEB1PD- 328 ly8Thjg 329 Note that the media type has been changed to "application/octet- 330 stream" to avoid exposing information about the content. 331 Alternatively (and equivalently), the Content-Type header field can 332 be omitted. 334 Intermediate values for this example (all shown using base64url): 336 salt (from header) = I1BsxtFttlv3u_Oo94xnmw 337 PRK = zyeH5phsIsgUyd4oiSEIy35x-gIi4aM7y0hCF8mwn9g 338 CEK = _wniytB-ofscZDh4tbSjHw 339 NONCE = Bcs8gkIRKLI8GeI8 340 plaintext = SSBhbSB0aGUgd2FscnVzAg 342 3.2. Encryption with Multiple Records 344 This example shows the same message with input keying material of 345 "BO3ZVPxUlnLORbVGMpbT1Q". In this example, the plaintext is split 346 into records of 25 octets each (that is, the "rs" field in the header 347 is 25). The first record includes one 0x00 padding octet. This 348 means that there are 7 octets of message in the first record, and 8 349 in the second. A key identifier of the UTF-8 encoded string "a1" is 350 also included in the header. 352 HTTP/1.1 200 OK 353 Content-Length: 73 354 Content-Encoding: aes128gcm 356 uNCkWiNYzKTnBN9ji3-qWAAAABkCYTHOG8chz_gnvgOqdGYovxyjuqRyJFjEDyoF 357 1Fvkj6hQPdPHI51OEUKEpgz3SsLWIqS_uA 359 4. Security Considerations 361 This mechanism assumes the presence of a key management framework 362 that is used to manage the distribution of keys between valid senders 363 and receivers. Defining key management is part of composing this 364 mechanism into a larger application, protocol, or framework. 366 Implementation of cryptography - and key management in particular - 367 can be difficult. For instance, implementations need to account for 368 the potential for exposing keying material on side channels, such as 369 might be exposed by the time it takes to perform a given operation. 370 The requirements for a good implementation of cryptographic 371 algorithms can change over time. 373 As a content coding, presence of the "aes128gcm" coding might be 374 transparent to a consumer of a message. Recipients that depend on 375 content origin authentication using this mechanism MUST reject 376 messages that don't include the "aes128gcm" content coding. 378 4.1. Message Truncation 380 This content encoding is designed to permit the incremental 381 processing of large messages. It also permits random access to 382 plaintext in a limited fashion. The content encoding permits a 383 receiver to detect when a message is truncated. 385 A partially delivered message MUST NOT be processed as though the 386 entire message was successfully delivered. For instance, a partially 387 delivered message cannot be cached as though it were complete. 389 An attacker might exploit willingness to process partial messages to 390 cause a receiver to remain in a specific intermediate state. 391 Implementations performing processing on partial messages need to 392 ensure that any intermediate processing states don't advantage an 393 attacker. 395 4.2. Key and Nonce Reuse 397 Encrypting different plaintext with the same content encryption key 398 and nonce in AES-GCM is not safe [RFC5116]. The scheme defined here 399 uses a fixed progression of nonce values. Thus, a new content 400 encryption key is needed for every application of the content coding. 401 Since input keying material can be reused, a unique "salt" parameter 402 is needed to ensure a content encryption key is not reused. 404 If a content encryption key is reused - that is, if input keying 405 material and salt are reused - this could expose the plaintext and 406 the authentication key, nullifying the protection offered by 407 encryption. Thus, if the same input keying material is reused, then 408 the salt parameter MUST be unique each time. This ensures that the 409 content encryption key is not reused. An implementation SHOULD 410 generate a random salt parameter for every message; a counter could 411 achieve the same result. 413 4.3. Data Encryption Limits 415 There are limits to the data that AEAD_AES_128_GCM can encipher. The 416 maximum value for the record size is limited by the size of the "rs" 417 field in the header (see Section 2.1), which ensures that the 2^36-31 418 limit for a single application of AEAD_AES_128_GCM is not reached 419 [RFC5116]. In order to preserve a 2^-40 probability of 420 indistinguishability under chosen plaintext attack (IND-CPA), the 421 total amount of plaintext that can be enciphered with the key derived 422 from the same input keying material and salt MUST be less than 2^44.5 423 blocks of 16 octets [AEBounds]. 425 If the record size is a multiple of 16 octets, this means 398 426 terabytes can be encrypted safely, including padding and overhead. 427 However, if the record size is not a multiple of 16 octets, the total 428 amount of data that can be safely encrypted is reduced because 429 partial AES blocks are encrypted. The worst case is a record size of 430 18 octets, for which at most 74 terabytes of plaintext can be 431 encrypted, of which at least half is padding. 433 4.4. Content Integrity 435 This mechanism only provides content origin authentication. The 436 authentication tag only ensures that an entity with access to the 437 content encryption key produced the encrypted data. 439 Any entity with the content encryption key can therefore produce 440 content that will be accepted as valid. This includes all recipients 441 of the same HTTP message. 443 Furthermore, any entity that is able to modify both the Content- 444 Encoding header field and the HTTP message body can replace the 445 contents. Without the content encryption key or the input keying 446 material, modifications to or replacement of parts of a payload body 447 are not possible. 449 4.5. Leaking Information in Header Fields 451 Because only the payload body is encrypted, information exposed in 452 header fields is visible to anyone who can read the HTTP message. 453 This could expose side-channel information. 455 For example, the Content-Type header field can leak information about 456 the payload body. 458 There are a number of strategies available to mitigate this threat, 459 depending upon the application's threat model and the users' 460 tolerance for leaked information: 462 1. Determine that it is not an issue. For example, if it is 463 expected that all content stored will be "application/json", or 464 another very common media type, exposing the Content-Type header 465 field could be an acceptable risk. 467 2. If it is considered sensitive information and it is possible to 468 determine it through other means (e.g., out of band, using hints 469 in other representations, etc.), omit the relevant headers, and/ 470 or normalize them. In the case of Content-Type, this could be 471 accomplished by always sending Content-Type: application/octet- 472 stream (the most generic media type), or no Content-Type at all. 474 3. If it is considered sensitive information and it is not possible 475 to convey it elsewhere, encapsulate the HTTP message using the 476 application/http media type (Section 8.3.2 of [RFC7230]), 477 encrypting that as the payload of the "outer" message. 479 4.6. Poisoning Storage 481 This mechanism only offers encryption of content; it does not perform 482 authentication or authorization, which still needs to be performed 483 (e.g., by HTTP authentication [RFC7235]). 485 This is especially relevant when a HTTP PUT request is accepted by a 486 server; if the request is unauthenticated, it becomes possible for a 487 third party to deny service and/or poison the store. 489 4.7. Sizing and Timing Attacks 491 Applications using this mechanism need to be aware that the size of 492 encrypted messages, as well as their timing, HTTP methods, URIs and 493 so on, may leak sensitive information. 495 This risk can be mitigated through the use of the padding that this 496 mechanism provides. Alternatively, splitting up content into 497 segments and storing them separately might reduce exposure. HTTP/2 498 [RFC7540] combined with TLS [RFC5246] might be used to hide the size 499 of individual messages. 501 Developing a padding strategy is difficult. A good padding strategy 502 can depend on context. Common strategies include padding to a small 503 set of fixed lengths, padding to multiples of a value, or padding to 504 powers of 2. Even a good strategy can still cause size information 505 to leak if processing activity of a recipient can be observed. This 506 is especially true if the trailing records of a message contain only 507 padding. Distributing non-padding data is recommended to avoid 508 leaking size information. 510 5. IANA Considerations 512 5.1. The "aes128gcm" HTTP Content Coding 514 This memo registers the "aes128gcm" HTTP content coding in the HTTP 515 Content Codings Registry, as detailed in Section 2. 517 o Name: aes128gcm 518 o Description: AES-GCM encryption with a 128-bit content encryption 519 key 521 o Reference: this specification 523 6. References 525 6.1. Normative References 527 [FIPS180-4] 528 Department of Commerce, National., "NIST FIPS 180-4, 529 Secure Hash Standard", March 2012, 530 . 533 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 534 Requirement Levels", BCP 14, RFC 2119, 535 DOI 10.17487/RFC2119, March 1997, 536 . 538 [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 539 10646", STD 63, RFC 3629, DOI 10.17487/RFC3629, November 540 2003, . 542 [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated 543 Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, 544 . 546 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 547 Key Derivation Function (HKDF)", RFC 5869, 548 DOI 10.17487/RFC5869, May 2010, 549 . 551 [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 552 Protocol (HTTP/1.1): Message Syntax and Routing", 553 RFC 7230, DOI 10.17487/RFC7230, June 2014, 554 . 556 [RFC7231] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 557 Protocol (HTTP/1.1): Semantics and Content", RFC 7231, 558 DOI 10.17487/RFC7231, June 2014, 559 . 561 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 562 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 563 2015, . 565 6.2. Informative References 567 [AEBounds] 568 Luykx, A. and K. Paterson, "Limits on Authenticated 569 Encryption Use in TLS", March 2016, 570 . 572 [RFC4880] Callas, J., Donnerhacke, L., Finney, H., Shaw, D., and R. 573 Thayer, "OpenPGP Message Format", RFC 4880, 574 DOI 10.17487/RFC4880, November 2007, 575 . 577 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 578 (TLS) Protocol Version 1.2", RFC 5246, 579 DOI 10.17487/RFC5246, August 2008, 580 . 582 [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, 583 RFC 5652, DOI 10.17487/RFC5652, September 2009, 584 . 586 [RFC7233] Fielding, R., Ed., Lafon, Y., Ed., and J. Reschke, Ed., 587 "Hypertext Transfer Protocol (HTTP/1.1): Range Requests", 588 RFC 7233, DOI 10.17487/RFC7233, June 2014, 589 . 591 [RFC7235] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer 592 Protocol (HTTP/1.1): Authentication", RFC 7235, 593 DOI 10.17487/RFC7235, June 2014, 594 . 596 [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", 597 RFC 7516, DOI 10.17487/RFC7516, May 2015, 598 . 600 [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext 601 Transfer Protocol Version 2 (HTTP/2)", RFC 7540, 602 DOI 10.17487/RFC7540, May 2015, 603 . 605 [XMLENC] Eastlake, D., Reagle, J., Hirsch, F., Roessler, T., 606 Imamura, T., Dillaway, B., Simon, E., Yiu, K., and M. 607 Nystroem, "XML Encryption Syntax and Processing", W3C 608 Recommendation REC-xmlenc-core1-20130411 , January 2013, 609 . 611 Appendix A. JWE Mapping 613 The "aes128gcm" content coding can be considered as a sequence of 614 JSON Web Encryption (JWE) objects [RFC7516], each corresponding to a 615 single fixed size record that includes trailing padding. The 616 following transformations are applied to a JWE object that might be 617 expressed using the JWE Compact Serialization: 619 o The JWE Protected Header is fixed to the value { "alg": "dir", 620 "enc": "A128GCM" }, describing direct encryption using AES-GCM 621 with a 128-bit content encryption key. This header is not 622 transmitted, it is instead implied by the value of the Content- 623 Encoding header field. 625 o The JWE Encrypted Key is empty, as stipulated by the direct 626 encryption algorithm. 628 o The JWE Initialization Vector ("iv") for each record is set to the 629 exclusive or of the 96-bit record sequence number, starting at 630 zero, and a value derived from the input keying material (see 631 Section 2.3). This value is also not transmitted. 633 o The final value is the concatenated header, JWE Ciphertext, and 634 JWE Authentication Tag, all expressed without base64url encoding. 635 The "." separator is omitted, since the length of these fields is 636 known. 638 Thus, the example in Section 3.1 can be rendered using the JWE 639 Compact Serialization as: 641 eyAiYWxnIjogImRpciIsICJlbmMiOiAiQTEyOEdDTSIgfQ..Bcs8gkIRKLI8GeI8. 642 -NAVub2qFgBEuQKRapoZuw.4jGQi9rcwQHU8P6XLxOGOA 644 Where the first line represents the fixed JWE Protected Header, an 645 empty JWE Encrypted Key, and the algorithmically-determined JWE 646 Initialization Vector. The second line contains the encoded body, 647 split into JWE Ciphertext and JWE Authentication Tag. 649 Appendix B. Acknowledgements 651 Mark Nottingham was an original author of this document. 653 The following people provided valuable input: Richard Barnes, David 654 Benjamin, Peter Beverloo, JR Conlin, Mike Jones, Stephen Farrell, 655 Adam Langley, James Manger, John Mattsson, Julian Reschke, Eric 656 Rescorla, Jim Schaad, and Magnus Westerlund. 658 Author's Address 660 Martin Thomson 661 Mozilla 663 Email: martin.thomson@gmail.com