<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.0.30 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc docmapping="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-httpbis-encryption-encoding-08" category="std">

  <feedback xmlns='https://umn7fc98gj7rc.julianrbryant.com/net/xml2rfc/ext' template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=%3c{ref}%3e:"/><front>
    <title abbrev="HTTP encryption coding">Encrypted Content-Encoding for HTTP</title>

    <author initials="M." surname="Thomson" fullname="Martin Thomson">
      <organization>Mozilla</organization>
      <address>
        <email>martin.thomson@gmail.com</email>
      </address>
    </author>

    <date year="2017" month="3" day="2"/>

    <area>Applications and Real-Time</area>
    <workgroup>HTTP</workgroup>
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>This memo introduces a content coding for HTTP that allows message payloads to
be encrypted.</t>



    </abstract>


    <note title="Note to Readers">


<t>Discussion of this draft takes place on the HTTP working group mailing list
(ietf-http-wg@w3.org), which is archived at <eref target="https://un5xruhmgkj46tygt32g.julianrbryant.com/Archives/Public/ietf-http-wg/">https://un5xruhmgkj46tygt32g.julianrbryant.com/Archives/Public/ietf-http-wg/</eref>.</t>

<t>Working Group information can be found at <eref target="https://umn5j91xuvj8cem5tqpfy4k4ym.julianrbryant.com/">https://umn5j91xuvj8cem5tqpfy4k4ym.julianrbryant.com/</eref>; source
code and issues list for this draft can be found at <eref target="https://github.com/httpwg/http-extensions/labels/encryption">https://github.com/httpwg/http-extensions/labels/encryption</eref>.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>It is sometimes desirable to encrypt the contents of a HTTP message (request or
response) so that when the payload is stored (e.g., with a HTTP PUT), only
someone with the appropriate key can read it.</t>

<t>For example, it might be necessary to store a file on a server without exposing
its contents to that server. Furthermore, that same file could be replicated to
other servers (to make it more resistant to server or network failure),
downloaded by clients (to make it available offline), etc.  without exposing its
contents.</t>

<t>These uses are not met by the use of TLS <xref target="RFC5246"/>, since it only encrypts
the channel between the client and server.</t>

<t>This document specifies a content coding (Section 3.1.2 of <xref target="RFC7231"/>) for HTTP
to serve these and other use cases.</t>

<t>This content coding is not a direct adaptation of message-based encryption
formats - such as those that are described by <xref target="RFC4880"/>, <xref target="RFC5652"/>,
<xref target="RFC7516"/>, and <xref target="XMLENC"/> - which are not suited to stream processing, which
is necessary for HTTP.  The format described here follows more closely to the
lower level constructs described in <xref target="RFC5116"/>.</t>

<t>To the extent that message-based encryption formats use the same primitives, the
format can be considered as sequence of encrypted messages with a particular
profile.  For instance, <xref target="jwe"/> explains how the format is congruent with a
sequence of JSON Web Encryption <xref target="RFC7516"/> values with a fixed header.</t>

<t>This mechanism is likely only a small part of a larger design that uses content
encryption.  How clients and servers acquire and identify keys will depend on
the use case.  In particular, a key management system is not described.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<t>The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”,
“SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be
interpreted as described in <xref target="RFC2119"/>.</t>

<t>Base64url encoding is defined in Section 2 of <xref target="RFC7515"/>.</t>

</section>
</section>
<section anchor="aes128gcm" title="The “aes128gcm” HTTP Content Coding">

<t>The “aes128gcm” HTTP content coding indicates that a payload has been encrypted
using Advanced Encryption Standard (AES) in Galois/Counter Mode (GCM) as
identified as AEAD_AES_128_GCM in <xref target="RFC5116"/>, Section 5.1.  The AEAD_AES_128_GCM
algorithm uses a 128 bit content encryption key.</t>

<t>Using this content coding requires knowledge of a key.  How this key is
acquired is not defined in this document.</t>

<t>The “aes128gcm” content coding uses a single fixed set of encryption
primitives.  Cipher suite agility is achieved by defining a new content coding
scheme.  This ensures that only the HTTP Accept-Encoding header field is
necessary to negotiate the use of encryption.</t>

<t>The “aes128gcm” content coding uses a fixed record size.  The final encoding
consists of a header (see <xref target="header"/>) and zero or more fixed size encrypted
records; the final record can be smaller than the record size.</t>

