<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [

<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC5246 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5246.xml">
<!ENTITY RFC5077 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5077.xml">
<!ENTITY RFC3629 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3629.xml">
<!ENTITY RFC5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
<!ENTITY RFC7230 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7230.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<?rfc rfcedstyle="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc number="7301" category="std"
     ipr="trust200902" submissionType="IETF" consensus="yes">


  <!-- ***** FRONT MATTER ***** -->

  <front>
    <!-- The abbreviated title is used in the page header - it is only necessary if the 
         full title is longer than 39 characters -->

    <title abbrev="TLS App-Layer Protocol Negotiation Ext">Transport Layer Security (TLS) Application&nbhy;Layer&nbsp;Protocol&nbsp;Negotiation&nbsp;Extension</title>

    <!-- add 'role="editor"' below for the editors if appropriate -->

    <author fullname="Stephan Friedl" initials="S.F."
            surname="Friedl">
      <organization>Cisco Systems, Inc.</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <!-- Reorder these if your country does things differently -->

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

          <country>USA</country>
        </postal>

        <phone>(720)562-6785</phone>

        <email>sfriedl@cisco.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Andrei Popov" initials="A."
            surname="Popov">
      <organization>Microsoft Corp.</organization>

      <address>
        <postal>
          <street>One Microsoft Way</street>

          <!-- Reorder these if your country does things differently -->

          <city>Redmond</city>

          <region>WA</region>

          <code>98052</code>

          <country>USA</country>
        </postal>

        <email>andreipo@microsoft.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Adam Langley" initials="A."
            surname="Langley">
      <organization>Google Inc.</organization>

      <address>
        <postal>
          <street></street>

          <!-- Reorder these if your country does things differently -->

          <city></city>

          <region></region>

          <code></code>

          <country>USA</country>
        </postal>

        <email>agl@google.com</email>

        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>

    <author fullname="Emile Stephan" initials="E."
            surname="Stephan">
        <organization>Orange</organization>

        <address>
            <postal>
                <street>2 avenue Pierre Marzin</street>

                <!-- Reorder these if your country does things differently -->

                <city>Lannion</city>

                <code>F-22307</code>

                <country>France</country>
            </postal>

            <email>emile.stephan@orange.com</email>

        </address>
    </author>

    <date month="July" year="2014" />

    <area>General</area>

<keyword>ALPN</keyword>

    <abstract>

<!-- The following text has been updated per the RFC Editor Note.
-->
      <t>
  This document describes a Transport Layer Security (TLS) extension
   for application-layer protocol negotiation within the TLS handshake.
   For instances in which multiple application protocols are supported on 
   the same TCP or UDP port, this extension allows the application layer to
   negotiate which protocol will be used within the TLS connection.
      </t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
<!-- [rfced] "TLS security protocol" seems redundant, considering the
meaning of "TLS". Could it be changed to simply "TLS protocol"?
Similarly, may "TLS security guarantees" be "security guarantees using TLS"?

[agl] Have applied the first, suggested change. I weakly disagree with the second.
-->

      <t>Increasingly, application-layer protocols are encapsulated in the TLS protocol <xref target="RFC5246"/>. 
      This encapsulation enables applications to use the existing, secure communications links already present on 
      port 443 across virtually the entire global IP infrastructure.</t>

      <t>When multiple application protocols are supported on a single server-side port number, such as port 443, 
      the client and the server need to negotiate an application protocol for use with each connection. It is 
      desirable to accomplish this negotiation without adding network round-trips between the client and the server,
      as each round-trip will degrade an end-user's experience. Further, it would be advantageous to allow 
      certificate selection based on the negotiated application protocol.</t>

      <t>This document specifies a TLS extension that permits the application layer to negotiate protocol selection 
      within the TLS handshake. 

<!-- [rfced] This document has a normative reference to RFC 2616, which 
was recently obsoleted by RFCs 7230-7235. We recommend adding mention 
of the most recent RFCs on the topic. If you agree, please provide the 
updated text.

[agl]: I have updated the reference to RFC 7230, which I'm taking to be
representative of the collection of HTTP 1.1 RFCs as a whole.
-->

<!-- [rfced] Please clarify the intended meaning of this sentence.

[agl]: Have used the second suggestion since I believe a contrast was intended.
I have also fixed what I think was a typo by using "HTTP/2" rather than "HTTP
version".
-->

This work was requested by the HTTPbis WG to address the negotiation of HTTP/2 
      (<xref target="HTTP2"/>) over TLS; however, ALPN facilitates negotiation 
      of arbitrary application-layer protocols.</t>

      <t>With ALPN, the client sends the list of supported application protocols as part of the TLS ClientHello 
      message. The server chooses a protocol and sends the selected protocol as part of the TLS ServerHello message. 
      The application protocol negotiation can thus be accomplished within the TLS handshake, without adding network 
      round-trips, and allows the server to associate a different certificate with each application protocol, if 
      desired.</t>
    </section>

    <section title="Requirements Language">
      <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>
    </section>

    <section title="Application-Layer Protocol Negotiation">

      <section title="The Application-Layer Protocol Negotiation Extension">
        <t>
        A new extension type ("application_layer_protocol_negotiation(16)") is defined and MAY be included by the client in
        its "ClientHello" message.
        </t>
      
        <figure>
        <artwork align="left"><![CDATA[
enum {
	application_layer_protocol_negotiation(16), (65535)
} ExtensionType;
        ]]></artwork>
		</figure>

        <t>The "extension_data" field of the ("application_layer_protocol_negotiation(16)") extension SHALL contain a "ProtocolNameList" value.</t>

        <figure>
        <artwork align="left"><![CDATA[
opaque ProtocolName<1..2^8-1>;

struct {
	ProtocolName protocol_name_list<2..2^16-1>
} ProtocolNameList;
        ]]></artwork>
		</figure>

	<t>"ProtocolNameList" contains the list of protocols advertised by the client, in descending order of preference. Protocols are named by IANA-registered, opaque, non-empty byte strings, as described
		further in <xref target="iana_cons"/> ("IANA Considerations") of this document.  Empty strings 
		MUST NOT be included and byte strings MUST NOT be truncated.</t>

<!-- [rfced] These terms appear as follows in this document. 
Please review their use and let us know whether any updates are 
needed for consistency.

  client hello vs. ClientHello
  server hello vs. ServerHello

[agl] I have changed "client hello" to ClientHello since that is the proper
name of the message. (I, personally, would also put it in an <xspan
style="verb"> but that doesn't seem to be done in this document.)

[agl] I've not changed "server hello" because I don't think it's the
ServerHello message itself that is being named.
-->

        <t>Servers that receive a ClientHello containing the "application_layer_protocol_negotiation" extension MAY 
        	return a suitable protocol selection response to the client.  The server will ignore any protocol name that 
		it does not recognize.  A new ServerHello extension type ("application_layer_protocol_negotiation(16)") MAY be returned to the client within 
		the extended ServerHello message.  The "extension_data" field of the ("application_layer_protocol_negotiation(16)") extension is 
		structured the same as described above for the client "extension_data", except that the "ProtocolNameList" MUST contain exactly one 
		"ProtocolName".
		</t>

        <t>
        Therefore, a full handshake with the "application_layer_protocol_negotiation" extension in the ClientHello and ServerHello messages
		has the following flow (contrast with Section 7.3 of <xref target="RFC5246"/>):
        </t>

<!-- [rfced] In Figure 1, will it be clear to the reader what the
asterisk indicates or would you like to add an explanatory note?
Section 7.3 of RFC 5246 contains this note:
 
 * Indicates optional or situation-dependent messages that are not
   always sent.

[agl]: I think the meaning of * is the same as in RFC 5246 and so have copied
that wording below the figure.
-->
        
      <figure align="center" anchor="full_handshake">

        <artwork align="left"><![CDATA[
Client                                              Server

ClientHello                     -------->       ServerHello
  (ALPN extension &                               (ALPN extension &
   list of protocols)                              selected protocol)
                                                Certificate*
                                                ServerKeyExchange*
                                                CertificateRequest*
                                <--------       ServerHelloDone
Certificate*
ClientKeyExchange
CertificateVerify*
[ChangeCipherSpec]
Finished                        -------->
                                                [ChangeCipherSpec]
                                <--------       Finished
Application Data                <------->       Application Data
            ]]></artwork>

      </figure>

      <t>* Indicates optional or situation-dependent messages that are not always sent.</t>

      
      <t>
      An abbreviated handshake with the "application_layer_protocol_negotiation" 
	  extension has the following flow:
	  </t>
	  
      <figure align="center" anchor="abbreviated_handshake">

        <artwork align="left"><![CDATA[
Client                                              Server

ClientHello                     -------->       ServerHello
  (ALPN extension &                               (ALPN extension &
   list of protocols)                              selected protocol)
                                                [ChangeCipherSpec]
                                <--------       Finished
[ChangeCipherSpec]
Finished                        -------->
Application Data                <------->       Application Data
            ]]></artwork>

      </figure>
        
		<t>Unlike many other TLS extensions, this extension does not establish properties of the session,
		only of the connection.  When session resumption or session tickets <xref target="RFC5077"/>
		are used, the previous contents of this extension are irrelevant, and only the values in the new 
		handshake messages are considered.</t>
		
      </section>

      <section title="Protocol Selection">
      
        <t>It is expected that a server will have a list of protocols that it supports, in preference order, 
        and will only select a protocol if the client supports it.  In that case, the server SHOULD select
        the most highly preferred protocol that it supports and that is also advertised by the client.  In the event
        that the server supports no protocols that the client advertises, then the server SHALL respond
        with a fatal "no_application_protocol" alert.</t>

        <figure>
        <artwork align="left"><![CDATA[
enum {
	no_application_protocol(120),
	(255)
} AlertDescription;
        ]]></artwork>
		</figure>

        <t>The protocol identified in the "application_layer_protocol_negotiation" extension type in the ServerHello SHALL be definitive for
        the connection, until renegotiated.  The server SHALL NOT respond with a selected protocol and subsequently use a different
        protocol for application data exchange.</t>
        
      </section>

    </section>

    <section title="Design Considerations">
      <t>
      The ALPN extension is intended to follow the typical design of TLS protocol extensions.  Specifically,
		the negotiation is performed entirely within the client/server hello exchange in accordance with
		the established TLS architecture.  The "application_layer_protocol_negotiation" ServerHello extension is intended to
		be definitive for the connection (until the connection is renegotiated) and is sent in plaintext to permit network elements to provide
		differentiated service for the connection when the TCP or UDP port number is not definitive for the
		application-layer protocol to be used in the connection.  By placing ownership of protocol selection 
		on the server, ALPN facilitates scenarios in which certificate selection or connection rerouting 
		may be based on the negotiated protocol.
      </t>

		<t>Finally, by managing protocol selection in the clear as part of the handshake, ALPN avoids introducing 
		false confidence with respect to the ability to hide the negotiated protocol in advance of establishing the connection.
		If hiding the protocol is required, then renegotiation after connection establishment, which would provide true
		TLS security guarantees, would be a preferred methodology.
		</t>

    </section>

    <section title="Security Considerations">
      <t>
      The ALPN extension does not impact the security of TLS session establishment or application data exchange.  ALPN
      serves to provide an externally visible marker for the application-layer protocol associated with the TLS
      connection.  Historically, the application-layer protocol associated with a connection could be ascertained from
      the TCP or UDP port number in use.
</t>
      
     <t> Implementers and document editors who intend to extend the protocol
      identifier registry by adding new protocol identifiers should consider 
      that in TLS versions 1.2 and below the client sends these identifiers
      in the clear. They should also consider that, for at least the next
      decade, it is expected that browsers would normally use these earlier versions of TLS in the initial ClientHello.
</t>
      
      <t>Care must be taken when such identifiers may leak personally
      identifiable information, or when such leakage may lead to profiling or
      to leaking of sensitive information. If any of these apply to this
      new protocol identifier, the identifier SHOULD NOT be used in
     TLS configurations where it would be visible in the clear, and documents specifying such protocol
      identifiers SHOULD recommend against such unsafe use.
      </t>
    </section>

    <section title="IANA Considerations" anchor="iana_cons">

      <t>The IANA has updated its "ExtensionType Values" registry to include the following entry:
        <list style="empty">
          <t>16 application_layer_protocol_negotiation</t>
        </list>
      </t>

<!-- [rfced] This hyphen has been added throughout the document
because 'application-layer' is serving as an adjective. So, we 
suggest updating the name of the registry as follows. If you 
agree, we will ask IANA to update the registry accordingly.

OLD: Application Layer Protocol Negotiation (ALPN) Protocol IDs

NEW: Application-Layer Protocol Negotiation (ALPN) Protocol IDs

[agl] I agree.
-->

      <t>This document establishes a registry for protocol identifiers entitled "Application-Layer Protocol Negotiation (ALPN) 
      Protocol IDs" under the existing "Transport Layer Security (TLS) Extensions" heading.</t>

      <t>Entries in this registry require the following fields:

<?rfc subcompact="yes"?>

        <list style="symbols">
          <t>Protocol: The name of the protocol.</t>
          <t>Identification Sequence: The precise set of octet values that identifies the protocol. 
          This could be the UTF-8 encoding <xref target="RFC3629"/> of the protocol name.</t>
          <t>Reference: A reference to a specification that defines the protocol.</t>
        </list>
      </t>

      <t>This registry operates under the "Expert Review" policy as defined in <xref target="RFC5226"/>. 
      The designated expert is advised to encourage the inclusion of a reference to a permanent and readily 
      available specification that enables the creation of interoperable implementations of the identified protocol.</t>

     <t>The initial set of registrations for this registry is as follows:

       <list style="hanging">
         <t hangText="Protocol:"> HTTP/1.1</t>
         <t hangText="Identification Sequence:">
<vspace/>
 0x68 0x74 0x74 0x70 0x2f 0x31 0x2e 0x31 ("http/1.1")</t>
         <t hangText="Reference:"> <xref target="RFC7230"/></t>
       </list>

       <list style="hanging">
         <t hangText="Protocol:"> SPDY/1</t>
         <t hangText="Identification Sequence:">
<vspace/>
 0x73 0x70 0x64 0x79 0x2f 0x31 ("spdy/1")</t>
         <t hangText="Reference:">
<vspace/>
http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft1</t>
       </list>

       <list style="hanging">
         <t hangText="Protocol:"> SPDY/2</t>
         <t hangText="Identification Sequence:">
<vspace/>
 0x73 0x70 0x64 0x79 0x2f 0x32 ("spdy/2")</t>
         <t hangText="Reference:">
<vspace/>
http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2</t>
       </list>

       <list style="hanging">
         <t hangText="Protocol:"> SPDY/3</t>
         <t hangText="Identification Sequence:">
<vspace/>
0x73 0x70 0x64 0x79 0x2f 0x33 ("spdy/3")</t>
         <t hangText="Reference:"> 
<vspace/>
http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3</t>
       </list>

<?rfc subcompact="no"?>

     </t>
    </section>
  
    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>
      This document benefitted specifically from the Next Protocol Negotiation
      (NPN) extension document authored by Adam Langley and
      from discussions with Tom Wesselman and Cullen Jennings, both of Cisco.
      </t>
    </section>
  </middle>


  <!--  *****BACK MATTER ***** -->

  <back>
    <references title="Normative References">

      &RFC2119;
      
      &RFC5246;
      
      &RFC7230;

      &RFC3629;

      &RFC5226;

    </references>

    <references title="Informative References">
      
      &RFC5077;
      
<!-- draft-ietf-httpbis-http2: I-D Exists -->
<reference anchor='HTTP2'>
<front>
<title>Hypertext Transfer Protocol version 2</title>

<author initials='M' surname='Belshe' fullname='Mike Belshe'>
    <organization />
</author>

<author initials='R' surname='Peon' fullname='Roberto Peon'>
    <organization />
</author>

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

<date month='June' year='2014' />

<abstract><t>This specification describes an optimized expression of the syntax of the Hypertext Transfer Protocol (HTTP).  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 messages on the same connection.  It also introduces unsolicited push of representations from servers to clients.  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="Work" value="in Progress"/>

</reference>


     </references>

  </back>
</rfc>
