<?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.36 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc docmapping="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-webpush-encryption-04" category="std">

  <front>
    <title abbrev="Web Push Encryption">Message Encryption for Web Push</title>

    <author initials="M." surname="Thomson" fullname="Martin Thomson">
      <organization>Mozilla</organization>
      <address>
        <email>martin.thomson@gmail.com</email>
      </address>
    </author>

    <date year="2016"/>

    
    
    

    <abstract>


<t>A message encryption scheme is described for the Web Push protocol.  This scheme
provides confidentiality and integrity for messages sent from an Application
Server to a User Agent.</t>



    </abstract>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>The Web Push protocol <xref target="I-D.ietf-webpush-protocol"/> is an intermediated
protocol by necessity.  Messages from an Application Server are delivered to a
User Agent via a Push Service.</t>

<figure><artwork><![CDATA[
 +-------+           +--------------+       +-------------+
 |  UA   |           | Push Service |       | Application |
 +-------+           +--------------+       +-------------+
     |                      |                      |
     |        Setup         |                      |
     |<====================>|                      |
     |           Provide Subscription              |
     |-------------------------------------------->|
     |                      |                      |
     :                      :                      :
     |                      |     Push Message     |
     |    Push Message      |<---------------------|
     |<---------------------|                      |
     |                      |                      |
]]></artwork></figure>

<t>This document describes how messages sent using this protocol can be secured
against inspection, modification and falsification by a Push Service.</t>

<t>Web Push messages are the payload of an HTTP message <xref target="RFC7230"/>.  These
messages are encrypted using an encrypted content encoding
<xref target="I-D.ietf-httpbis-encryption-encoding"/>.  This document describes how this
content encoding is applied and describes a recommended key management scheme.</t>

<t>For efficiency reasons, multiple users of Web Push often share a central agent
that aggregates push functionality.  This agent can enforce the use of this
encryption scheme by applications that use push messaging.  An agent that only
delivers messages that are properly encrypted strongly encourages the end-to-end
protection of messages.</t>

<t>A web browser that implements the Web Push API <xref target="API"/> can enforce the use of
encryption by forwarding only those messages that were properly encrypted.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<t>The words “MUST”, “MUST NOT”, “SHOULD”, and “MAY” are used in this document.
It’s not shouting, when they are capitalized, they have the special meaning
described in <xref target="RFC2119"/>.</t>

</section>
</section>
<section anchor="overview" title="Push Message Encryption Overview">

<t>Encrypting a push message uses elliptic-curve Diffie-Hellman (ECDH) <xref target="ECDH"/> on
the P-256 curve <xref target="FIPS186"/> to establish a shared secret (see <xref target="dh"/>) and a
symmetric secret for authentication (see <xref target="auth"/>).</t>

<t>A User Agent generates an ECDH key pair and authentication secret that it
associates with each subscription it creates.  The ECDH public key and the
authentication secret are sent to the Application Server with other details of
the push subscription.</t>

<t>When sending a message, an Application Server generates an ECDH key pair and a
random salt.  The ECDH public key is encoded into the <spanx style="verb">dh</spanx> parameter of the
Crypto-Key header field; the salt is encoded into the <spanx style="verb">salt</spanx> parameter of the
Encryption header field.  The ECDH key pair can be discarded after encrypting
the message.</t>

<t>The content of the push message is encrypted or decrypted using a content
encryption key and nonce that is derived using all of these inputs and the
process described in <xref target="encryption"/>.</t>

<section anchor="key-and-secret-distribution" title="Key and Secret Distribution">

<t>The application using the subscription distributes the subscription public key
and authentication secret to an authorized Application Server.  This could be
sent along with other subscription information that is provided by the User
Agent, such as the push subscription URI.</t>

<t>An application MUST use an authenticated, confidentiality protected
communications medium for this purpose.  In addition to the reasons described in
<xref target="I-D.ietf-webpush-protocol"/>, this ensures that the authentication secret is
not revealed to unauthorized entities, which can be used to generate push
messages that will be accepted by the User Agent.</t>