<t>The record size determines the length of each portion of plaintext that is
enciphered.  The record size (“rs”) is included in the content coding header
(see <xref target="header"/>).</t>

<figure><artwork type="drawing"><![CDATA[
+-----------+             content
|   data    |             any length up to rs-17 octets
+-----------+
     |
     v
+-----------+-----+       add a delimiter octet (0x01 or 0x02)
|   data    | pad |       then 0x00-valued octets to rs-16
+-----------+-----+       (or less on the last record)
         |
         v
+--------------------+    encrypt with AEAD_AES_128_GCM;
|    ciphertext      |    final size is rs;
+--------------------+    the last record can be smaller
]]></artwork></figure>

<t>AEAD_AES_128_GCM produces ciphertext 16 octets longer than its input plaintext.
Therefore, the unencrypted content of each record is shorter than the record
size by 16 octets.  Valid records always contain at least a padding delimiter
octet and a 16 octet authentication tag.</t>

<t>Each record contains a single padding delimiter octet followed by any number of
zero octets.  The last record uses a padding delimiter octet set to the value 2,
all other records have a padding delimiter octet value of 1.</t>

<t>On decryption, the padding delimiter is the last non-zero valued octet of the
record.  A decrypter MUST fail if the record contains no non-zero octet.  A
decrypter MUST fail if the last record contains a padding delimiter with a value
other than 2 or if any record other than the last contains a padding delimiter
with a value other than 1.</t>

<t>The nonce for each record is a 96-bit value constructed from the record sequence
number and the input keying material.  Nonce derivation is covered in <xref target="nonce"/>.</t>

<t>The additional data passed to each invocation of AEAD_AES_128_GCM is a
zero-length octet sequence.</t>

<t>A consequence of this record structure is that range requests <xref target="RFC7233"/> and
random access to encrypted payload bodies are possible at the granularity of the
record size.  Partial records at the ends of a range cannot be decrypted.  Thus,
it is best if range requests start and end on record boundaries.  Note however
that random access to specific parts of encrypted data could be confounded by
the presence of padding.</t>

<t>Selecting the record size most appropriate for a given situation requires a
trade-off.  A smaller record size allows decrypted octets to be released more
rapidly, which can be appropriate for applications that depend on
responsiveness.  Smaller records also reduce the additional data required if
random access into the ciphertext is needed.</t>

<t>Applications that don’t depending on streaming, random access, or arbitrary
padding can use larger records, or even a single record.  A larger record size
reduces processing and data overheads.</t>

<section anchor="header" title="Encryption Content Coding Header">

<t>The content coding uses a header block that includes all parameters needed to
decrypt the content (other than the key).  The header block is placed in the
body of a message ahead of the sequence of records.</t>

<figure><artwork type="drawing"><![CDATA[
+-----------+--------+-----------+---------------+
| salt (16) | rs (4) | idlen (1) | keyid (idlen) |
+-----------+--------+-----------+---------------+
]]></artwork></figure>

<t><list style="hanging">
  <t hangText='salt:'>
  The “salt” parameter comprises the first 16 octets of the “aes128gcm” content
coding header.  The same “salt” parameter value MUST NOT be reused for two
different payload bodies that have the same input keying material; generating
a random salt for every application of the content coding ensures that content
encryption key reuse is highly unlikely.</t>
  <t hangText='rs:'>
  The “rs” or record size parameter contains an unsigned 32-bit integer in
network byte order that describes the record size in octets.  Note that it is
therefore impossible to exceed the 2^36-31 limit on plaintext input to
AEAD_AES_128_GCM.  Values smaller than 18 are invalid.</t>
  <t hangText='keyid:'>
  The “keyid” parameter can be used to identify the keying material that is
used.  Recipients that receive a message are expected to know how to retrieve
keys; the “keyid” parameter might be input to that process.  A “keyid”
parameter SHOULD be a UTF-8 <xref target="RFC3629"/> encoded string, particularly where
the identifier might need to appear in a textual form.</t>
</list></t>

</section>
<section anchor="derivation" title="Content Encryption Key Derivation">

<t>In order to allow the reuse of keying material for multiple different HTTP
messages, a content encryption key is derived for each message.  The content
encryption key is derived from the “salt” parameter using the HMAC-based key
derivation function (HKDF) described in <xref target="RFC5869"/> using the SHA-256 hash
algorithm <xref target="FIPS180-4"/>.</t>

