RFC 7301

Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension

πŸ“… published July 2014, from ietf

RFC 7301 part 1 πŸŽ€βœ¨

okay bestie, this one is Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension πŸ’– It's a Standards Track doc from July 2014, with ISSN 2070-1721. The authors are S. Friedl (Cisco Systems, Inc.), A. Popov (Microsoft Corp.), A. Langley (Google Inc.), and E. Stephan (Orange) 🫢

Abstract ✨

okay so this doc describes a TLS extension for application-layer protocol negotiation inside the TLS handshake πŸ¦‹ When several application protocols run on the same TCP or UDP port, this extension lets the application layer decide which protocol gets used inside that TLS connection. It's giving efficient πŸ’…

Status of This Memo

this is an Internet Standards Track document πŸ“œ It's a product of the Internet Engineering Task Force (IETF) and represents the consensus of the IETF community. It got public review and was approved for publication by the Internet Engineering Steering Group (IESG) πŸ‘‘ More on Internet Standards is in Section 2 of RFC 5741.

info about the current status, any errata, and how to send feedback lives at http://www.rfc-editor.org/info/rfc7301 🌸

Copyright (c) 2014 IETF Trust and the persons identified as the document authors. All rights reserved πŸ’œ

this document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as in effect on the date of publication. please read those carefully, because they explain your rights and restrictions for this doc πŸ™ˆ Code Components pulled out of this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions, and they come without warranty as described in the Simplified BSD License ⚠️

Table of Contents

   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Requirements Language . . . . . . . . . . . . . . . . . . . .   3
   3.  Application-Layer Protocol Negotiation  . . . . . . . . . . .   3
     3.1.  The Application-Layer Protocol Negotiation Extension  . .   3
     3.2.  Protocol Selection  . . . . . . . . . . . . . . . . . . .   5
   4.  Design Considerations . . . . . . . . . . . . . . . . . . . .   6
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .   6
   6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   7
   7.  Acknowledgements  . . . . . . . . . . . . . . . . . . . . . .   8
   8.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   8
     8.1.  Normative References  . . . . . . . . . . . . . . . . . .   8
     8.2.  Informative References  . . . . . . . . . . . . . . . . .   8

1. Introduction ✨

okay so more and more application-layer protocols are getting wrapped inside TLS [RFC5246] πŸ” That's iconic, because apps can ride on the secure links that already exist on port 443 across basically the entire global IP infrastructure 🌍

when several application protocols share one server-side port number, like port 443, the client and the server need to agree on an application protocol for each connection. Ideally they do that without adding network round-trips, because every round-trip makes the end-user's experience worse 😭 It would also be amazing to pick a certificate based on the negotiated application protocol πŸ”₯

this document specifies a TLS extension that lets the application layer negotiate protocol selection within the TLS handshake πŸ’… The HTTPbis WG asked for it so HTTP/2 ([HTTP2]) could be negotiated over TLS, but ALPN works for arbitrary application-layer protocols too πŸ¦‹

with ALPN, the client sends its list of supported application protocols as part of the TLS ClientHello message. The server picks a protocol and sends the selected protocol as part of the TLS ServerHello message πŸ‘‘ So the negotiation happens inside the TLS handshake without extra network round-trips, and the server can attach a different certificate to each application protocol if it wants 🧚

2. Requirements Language πŸŽ€

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 [RFC2119] πŸ“–

3. Application-Layer Protocol Negotiation 🌈

3.1. The Application-Layer Protocol Negotiation Extension πŸ’–

a new extension type ("application_layer_protocol_negotiation(16)") is defined, and it MAY be included by the client in its "ClientHello" message πŸ¦‹

   enum {
       application_layer_protocol_negotiation(16), (65535)
   } ExtensionType;

the "extension_data" field of the ("application_layer_protocol_negotiation(16)") extension SHALL contain a "ProtocolNameList" value πŸŽ€

   opaque ProtocolName<1..2^8-1>;

   struct {
       ProtocolName protocol_name_list<2..2^16-1>
   } ProtocolNameList;

"ProtocolNameList" holds the list of protocols the client advertises, in descending order of preference ✨ Protocols are named by IANA-registered, opaque, non-empty byte strings, as described further in Section 6 ("IANA Considerations") of this document πŸ“‹ Empty strings MUST NOT be included, and byte strings MUST NOT be truncated πŸ™…β€β™€οΈ

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 it doesn't 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 way as the client "extension_data" described above, except that the "ProtocolNameList" MUST contain exactly one "ProtocolName" 🫢

so a full handshake with the "application_layer_protocol_negotiation" extension in the ClientHello and ServerHello messages has this flow (contrast with Section 7.3 of [RFC5246]) πŸ”₯

   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

                                 Figure 1

* Indicates optional or situation-dependent messages that are not always sent.