<t>Most applications that use push messaging have a pre-existing relationship with
an Application Server.  Any existing communication mechanism that is
authenticated and provides confidentiality and integrity, such as HTTPS
<xref target="RFC2818"/>, is sufficient.</t>

</section>
</section>
<section anchor="encryption" title="Push Message Encryption">

<t>Push message encryption happens in four phases:</t>

<t><list style="symbols">
  <t>The input keying material used for deriving the content encryption keys used
for the push message is derived using elliptic-curve Diffie-Hellman <xref target="ECDH"/>
(<xref target="dh"/>).</t>
  <t>This is then combined with the application secret to produce the input keying
material used in <xref target="I-D.ietf-httpbis-encryption-encoding"/> (<xref target="combine"/>).</t>
  <t>A content encryption key and nonce are derived using the process in
<xref target="I-D.ietf-httpbis-encryption-encoding"/> with an expanded context string
(<xref target="context"/>).</t>
  <t>Encryption or decryption follows according to
<xref target="I-D.ietf-httpbis-encryption-encoding"/>.</t>
</list></t>

<t>The key derivation process is summarized in <xref target="summary"/>.  Restrictions on the
use of the encrypted content coding are described in <xref target="restrict"/>.</t>

<section anchor="dh" title="Diffie-Hellman Key Agreement">

<t>For each new subscription that the User Agent generates for an Application, it
also generates a P-256 <xref target="FIPS186"/> key pair for use in elliptic-curve
Diffie-Hellman (ECDH) <xref target="ECDH"/>.</t>

<t>When sending a push message, the Application Server also generates a new ECDH
key pair on the same P-256 curve.</t>

<t>The ECDH public key for the Application Server is included in the <spanx style="verb">dh</spanx> parameter
of the Crypto-Key header field (see <xref target="iana"/>).  The uncompressed point form
defined in <xref target="X9.62"/> (that is, a 65 octet sequence that starts with a 0x04
octet) is encoded using base64url <xref target="RFC7515"/> to produce the <spanx style="verb">dh</spanx> parameter
value.</t>

<t>An Application combines its ECDH private key with the public key provided by the
User Agent using the process described in <xref target="ECDH"/>; on receipt of the push
message, a User Agent combines its private key with the public key provided by
the Application Server in the <spanx style="verb">dh</spanx> parameter in the same way.  These operations
produce the same value for the ECDH shared secret.</t>

</section>
<section anchor="auth" title="Push Message Authentication">

<t>To ensure that push messages are correctly authenticated, a symmetric
authentication secret is added to the information generated by a User Agent.
The authentication secret is mixed into the key derivation process described in
<xref target="I-D.ietf-httpbis-encryption-encoding"/>.</t>

<t>A User Agent MUST generate and provide a hard to guess sequence of 16 octets that
is used for authentication of push messages.  This SHOULD be generated by a
cryptographically strong random number generator <xref target="RFC4086"/>.</t>

</section>
<section anchor="combine" title="Combining Shared and Authentication Secrets">

<t>The shared secret produced by ECDH is combined with the authentication secret
using HMAC-based key derivation function (HKDF) described in <xref target="RFC5869"/>.  This
produces the input keying material used by
<xref target="I-D.ietf-httpbis-encryption-encoding"/>.</t>

<t>The HKDF function uses SHA-256 hash algorithm <xref target="FIPS180-4"/> with the following
inputs:</t>

<t><list style="hanging">
  <t hangText='salt:'>
  the authentication secret</t>
  <t hangText='IKM:'>
  the shared secret derived using ECDH</t>
  <t hangText='info:'>
  the ASCII-encoded string “Content-Encoding: auth” with a terminal zero octet</t>
  <t hangText='L:'>
  32 octets (i.e., the output is the length of the underlying SHA-256 HMAC
function output)</t>
</list></t>

</section>
<section anchor="context" title="Key Derivation Context">

<t>The derivation of the content encryption key and nonce uses an additional
context string.</t>

<t>The context is comprised of a label of “P-256” encoded in ASCII (that is, the
octet sequence 0x50, 0x2d, 0x32, 0x35, 0x36), a zero-valued octet, the length of
the User Agent public key (65 octets) encoded as a two octet unsigned integer in
network byte order, the User Agent public key, the length of the Application
Server public key (65 octets), and the Application Server public key.</t>