<t>The value of the “salt” parameter is the salt input to HKDF function.  The
keying material identified by the “keyid” parameter is the input keying material
(IKM) to HKDF.  Input keying material is expected to be provided to recipients
separately.  The extract phase of HKDF therefore produces a pseudorandom key
(PRK) as follows:</t>

<figure><artwork type="inline"><![CDATA[
   PRK = HMAC-SHA-256(salt, IKM)
]]></artwork></figure>

<t>The info parameter to HKDF is set to the ASCII-encoded string “Content-Encoding:
aes128gcm” and a single zero octet:</t>

<figure><artwork type="inline"><![CDATA[
   cek_info = "Content-Encoding: aes128gcm" || 0x00
]]></artwork></figure>

<t><list style="hanging">
  <t hangText='Note:'>
  Concatenation of octet sequences is represented by the <spanx style="verb">||</spanx> operator.</t>
</list></t>

<t>AEAD_AES_128_GCM requires a 16 octet (128 bit) content encryption key (CEK), so
the length (L) parameter to HKDF is 16.  The second step of HKDF can therefore
be simplified to the first 16 octets of a single HMAC:</t>

<figure><artwork type="inline"><![CDATA[
   CEK = HMAC-SHA-256(PRK, cek_info || 0x01)
]]></artwork></figure>

</section>
<section anchor="nonce" title="Nonce Derivation">

<t>The nonce input to AEAD_AES_128_GCM is constructed for each record.  The nonce
for each record is a 12 octet (96 bit) value that is derived from the record
sequence number, input keying material, and salt.</t>

<t>The input keying material and salt values are input to HKDF with different info
and length parameters.</t>

<t>The length (L) parameter is 12 octets.  The info parameter for the nonce is the
ASCII-encoded string “Content-Encoding: nonce”, terminated by a a single zero
octet:</t>

<figure><artwork type="inline"><![CDATA[
   nonce_info = "Content-Encoding: nonce" || 0x00
]]></artwork></figure>

<t>The result is combined with the record sequence number - using exclusive or - to
produce the nonce.  The record sequence number (SEQ) is a 96-bit unsigned
integer in network byte order that starts at zero.</t>

<t>Thus, the final nonce for each record is a 12 octet value:</t>

<figure><artwork type="inline"><![CDATA[
   NONCE = HMAC-SHA-256(PRK, nonce_info || 0x01) XOR SEQ
]]></artwork></figure>

<t>This nonce construction prevents removal or reordering of records. However, it
permits truncation of the tail of the sequence (see <xref target="aes128gcm"/> for how this
is avoided).</t>

</section>
</section>
<section anchor="examples" title="Examples">

<t>This section shows a few examples of the encrypted content coding.</t>

<t>Note: All binary values in the examples in this section use base64url encoding
<xref target="RFC7515"/>.  This includes the bodies of requests.  Whitespace and line
wrapping is added to fit formatting constraints.</t>

<section anchor="explicit" title="Encryption of a Response">

<t>Here, a successful HTTP GET response has been encrypted.  This uses a record
size of 4096 and no padding (just the single octet padding delimiter), so only a
partial record is present.  The input keying material is identified by an empty
string (that is, the “keyid” field in the header is zero octets in length).</t>

<t>The encrypted data in this example is the UTF-8 encoded string “I am the
walrus”.  The input keying material is the value “yqdlZ-tYemfogSmv7Ws5PQ” (in
base64url).  The 54 octet content body contains a single record and is shown
here using 71 base64url characters for presentation reasons.</t>

<figure><artwork type="example"><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/octet-stream
Content-Length: 54
Content-Encoding: aes128gcm

I1BsxtFttlv3u_Oo94xnmwAAEAAA-NAVub2qFgBEuQKRapoZu-IxkIva3MEB1PD-
ly8Thjg
]]></artwork></figure>

<t>Note that the media type has been changed to “application/octet-stream” to avoid
exposing information about the content.  Alternatively (and equivalently), the
Content-Type header field can be omitted.</t>

<t>Intermediate values for this example (all shown using base64url):</t>

<figure><artwork type="inline"><![CDATA[
salt (from header) = I1BsxtFttlv3u_Oo94xnmw
PRK = zyeH5phsIsgUyd4oiSEIy35x-gIi4aM7y0hCF8mwn9g
CEK = _wniytB-ofscZDh4tbSjHw
NONCE = Bcs8gkIRKLI8GeI8
plaintext = SSBhbSB0aGUgd2FscnVzAg
]]></artwork></figure>