an abbreviated handshake with the "application_layer_protocol_negotiation" extension has this flow:

   Client                                              Server

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

                                 Figure 2

unlike many other TLS extensions, this extension doesn't establish properties of the session, only of the connection πŸ¦‹ When session resumption or session tickets [RFC5077] are used, the previous contents of this extension are irrelevant, and only the values in the new handshake messages are considered πŸŒ™

3.2. Protocol Selection πŸ‘‘

the server is expected to have a list of protocols it supports, in preference order, and it only selects 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 ✨ If the server supports none of the protocols the client advertises, then the server SHALL respond with a fatal "no_application_protocol" alert 😭

   enum {
       no_application_protocol(120),
       (255)
   } AlertDescription;

the protocol identified in the "application_layer_protocol_negotiation" extension type in the ServerHello SHALL be definitive for the connection until it's renegotiated πŸ”₯ The server SHALL NOT respond with a selected protocol and then use a different protocol for application data exchange πŸ™…β€β™€οΈ

5. Security Considerations πŸ”’βœ¨

okay so the ALPN extension does not impact the security of TLS session establishment or application data exchange πŸ›‘οΈ it's literally just a label. ALPN gives an externally visible marker for the application-layer protocol tied to the TLS connection. Historically, you could figure out that protocol from the TCP or UDP port number in use. πŸŽ€

Implementers and document editors who want 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, browsers are expected to normally use these earlier versions of TLS in the initial ClientHello 🌸.

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 a 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 πŸ’€πŸ«Ά.


6. IANA Considerations 🧚

The IANA has updated its "ExtensionType Values" registry to include the following entry πŸ“:

   16 application_layer_protocol_negotiation

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 πŸ’–.

Entries in this registry require the following fields:

  • Protocol: The name of the protocol.
  • Identification Sequence: The precise set of octet values that identifies the protocol. This could be the UTF-8 encoding [RFC3629] of the protocol name.
  • Reference: A reference to a specification that defines the protocol.

This registry operates under the "Expert Review" policy as defined in [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 ✨.

The initial set of registrations for this registry is as follows πŸ“‹:

   Protocol:  HTTP/1.1
   Identification Sequence:
      0x68 0x74 0x74 0x70 0x2f 0x31 0x2e 0x31 ("http/1.1")
   Reference:  [RFC7230]

   Protocol:  SPDY/1
   Identification Sequence:
      0x73 0x70 0x64 0x79 0x2f 0x31 ("spdy/1")
   Reference:
      http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft1

   Protocol:  SPDY/2
   Identification Sequence:
      0x73 0x70 0x64 0x79 0x2f 0x32 ("spdy/2")
   Reference:
      http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft2

   Protocol:  SPDY/3
   Identification Sequence:
      0x73 0x70 0x64 0x79 0x2f 0x33 ("spdy/3")
   Reference:
      http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3

7. Acknowledgements πŸ’œ

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 🌈.


8. References πŸ“š

8.1. Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [RFC3629]  Yergeau, F., "UTF-8, a transformation format of ISO
              10646", STD 63, RFC 3629, November 2003.

   [RFC5226]  Narten, T. and H. Alvestrand, "Guidelines for Writing an
              IANA Considerations Section in RFCs", BCP 26, RFC 5226,
              May 2008.

   [RFC5246]  Dierks, T. and E. Rescorla, "The Transport Layer Security
              (TLS) Protocol Version 1.2", RFC 5246, August 2008.

   [RFC7230]  Fielding, R. and J. Reschke, "Hypertext Transfer Protocol
              (HTTP/1.1): Message Syntax and Routing", RFC 7230, June
              2014.

8.2. Informative References

   [HTTP2]    Belshe, M., Peon, R., and M. Thomson, "Hypertext Transfer
              Protocol version 2", Work in Progress, June 2014.

   [RFC5077]  Salowey, J., Zhou, H., Eronen, P., and H. Tschofenig,
              "Transport Layer Security (TLS) Session Resumption without
              Server-Side State", RFC 5077, January 2008.

Authors' Addresses πŸ¦‹

   Stephan Friedl
   Cisco Systems, Inc.
   170 West Tasman Drive
   San Jose, CA  95134
   USA

   Phone: (720)562-6785
   EMail: sfriedl@cisco.com


   Andrei Popov
   Microsoft Corp.
   One Microsoft Way
   Redmond, WA  98052
   USA

   EMail: andreipo@microsoft.com


   Adam Langley
   Google Inc.
   USA

   EMail: agl@google.com


   Emile Stephan
   Orange
   2 avenue Pierre Marzin
   Lannion  F-22307
   France

   EMail: emile.stephan@orange.com

that's the whole spec, bestie πŸŒˆπŸ’…βœ¨

πŸ“¦ where this page comes from