<figure><artwork type="inline"><![CDATA[
   context = label || 0x00 ||
               length(ua_public) || ua_public ||
               length(as_public) || as_public
]]></artwork></figure>

</section>
<section anchor="summary" title="Encryption Summary">

<t>This results in a the final content encryption key and nonce generation using
the following sequence, which is shown here in pseudocode with HKDF expanded
into separate discrete steps using HMAC with SHA-256:</t>

<figure><artwork type="inline"><![CDATA[
   -- For a User Agent:
   ecdh_secret = ECDH(ua_private, as_public)
   auth_secret = random(16)

   -- For an Application Server:
   ecdh_secret = ECDH(as_private, ua_public)
   auth_secret = <from User Agent>

   -- For both:
   auth_info = "Content-Encoding: auth" || 0x00
   PRK_combine = HMAC-SHA-256(auth_secret, ecdh_secret)
   IKM = HMAC-SHA-256(PRK_combine, auth_info || 0x01)
   context = "P-256" || 0x00 ||
             0x00 || 0x41 || ua_public ||
             0x00 || 0x41 || as_public
   salt = random(16)
   PRK = HMAC-SHA-256(salt, IKM)
   cek_info = "Content-Encoding: aesgcm" || 0x00 || context
   CEK = HMAC-SHA-256(PRK, cek_info || 0x01)[0..15]
   nonce_info = "Content-Encoding: nonce" || 0x00 || context
   NONCE = HMAC-SHA-256(PRK, nonce_info || 0x01)[0..11]
]]></artwork></figure>

<t>Note that this omits the exclusive OR of the final nonce with the record
sequence number, since push messages contain only a single record (see
<xref target="restrict"/>) and the sequence number of the first record is zero.</t>

</section>
</section>
<section anchor="restrict" title="Restrictions on Use of “aesgcm” Content Coding">

<t>An Application Server MUST encrypt a push message with a single record.  This
allows for a minimal receiver implementation that handles a single record.  If
the message is 4096 octets or longer, the <spanx style="verb">rs</spanx> parameter MUST be set to a value
that is longer than the encrypted push message length.</t>

<t>A push service is not required to support more than 4096 octets of payload body
(see Section 7.2 of <xref target="I-D.ietf-webpush-protocol"/>), which equates to 4077
octets of cleartext, so the <spanx style="verb">rs</spanx> parameter can be omitted for messages that fit
within this limit.</t>

<t>An Application Server MUST NOT use other content encodings for push messages.
In particular, content encodings that compress could result in leaking of push
message contents.  The Content-Encoding header field therefore has exactly one
value, which is <spanx style="verb">aesgcm</spanx>.  Multiple <spanx style="verb">aesgcm</spanx> values are not permitted.</t>

<t>An Application Server MUST include exactly one entry in the Encryption field,
and at most one entry having a <spanx style="verb">dh</spanx> parameter in the Crypto-Key field. This
allows the <spanx style="verb">keyid</spanx> parameter to be omitted from both header fields.</t>

<t>An Application Server MUST NOT include an <spanx style="verb">aesgcm</spanx> parameter in the Encryption
header field.</t>

<t>A User Agent is not required to support multiple records.  A User Agent MAY
ignore the <spanx style="verb">rs</spanx> parameter.  If a record size is size is present, but unchecked,
decryption will fail with high probability for all valid cases.  Decryption will
also succeed if the push message contains a single record from a longer
truncated message.  Given that an Application Server is prohibited from
generating such a message, this is not considered a serious risk.</t>

</section>
<section anchor="example" title="Push Message Encryption Example">

<t>The following example shows a push message being sent to a push service.</t>