</section>
<section anchor="encryption-with-multiple-records" title="Encryption with Multiple Records">

<t>This example shows the same message with input keying material of
“BO3ZVPxUlnLORbVGMpbT1Q”.  In this example, the plaintext is split into records
of 25 octets each (that is, the “rs” field in the header is 25).  The first
record includes one 0x00 padding octet.  This means that there are 7 octets of
message in the first record, and 8 in the second.  A key identifier of the UTF-8
encoded string “a1” is also included in the header.</t>

<figure><artwork type="example"><![CDATA[
HTTP/1.1 200 OK
Content-Length: 73
Content-Encoding: aes128gcm

uNCkWiNYzKTnBN9ji3-qWAAAABkCYTHOG8chz_gnvgOqdGYovxyjuqRyJFjEDyoF
1Fvkj6hQPdPHI51OEUKEpgz3SsLWIqS_uA
]]></artwork></figure>

</section>
</section>
<section anchor="security-considerations" title="Security Considerations">

<t>This mechanism assumes the presence of a key management framework that is used
to manage the distribution of keys between valid senders and receivers.
Defining key management is part of composing this mechanism into a larger
application, protocol, or framework.</t>

<t>Implementation of cryptography - and key management in particular - can be
difficult.  For instance, implementations need to account for the potential for
exposing keying material on side channels, such as might be exposed by the time
it takes to perform a given operation.  The requirements for a good
implementation of cryptographic algorithms can change over time.</t>

<t>As a content coding, presence of the “aes128gcm” coding might be transparent to
a consumer of a message.  Recipients that depend on content origin
authentication using this mechanism MUST reject messages that don’t include the
“aes128gcm” content coding.</t>

<section anchor="message-truncation" title="Message Truncation">

<t>This content encoding is designed to permit the incremental processing of large
messages.  It also permits random access to plaintext in a limited fashion.  The
content encoding permits a receiver to detect when a message is truncated.</t>

<t>A partially delivered message MUST NOT be processed as though the entire message
was successfully delivered.  For instance, a partially delivered message cannot
be cached as though it were complete.</t>

<t>An attacker might exploit willingness to process partial messages to cause a
receiver to remain in a specific intermediate state.  Implementations performing
processing on partial messages need to ensure that any intermediate processing
states don’t advantage an attacker.</t>

</section>
<section anchor="key-and-nonce-reuse" title="Key and Nonce Reuse">

<t>Encrypting different plaintext with the same content encryption key and nonce in
AES-GCM is not safe <xref target="RFC5116"/>.  The scheme defined here uses a fixed progression
of nonce values.  Thus, a new content encryption key is needed for every
application of the content coding.  Since input keying material can be reused, a
unique “salt” parameter is needed to ensure a content encryption key is not
reused.</t>

<t>If a content encryption key is reused - that is, if input keying material and
salt are reused - this could expose the plaintext and the authentication key,
nullifying the protection offered by encryption.  Thus, if the same input keying
material is reused, then the salt parameter MUST be unique each time.  This
ensures that the content encryption key is not reused.  An implementation SHOULD
generate a random salt parameter for every message; a counter could achieve the
same result.</t>

</section>
<section anchor="limits" title="Data Encryption Limits">

<t>There are limits to the data that AEAD_AES_128_GCM can encipher.  The maximum
value for the record size is limited by the size of the “rs” field in the header
(see <xref target="header"/>), which ensures that the 2^36-31 limit for a single application
of AEAD_AES_128_GCM is not reached <xref target="RFC5116"/>.  In order to preserve a 2^-40
probability of indistinguishability under chosen plaintext attack (IND-CPA), the
total amount of plaintext that can be enciphered with the key derived from the
same input keying material and salt MUST be less than 2^44.5 blocks of 16 octets
<xref target="AEBounds"/>.</t>

<t>If the record size is a multiple of 16 octets, this means 398 terabytes can be
encrypted safely, including padding and overhead.  However, if the record size
is not a multiple of 16 octets, the total amount of data that can be safely
encrypted is reduced because partial AES blocks are encrypted.  The worst case
is a record size of 18 octets, for which at most 74 terabytes of plaintext can
be encrypted, of which at least half is padding.</t>

</section>
<section anchor="content-integrity" title="Content Integrity">

<t>This mechanism only provides content origin authentication.  The authentication
tag only ensures that an entity with access to the content encryption key
produced the encrypted data.</t>