<figure><artwork type="example"><![CDATA[
POST /push/JzLQ3raZJfFBR0aqvOMsLrt54w4rJUsV HTTP/1.1
Host: push.example.net
TTL: 10
Content-Length: 33
Content-Encoding: aesgcm
Encryption: salt="lngarbyKfMoi9Z75xYXmkg"
Crypto-Key: dh="BNoRDbb84JGm8g5Z5CFxurSqsXWJ11ItfXEWYVLE85Y7
                CYkDjXsIEc4aqxYaQ1G8BqkXCJ6DPpDrWtdWj_mugHU"

6nqAQUME8hNqw5J3kl8cpVVJylXKYqZOeseZG8UueKpA
]]></artwork></figure>

<t>This example shows the ASCII encoded string, “I am the walrus”. The content body
is shown here encoded in URL-safe base64url for presentation reasons only.  Line
wrapping of the “dh” parameter is added for presentation purposes.</t>

<t>Since there is no ambiguity about which keys are being used, the “keyid”
parameter is omitted from both the Encryption and Crypto-Key header fields.  The
keys shown below use uncompressed points <xref target="X9.62"/> encoded using base64url.</t>

<figure><artwork type="example"><![CDATA[
   Authentication Secret: R29vIGdvbyBnJyBqb29iIQ
   Receiver:
      private key: 9FWl15_QUQAWDaD3k3l50ZBZQJ4au27F1V4F0uLSD_M
      public key: BCEkBjzL8Z3C-oi2Q7oE5t2Np-p7osjGLg93qUP0wvqR
                  T21EEWyf0cQDQcakQMqz4hQKYOQ3il2nNZct4HgAUQU
   Sender:
      private key: nCScek-QpEjmOOlT-rQ38nZzvdPlqa00Zy0i6m2OJvY
      public key: <the value of the "dh" parameter>
]]></artwork></figure>

<t>The sender’s private key used in this example is
“nCScek-QpEjmOOlT-rQ38nZzvdPlqa00Zy0i6m2OJvY”.  Intermediate values for this
example are included in <xref target="ex-intermediate"/>.</t>

</section>
<section anchor="iana" title="IANA Considerations">

<t>This document defines the “dh” parameter for the Crypto-Key header field in the
“Hypertext Transfer Protocol (HTTP) Crypto-Key Parameters” registry defined in
<xref target="I-D.ietf-httpbis-encryption-encoding"/>.</t>

<t><list style="symbols">
  <t>Parameter Name: dh</t>
  <t>Purpose: The “dh” parameter contains a Diffie-Hellman share which is used to
derive the input keying material used in “aesgcm” content coding.</t>
  <t>Reference: this document.</t>
</list></t>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>The security considerations of <xref target="I-D.ietf-httpbis-encryption-encoding"/> describe
the limitations of the content encoding.  In particular, any HTTP header fields
are not protected by the content encoding scheme.  A User Agent MUST consider
HTTP header fields to have come from the Push Service.  An application on the
User Agent that uses information from header fields to alter their processing of
a push message is exposed to a risk of attack by the Push Service.</t>

<t>The timing and length of communication cannot be hidden from the Push Service.
While an outside observer might see individual messages intermixed with each
other, the Push Service will see what Application Server is talking to which
User Agent, and the subscription that is used.  Additionally, the length of
messages could be revealed unless the padding provided by the content encoding
scheme is used to obscure length.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>

<reference anchor="ECDH" target="http://www.secg.org/">
  <front>
    <title>Elliptic Curve Cryptography</title>
    <author >
      <organization>SECG</organization>
    </author>
    <date year="2000"/>
  </front>
  <seriesInfo name="SEC 1" value=""/>
</reference>
<reference anchor="FIPS186" >
  <front>
    <title>Digital Signature Standard (DSS)</title>
    <author >
      <organization>National Institute of Standards and Technology (NIST)</organization>
    </author>
    <date year="2013" month="July"/>
  </front>
  <seriesInfo name="NIST PUB 186-4" value=""/>
</reference>
<reference anchor="X9.62" >
  <front>
    <title>Public Key Cryptography For The Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA)</title>
    <author >
      <organization>ANSI</organization>
    </author>
    <date year="1998"/>
  </front>
  <seriesInfo name="ANSI X9.62" value=""/>
</reference>
<reference anchor="FIPS180-4" target="http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf">
  <front>
    <title>NIST FIPS 180-4, Secure Hash Standard</title>
    <author initials="National Institute of Standards and Technology, U.S." surname="Department of Commerce" fullname="NIST">
      <organization></organization>
    </author>
    <date year="2012" month="March"/>
  </front>
</reference>




<reference anchor='I-D.ietf-webpush-protocol'>
<front>
<title>Generic Event Delivery Using HTTP Push</title>

<author initials='M' surname='Thomson' fullname='Martin Thomson'>
    <organization />
</author>

<author initials='E' surname='Damaggio' fullname='Elio Damaggio'>
    <organization />
</author>

<author initials='B' surname='Raymor' fullname='Brian Raymor'>
    <organization />
</author>

<date month='September' day='26' year='2016' />

<abstract><t>A simple protocol for the delivery of real-time events to user agents is described.  This scheme uses HTTP/2 server push.</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-webpush-protocol-10' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-webpush-protocol-10.txt' />
<format type='PDF'
        target='http://www.ietf.org/internet-drafts/draft-ietf-webpush-protocol-10.pdf' />
</reference>



<reference anchor='I-D.ietf-httpbis-encryption-encoding'>
<front>
<title>Encrypted Content-Encoding for HTTP</title>

<author initials='M' surname='Thomson' fullname='Martin Thomson'>
    <organization />
</author>

<date month='June' day='29' year='2016' />

<abstract><t>This memo introduces a content-coding for HTTP that allows message payloads to be encrypted.  Note to Readers  Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org), which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/ .  Working Group information can be found at http://httpwg.github.io/ ; source code and issues list for this draft can be found at https://github.com/httpwg/http-extensions/labels/encryption .</t></abstract>

</front>

<seriesInfo name='Internet-Draft' value='draft-ietf-httpbis-encryption-encoding-02' />
<format type='TXT'
        target='http://www.ietf.org/internet-drafts/draft-ietf-httpbis-encryption-encoding-02.txt' />
</reference>



<reference  anchor='RFC2119' target='http://www.rfc-editor.org/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='http://www.rfc-editor.org/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='RFC4086' target='http://www.rfc-editor.org/info/rfc4086'>
<front>
<title>Randomness Requirements for Security</title>
<author initials='D.' surname='Eastlake 3rd' fullname='D. Eastlake 3rd'><organization /></author>
<author initials='J.' surname='Schiller' fullname='J. Schiller'><organization /></author>
<author initials='S.' surname='Crocker' fullname='S. Crocker'><organization /></author>
<date year='2005' month='June' />
<abstract><t>Security systems are built on strong cryptographic algorithms that foil pattern analysis attempts.  However, the security of these systems is dependent on generating secret quantities for passwords, cryptographic keys, and similar quantities.  The use of pseudo-random processes to generate secret quantities can result in pseudo-security. A sophisticated attacker may find it easier to reproduce the environment that produced the secret quantities and to search the resulting small set of possibilities than to locate the quantities in the whole of the potential number space.</t><t>Choosing random quantities to foil a resourceful and motivated adversary is surprisingly difficult.  This document points out many pitfalls in using poor entropy sources or traditional pseudo-random number generation techniques for generating such quantities.  It recommends the use of truly random hardware techniques and shows that the existing hardware on many systems can be used for this purpose. It provides suggestions to ameliorate the problem when a hardware solution is not available, and it gives examples of how large such quantities need to be for some applications.  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='106'/>
<seriesInfo name='RFC' value='4086'/>
<seriesInfo name='DOI' value='10.17487/RFC4086'/>
</reference>



<reference  anchor='RFC5869' target='http://www.rfc-editor.org/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>




    </references>

    <references title='Informative References'>

<reference anchor="API" target="https://w3c.github.io/push-api/">
  <front>
    <title>Web Push API</title>
    <author initials="M." surname="van Ouwerkerk">
      <organization></organization>
    </author>
    <author initials="M." surname="Thomson">
      <organization></organization>
    </author>
    <date year="2015"/>
  </front>
</reference>




<reference  anchor='RFC7230' target='http://www.rfc-editor.org/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>