<t>Any entity with the content encryption key can therefore produce content that
will be accepted as valid.  This includes all recipients of the same HTTP
message.</t>

<t>Furthermore, any entity that is able to modify both the Content-Encoding header
field and the HTTP message body can replace the contents.  Without the content
encryption key or the input keying material, modifications to or replacement of
parts of a payload body are not possible.</t>

</section>
<section anchor="leaking-information-in-header-fields" title="Leaking Information in Header Fields">

<t>Because only the payload body is encrypted, information exposed in header fields
is visible to anyone who can read the HTTP message.  This could expose
side-channel information.</t>

<t>For example, the Content-Type header field can leak information about the
payload body.</t>

<t>There are a number of strategies available to mitigate this threat, depending
upon the application’s threat model and the users’ tolerance for leaked
information:</t>

<t><list style="numbers">
  <t>Determine that it is not an issue. For example, if it is expected that all
content stored will be “application/json”, or another very common media type,
exposing the Content-Type header field could be an acceptable risk.</t>
  <t>If it is considered sensitive information and it is possible to determine it
through other means (e.g., out of band, using hints in other representations,
etc.), omit the relevant headers, and/or normalize them. In the case of
Content-Type, this could be accomplished by always sending Content-Type:
application/octet-stream (the most generic media type), or no Content-Type at
all.</t>
  <t>If it is considered sensitive information and it is not possible to convey it
elsewhere, encapsulate the HTTP message using the application/http media type
(Section 8.3.2 of <xref target="RFC7230"/>), encrypting that as the payload of the “outer”
message.</t>
</list></t>

</section>
<section anchor="poisoning-storage" title="Poisoning Storage">

<t>This mechanism only offers encryption of content; it does not perform
authentication or authorization, which still needs to be performed (e.g., by
HTTP authentication <xref target="RFC7235"/>).</t>

<t>This is especially relevant when a HTTP PUT request is accepted by a server; if
the request is unauthenticated, it becomes possible for a third party to deny
service and/or poison the store.</t>

</section>
<section anchor="sizing-and-timing-attacks" title="Sizing and Timing Attacks">

<t>Applications using this mechanism need to be aware that the size of encrypted
messages, as well as their timing, HTTP methods, URIs and so on, may leak
sensitive information.</t>

<t>This risk can be mitigated through the use of the padding that this mechanism
provides.  Alternatively, splitting up content into segments and storing them
separately might reduce exposure. HTTP/2 <xref target="RFC7540"/> combined with TLS
<xref target="RFC5246"/> might be used to hide the size of individual messages.</t>

<t>Developing a padding strategy is difficult.  A good padding strategy can depend
on context.  Common strategies include padding to a small set of fixed lengths,
padding to multiples of a value, or padding to powers of 2.  Even a good
strategy can still cause size information to leak if processing activity of a
recipient can be observed.  This is especially true if the trailing records of a
message contain only padding.  Distributing non-padding data is recommended to
avoid leaking size information.</t>

</section>
</section>
<section anchor="iana" title="IANA Considerations">

<section anchor="the-aes128gcm-http-content-coding" title="The “aes128gcm” HTTP Content Coding">

<t>This memo registers the “aes128gcm” HTTP content coding in the HTTP Content
Codings Registry, as detailed in <xref target="aes128gcm"/>.</t>

<t><list style="symbols">
  <t>Name: aes128gcm</t>
  <t>Description: AES-GCM encryption with a 128-bit content encryption key</t>
  <t>Reference: this specification</t>
</list></t>

</section>
</section>


  </middle>

  <back>

    <references title='Normative References'>

<reference anchor="FIPS180-4" target="https://umn44jh8uu1yeqpgxfdxm9hhcfhg.julianrbryant.com/nistpubs/FIPS/NIST.FIPS.180-4.pdf">
  <front>
    <title>NIST FIPS 180-4, Secure Hash Standard</title>
    <author >
      <organization>National Institute of Standards and Technology, U.S. Department of Commerce</organization>
    </author>
    <date year="2015" month="August"/>
  </front>
  <seriesInfo name="DOI" value="10.6028/NIST.FIPS.180-4"/>
</reference>




<reference  anchor='RFC7231' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7231'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems.  This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.</t></abstract>
</front>
<seriesInfo name='RFC' value='7231'/>
<seriesInfo name='DOI' value='10.17487/RFC7231'/>
</reference>



<reference  anchor='RFC5116' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc5116'>
<front>
<title>An Interface and Algorithms for Authenticated Encryption</title>
<author initials='D.' surname='McGrew' fullname='D. McGrew'><organization /></author>
<date year='2008' month='January' />
<abstract><t>This document defines algorithms for Authenticated Encryption with Associated Data (AEAD), and defines a uniform interface and a registry for such algorithms.  The interface and registry can be used as an application-independent set of cryptoalgorithm suites.  This approach provides advantages in efficiency and security, and promotes the reuse of crypto implementations.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5116'/>
<seriesInfo name='DOI' value='10.17487/RFC5116'/>
</reference>



<reference  anchor='RFC2119' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc2119'>
<front>
<title>Key words for use in RFCs to Indicate Requirement Levels</title>
<author initials='S.' surname='Bradner' fullname='S. Bradner'><organization /></author>
<date year='1997' month='March' />
<abstract><t>In many standards track documents several words are used to signify the requirements in the specification.  These words are often capitalized. This document defines these words as they should be interpreted in IETF documents.  This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t></abstract>
</front>
<seriesInfo name='BCP' value='14'/>
<seriesInfo name='RFC' value='2119'/>
<seriesInfo name='DOI' value='10.17487/RFC2119'/>
</reference>



<reference  anchor='RFC7515' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7515'>
<front>
<title>JSON Web Signature (JWS)</title>
<author initials='M.' surname='Jones' fullname='M. Jones'><organization /></author>
<author initials='J.' surname='Bradley' fullname='J. Bradley'><organization /></author>
<author initials='N.' surname='Sakimura' fullname='N. Sakimura'><organization /></author>
<date year='2015' month='May' />
<abstract><t>JSON Web Signature (JWS) represents content secured with digital signatures or Message Authentication Codes (MACs) using JSON-based data structures.  Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and an IANA registry defined by that specification.  Related encryption capabilities are described in the separate JSON Web Encryption (JWE) specification.</t></abstract>
</front>
<seriesInfo name='RFC' value='7515'/>
<seriesInfo name='DOI' value='10.17487/RFC7515'/>
</reference>



<reference  anchor='RFC3629' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc3629'>
<front>
<title>UTF-8, a transformation format of ISO 10646</title>
<author initials='F.' surname='Yergeau' fullname='F. Yergeau'><organization /></author>
<date year='2003' month='November' />
<abstract><t>ISO/IEC 10646-1 defines a large character set called the Universal Character Set (UCS) which encompasses most of the world's writing systems.  The originally proposed encodings of the UCS, however, were not compatible with many current applications and protocols, and this has led to the development of UTF-8, the object of this memo.  UTF-8 has the characteristic of preserving the full US-ASCII range, providing compatibility with file systems, parsers and other software that rely on US-ASCII values but are transparent to other values.  This memo obsoletes and replaces RFC 2279.</t></abstract>
</front>
<seriesInfo name='STD' value='63'/>
<seriesInfo name='RFC' value='3629'/>
<seriesInfo name='DOI' value='10.17487/RFC3629'/>
</reference>



<reference  anchor='RFC5869' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc5869'>
<front>
<title>HMAC-based Extract-and-Expand Key Derivation Function (HKDF)</title>
<author initials='H.' surname='Krawczyk' fullname='H. Krawczyk'><organization /></author>
<author initials='P.' surname='Eronen' fullname='P. Eronen'><organization /></author>
<date year='2010' month='May' />
<abstract><t>This document specifies a simple Hashed Message Authentication Code (HMAC)-based key derivation function (HKDF), which can be used as a building block in various protocols and applications.  The key derivation function (KDF) is intended to support a wide range of applications and requirements, and is conservative in its use of cryptographic hash functions.  This document is not an Internet  Standards Track specification; it is published for informational  purposes.</t></abstract>
</front>
<seriesInfo name='RFC' value='5869'/>
<seriesInfo name='DOI' value='10.17487/RFC5869'/>
</reference>



<reference  anchor='RFC7230' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7230'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems.  This document provides an overview of HTTP architecture and its associated terminology, defines the &quot;http&quot; and &quot;https&quot; Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t></abstract>
</front>
<seriesInfo name='RFC' value='7230'/>
<seriesInfo name='DOI' value='10.17487/RFC7230'/>
</reference>




    </references>

    <references title='Informative References'>