<reference  anchor='RFC2818' target='http://www.rfc-editor.org/info/rfc2818'>
<front>
<title>HTTP Over TLS</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2000' month='May' />
<abstract><t>This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet.  This memo provides information for the Internet community.</t></abstract>
</front>
<seriesInfo name='RFC' value='2818'/>
<seriesInfo name='DOI' value='10.17487/RFC2818'/>
</reference>




    </references>


<section anchor="ex-intermediate" title="Intermediate Values for Encryption">

<t>The intermediate values calculated for the example in <xref target="example"/> are
shown here.  The following are inputs to the calculation:</t>

<t><list style="hanging">
  <t hangText='Plaintext:'>
  SSBhbSB0aGUgd2FscnVz</t>
  <t hangText='Application Server public key (as_public):'>
  BNoRDbb84JGm8g5Z5CFxurSqsXWJ11ItfXEWYVLE85Y7
CYkDjXsIEc4aqxYaQ1G8BqkXCJ6DPpDrWtdWj_mugHU</t>
  <t hangText='Application Server private key (as_private):'>
  nCScek-QpEjmOOlT-rQ38nZzvdPlqa00Zy0i6m2OJvY</t>
  <t hangText='User Agent public key (ua_public):'>
  BCEkBjzL8Z3C-oi2Q7oE5t2Np-p7osjGLg93qUP0wvqR
T21EEWyf0cQDQcakQMqz4hQKYOQ3il2nNZct4HgAUQU</t>
  <t hangText='User Agent private key (ua_private):'>
  9FWl15_QUQAWDaD3k3l50ZBZQJ4au27F1V4F0uLSD_M</t>
  <t hangText='Salt:'>
  lngarbyKfMoi9Z75xYXmkg</t>
  <t hangText='Authentication secret (auth_secret):'>
  R29vIGdvbyBnJyBqb29iIQ</t>
</list></t>

<t>Note that knowledge of just one of the private keys is necessary.  The
Application Server randomly generates the salt value, whereas salt is input to
the receiver.</t>

<t>This produces the following intermediate values:</t>

<t><list style="hanging">
  <t hangText='Shared secret (ecdh_secret):'>
  RNjC-NVW4BGJbxWPW7G2mowsLeDa53LYKYm4–NOQ6Y</t>
  <t hangText='Input keying material (IKM):'>
  EhpZec37Ptm4IRD5-jtZ0q6r1iK5vYmY1tZwtN8fbZY</t>
  <t hangText='Context for content encryption key derivation:'>
  Q29udGVudC1FbmNvZGluZzogYWVzZ2NtAFAtMjU2AABB
BCEkBjzL8Z3C-oi2Q7oE5t2Np-p7osjGLg93qUP0wvqR
T21EEWyf0cQDQcakQMqz4hQKYOQ3il2nNZct4HgAUQUA
QQTaEQ22_OCRpvIOWeQhcbq0qrF1iddSLX1xFmFSxPOW
OwmJA417CBHOGqsWGkNRvAapFwiegz6Q61rXVo_5roB1</t>
  <t hangText='Content encryption key (CEK):'>
  AN2-xhvFWeYh5z0fcDu0Ww</t>
  <t hangText='Context for nonce derivation:'>
  Q29udGVudC1FbmNvZGluZzogbm9uY2UAUC0yNTYAAEEE
ISQGPMvxncL6iLZDugTm3Y2n6nuiyMYuD3epQ_TC-pFP
bUQRbJ_RxANBxqRAyrPiFApg5DeKXac1ly3geABRBQBB
BNoRDbb84JGm8g5Z5CFxurSqsXWJ11ItfXEWYVLE85Y7
CYkDjXsIEc4aqxYaQ1G8BqkXCJ6DPpDrWtdWj_mugHU</t>
  <t hangText='Base nonce:'>
  JY1Okw5rw1Drkg9J</t>
</list></t>

<t>When the CEK and nonce are used with AES GCM and the padded plaintext of
AABJIGFtIHRoZSB3YWxydXM, the final ciphertext is
6nqAQUME8hNqw5J3kl8cpVVJylXKYqZOeseZG8UueKpA, as shown in the example.</t>

</section>


  </back>
</rfc>