<reference anchor="XMLENC" target="https://un5gmtkzgkj46tygt32g.julianrbryant.com/TR/2013/REC-xmlenc-core1-20130411">
  <front>
    <title>XML Encryption Syntax and Processing</title>
    <author initials="D." surname="Eastlake">
      <organization></organization>
    </author>
    <author initials="J." surname="Reagle">
      <organization></organization>
    </author>
    <author initials="F." surname="Hirsch">
      <organization></organization>
    </author>
    <author initials="T." surname="Roessler">
      <organization></organization>
    </author>
    <author initials="T." surname="Imamura">
      <organization></organization>
    </author>
    <author initials="B." surname="Dillaway">
      <organization></organization>
    </author>
    <author initials="E." surname="Simon">
      <organization></organization>
    </author>
    <author initials="K." surname="Yiu">
      <organization></organization>
    </author>
    <author initials="M." surname="Nyström">
      <organization></organization>
    </author>
    <date year="2013" month="January" day="24"/>
  </front>
  <seriesInfo name="W3C Recommendation" value="REC-xmlenc-core1-20130411"/>
</reference>
<reference anchor="AEBounds" target="https://umn0mtkzgj08cenjy3ccy9q51em68gr.julianrbryant.com/~kp/TLS-AEbounds.pdf">
  <front>
    <title>Limits on Authenticated Encryption Use in TLS</title>
    <author initials="A." surname="Luykx">
      <organization></organization>
    </author>
    <author initials="K." surname="Paterson">
      <organization></organization>
    </author>
    <date year="2016" month="March" day="08"/>
  </front>
</reference>




<reference  anchor='RFC5246' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc5246'>
<front>
<title>The Transport Layer Security (TLS) Protocol Version 1.2</title>
<author initials='T.' surname='Dierks' fullname='T. Dierks'><organization /></author>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2008' month='August' />
<abstract><t>This document specifies Version 1.2 of the Transport Layer Security (TLS) protocol.  The TLS protocol provides communications security over the Internet.  The protocol allows client/server applications to communicate in a way that is designed to prevent eavesdropping, tampering, or message forgery.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5246'/>
<seriesInfo name='DOI' value='10.17487/RFC5246'/>
</reference>



<reference  anchor='RFC4880' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc4880'>
<front>
<title>OpenPGP Message Format</title>
<author initials='J.' surname='Callas' fullname='J. Callas'><organization /></author>
<author initials='L.' surname='Donnerhacke' fullname='L. Donnerhacke'><organization /></author>
<author initials='H.' surname='Finney' fullname='H. Finney'><organization /></author>
<author initials='D.' surname='Shaw' fullname='D. Shaw'><organization /></author>
<author initials='R.' surname='Thayer' fullname='R. Thayer'><organization /></author>
<date year='2007' month='November' />
<abstract><t>This document is maintained in order to publish all necessary information needed to develop interoperable applications based on the OpenPGP format.  It is not a step-by-step cookbook for writing an application.  It describes only the format and methods needed to read, check, generate, and write conforming packets crossing any network.  It does not deal with storage and implementation questions. It does, however, discuss implementation issues necessary to avoid security flaws.</t><t>OpenPGP software uses a combination of strong public-key and symmetric cryptography to provide security services for electronic communications and data storage.  These services include confidentiality, key management, authentication, and digital signatures.  This document specifies the message formats used in OpenPGP.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='4880'/>
<seriesInfo name='DOI' value='10.17487/RFC4880'/>
</reference>



<reference  anchor='RFC5652' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc5652'>
<front>
<title>Cryptographic Message Syntax (CMS)</title>
<author initials='R.' surname='Housley' fullname='R. Housley'><organization /></author>
<date year='2009' month='September' />
<abstract><t>This document describes the Cryptographic Message Syntax (CMS).  This syntax is used to digitally sign, digest, authenticate, or encrypt arbitrary message content.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='STD' value='70'/>
<seriesInfo name='RFC' value='5652'/>
<seriesInfo name='DOI' value='10.17487/RFC5652'/>
</reference>



<reference  anchor='RFC7516' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7516'>
<front>
<title>JSON Web Encryption (JWE)</title>
<author initials='M.' surname='Jones' fullname='M. Jones'><organization /></author>
<author initials='J.' surname='Hildebrand' fullname='J. Hildebrand'><organization /></author>
<date year='2015' month='May' />
<abstract><t>JSON Web Encryption (JWE) represents encrypted content using JSON-based data structures.  Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and IANA registries defined by that specification.  Related digital signature and Message Authentication Code (MAC) capabilities are described in the separate JSON Web Signature (JWS) specification.</t></abstract>
</front>
<seriesInfo name='RFC' value='7516'/>
<seriesInfo name='DOI' value='10.17487/RFC7516'/>
</reference>



<reference  anchor='RFC7233' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7233'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Range Requests</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='Y.' surname='Lafon' fullname='Y. Lafon' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypertext information systems.  This document defines range requests and the rules for constructing and combining responses to those requests.</t></abstract>
</front>
<seriesInfo name='RFC' value='7233'/>
<seriesInfo name='DOI' value='10.17487/RFC7233'/>
</reference>



<reference  anchor='RFC7235' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7235'>
<front>
<title>Hypertext Transfer Protocol (HTTP/1.1): Authentication</title>
<author initials='R.' surname='Fielding' fullname='R. Fielding' role='editor'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke' role='editor'><organization /></author>
<date year='2014' month='June' />
<abstract><t>The Hypertext Transfer Protocol (HTTP) is a stateless application- level protocol for distributed, collaborative, hypermedia information systems.  This document defines the HTTP Authentication framework.</t></abstract>
</front>
<seriesInfo name='RFC' value='7235'/>
<seriesInfo name='DOI' value='10.17487/RFC7235'/>
</reference>



<reference  anchor='RFC7540' target='https://umn0mtkzgjmt2j3jm38z69h0br.julianrbryant.com/info/rfc7540'>
<front>
<title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
<author initials='M.' surname='Belshe' fullname='M. Belshe'><organization /></author>
<author initials='R.' surname='Peon' fullname='R. Peon'><organization /></author>
<author initials='M.' surname='Thomson' fullname='M. Thomson' role='editor'><organization /></author>
<date year='2015' month='May' />
<abstract><t>This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2).  HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection.  It also introduces unsolicited push of representations from servers to clients.</t><t>This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax.  HTTP's existing semantics remain unchanged.</t></abstract>
</front>
<seriesInfo name='RFC' value='7540'/>
<seriesInfo name='DOI' value='10.17487/RFC7540'/>
</reference>




    </references>


<section anchor="jwe" title="JWE Mapping">

<t>The “aes128gcm” content coding can be considered as a sequence of JSON Web
Encryption (JWE) objects <xref target="RFC7516"/>, each corresponding to a single fixed size
record that includes trailing padding.  The following transformations are applied
to a JWE object that might be expressed using the JWE Compact Serialization:</t>

<t><list style="symbols">
  <t>The JWE Protected Header is fixed to the value { “alg”: “dir”, “enc”: “A128GCM”
}, describing direct encryption using AES-GCM with a 128-bit content
encryption key.  This header is not transmitted, it is instead implied by the
value of the Content-Encoding header field.</t>
  <t>The JWE Encrypted Key is empty, as stipulated by the direct encryption algorithm.</t>
  <t>The JWE Initialization Vector (“iv”) for each record is set to the exclusive
or of the 96-bit record sequence number, starting at zero, and a value derived
from the input keying material (see <xref target="nonce"/>).  This value is also not
transmitted.</t>
  <t>The final value is the concatenated header, JWE Ciphertext, and JWE
Authentication Tag, all expressed without base64url encoding.  The “.”
separator is omitted, since the length of these fields is known.</t>
</list></t>

<t>Thus, the example in <xref target="explicit"/> can be rendered using the JWE Compact
Serialization as:</t>

<figure><artwork type="example"><![CDATA[
eyAiYWxnIjogImRpciIsICJlbmMiOiAiQTEyOEdDTSIgfQ..Bcs8gkIRKLI8GeI8.
-NAVub2qFgBEuQKRapoZuw.4jGQi9rcwQHU8P6XLxOGOA
]]></artwork></figure>

<t>Where the first line represents the fixed JWE Protected Header, an empty JWE
Encrypted Key, and the algorithmically-determined JWE Initialization Vector.
The second line contains the encoded body, split into JWE Ciphertext and JWE
Authentication Tag.</t>

</section>
<section anchor="acknowledgements" title="Acknowledgements">

<t>Mark Nottingham was an original author of this document.</t>

<t>The following people provided valuable input: Richard Barnes, David Benjamin,
Peter Beverloo, JR Conlin, Mike Jones, Stephen Farrell, Adam Langley, James
Manger, John Mattsson, Julian Reschke, Eric Rescorla, Jim Schaad, and Magnus
Westerlund.</t>

</section>


  </back>
</rfc>

