Movatterモバイル変換


[0]ホーム

URL:



Internet-DraftTLSOctober 2021
RescorlaExpires 28 April 2022[Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-ietf-tls-rfc8446bis-03
Obsoletes:
5077,5246,6961,8446 (if approved)
Updates:
4492,5705,6066,7627 (if approved)
Published:
Intended Status:
Standards Track
Expires:
Author:
E. Rescorla
Mozilla

The Transport Layer Security (TLS) Protocol Version 1.3

Abstract

This document specifies version 1.3 of the Transport Layer Security(TLS) protocol. TLS allows client/server applications to communicateover the Internet in a way that is designed to prevent eavesdropping,tampering, and message forgery.

This document updates RFCs 5705 and 6066 and obsoletesRFCs 5077, 5246, and 6961. This document also specifies newrequirements for TLS 1.2 implementations.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is athttps://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 28 April 2022.

Copyright Notice

Copyright (c) 2021 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 (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English.

Table of Contents

1.Introduction

RFC EDITOR: PLEASE REMOVE THE FOLLOWING PARAGRAPHThe source for this draft is maintained in GitHub. Suggested changesshould be submitted as pull requests athttps://github.com/ekr/tls13-spec. Instructions are on that page aswell.

The primary goal of TLS is to provide a secure channel between twocommunicating peers; the only requirement from the underlyingtransport is a reliable, in-order, data stream. Specifically, thesecure channel should provide the following properties:

  • Authentication: The server side of the channel is alwaysauthenticated; the client side is optionallyauthenticated. Authentication can happen via asymmetric cryptography(e.g., RSA[RSA], the Elliptic Curve Digital SignatureAlgorithm (ECDSA)[ECDSA], or the Edwards-Curve Digital SignatureAlgorithm (EdDSA)[RFC8032]) or a symmetric pre-shared key(PSK).
  • Confidentiality: Data sent over the channel after establishmentis only visible to theendpoints. TLS does not hide the length of the data it transmits,though endpoints are able to pad TLS records in order to obscure lengthsand improve protection against traffic analysis techniques.
  • Integrity: Data sent over the channel after establishment cannot bemodified by attackers without detection.

These properties should be true even in the face of an attacker who has completecontrol of the network, as described in[RFC3552].SeeAppendix F for a more complete statement of the relevant securityproperties.

TLS consists of two primary components:

  • A handshake protocol (Section 4) that authenticates the communicating parties,negotiates cryptographic modes and parameters, and establishesshared keying material. The handshake protocol is designed toresist tampering; an active attacker should not be able to forcethe peers to negotiate different parameters than they wouldif the connection were not under attack.
  • A record protocol (Section 5) that uses the parameters established by thehandshake protocol to protect traffic between the communicatingpeers. The record protocol divides traffic up into a series ofrecords, each of which is independently protected using thetraffic keys.

TLS is application protocol independent; higher-level protocols canlayer on top of TLS transparently. The TLS standard, however, does notspecify how protocols add security with TLS; how toinitiate TLS handshaking and how to interpret the authenticationcertificates exchanged are left to the judgment of the designers andimplementors of protocols that run on top of TLS.

This document defines TLS version 1.3. While TLS 1.3 is not directlycompatible with previous versions, all versions of TLS incorporate aversioning mechanism which allows clients and servers to interoperablynegotiate a common version if one is supported by both peers.

This document supersedes and obsoletes previous versions of TLS,including version 1.2[RFC5246]. It also obsoletes the TLS ticketmechanism defined in[RFC5077] and replaces it with the mechanismdefined inSection 2.2. Because TLS 1.3 changes the way keys are derived, itupdates[RFC5705] as described inSection 7.5. It also changeshow Online Certificate Status Protocol (OCSP) messages are carried and therefore updates[RFC6066]and obsoletes[RFC6961] as described inSection 4.4.2.1.

1.1.Conventions and Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD","SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in thisdocument are to be interpreted as described in BCP 14[RFC2119][RFC8174]when, and only when, they appear in all capitals, as shown here.

The following terms are used:

client: The endpoint initiating the TLS connection.

connection: A transport-layer connection between two endpoints.

endpoint: Either the client or server of the connection.

handshake: An initial negotiation between client and server that establishes the parameters of their subsequent interactions within TLS.

peer: An endpoint. When discussing a particular endpoint, "peer" refers to the endpoint that is not the primary subject of discussion.

receiver: An endpoint that is receiving records.

sender: An endpoint that is transmitting records.

server: The endpoint that did not initiate the TLS connection.

1.2.Relationship to RFC 8446

TLS 1.3 was originally specified in[RFC8446]. This document issolely an editorial update. It contains updated text in areas whichwere found to be unclear as well as other editorial improvements.In addition, it removes the use of the term "master" as appliedto secrets in favor of the term "main" or shorter names where noterm was neccessary.

1.3.Major Differences from TLS 1.2

The following is a list of the major functional differences betweenTLS 1.2 and TLS 1.3. It is not intended to be exhaustive, and thereare many minor differences.

  • The list of supported symmetric encryption algorithms has been pruned of all algorithms thatare considered legacy. Those that remain are all Authenticated Encryptionwith Associated Data (AEAD) algorithms. The cipher suite concept has beenchanged to separate the authentication and key exchange mechanisms fromthe record protection algorithm (including secret key length) and a hashto be used with both the key derivation function and handshake messageauthentication code (MAC).
  • A zero round-trip time (0-RTT) mode was added, saving a round trip at connection setup forsome application data, at the cost of certain security properties.
  • Static RSA and Diffie-Hellman cipher suites have been removed;all public-key based key exchange mechanisms now provide forward secrecy.
  • All handshake messages after the ServerHello are now encrypted. Thenewly introduced EncryptedExtensions message allows various extensionspreviously sent in the clear in the ServerHello to also enjoyconfidentiality protection.
  • The key derivation function has been redesigned. The new design allowseasier analysis by cryptographers due to their improved key separationproperties. The HMAC-based Extract-and-Expand Key Derivation Function (HKDF)is used as an underlying primitive.
  • The handshake state machine has been significantly restructured tobe more consistent and to remove superfluous messages such asChangeCipherSpec (except when needed for middlebox compatibility).
  • Elliptic curve algorithms are now in the base spec, and new signaturealgorithms, such as EdDSA, are included. TLS 1.3 removed point formatnegotiation in favor of a single point format for each curve.
  • Other cryptographic improvements were made, including changing the RSA padding to use the RSA Probabilistic Signature Scheme (RSASSA-PSS), and the removalof compression, the Digital Signature Algorithm (DSA), and custom Ephemeral Diffie-Hellman (DHE) groups.
  • The TLS 1.2 version negotiation mechanism has been deprecated in favorof a version list in an extension. This increases compatibility withexisting servers that incorrectly implemented version negotiation.
  • Session resumption with and without server-side state as well as thePSK-based cipher suites of earlier TLS versions have been replaced by asingle new PSK exchange.
  • References have been updated to point to the updated versions of RFCs, asappropriate (e.g., RFC 5280 rather than RFC 3280).

1.4.Updates Affecting TLS 1.2

This document defines several changes that optionally affectimplementations of TLS 1.2, including those which do not alsosupport TLS 1.3:

  • A version downgrade protection mechanism is described inSection 4.1.3.
  • RSASSA-PSS signature schemes are defined inSection 4.2.3.
  • The "supported_versions" ClientHello extension can be used to negotiatethe version of TLS to use, in preference to the legacy_version field ofthe ClientHello.
  • The "signature_algorithms_cert" extension allows a client to indicatewhich signature algorithms it can validate in X.509 certificates.
  • The term "master" as applied to secrets has been removed, and the"extended_master_secret" extension[RFC7627] has been renamed to"extended_main_secret".

Additionally, this document clarifies some compliance requirements for earlierversions of TLS; seeSection 9.3.

2.Protocol Overview

The cryptographic parameters used by the secure channel are produced by theTLS handshake protocol. This sub-protocol of TLS is used by the clientand server when first communicating with each other.The handshake protocol allows peers to negotiate a protocol version,select cryptographic algorithms, authenticate each other (withclient authentication being optional), and establish shared secret keying material.Once the handshake is complete, the peers use the established keysto protect the application-layer traffic.

A failure of the handshake or other protocol error triggers thetermination of the connection, optionally preceded by an alert message(Section 6).

TLS supports three basic key exchange modes:

  • (EC)DHE (Diffie-Hellman over either finite fields or elliptic curves)
  • PSK-only
  • PSK with (EC)DHE

Figure 1 below shows the basic full TLS handshake:

       Client                                              ServerKey  ^ ClientHelloExch | + key_share*     | + signature_algorithms*     | + psk_key_exchange_modes*     v + pre_shared_key*         -------->                                                       ServerHello  ^ Key                                                      + key_share*  | Exch                                                 + pre_shared_key*  v                                             {EncryptedExtensions}  ^  Server                                             {CertificateRequest*}  v  Params                                                    {Certificate*}  ^                                              {CertificateVerify*}  | Auth                                                        {Finished}  v                                 <--------     [Application Data*]     ^ {Certificate*}Auth | {CertificateVerify*}     v {Finished}                -------->       [Application Data]        <------->      [Application Data]              +  Indicates noteworthy extensions sent in the                 previously noted message.              *  Indicates optional or situation-dependent                 messages/extensions that are not always sent.              {} Indicates messages protected using keys                 derived from a [sender]_handshake_traffic_secret.              [] Indicates messages protected using keys                 derived from [sender]_application_traffic_secret_N.
Figure 1:Message Flow for Full TLS Handshake

The handshake can be thought of as having three phases (indicatedin the diagram above):

  • Key Exchange: Establish shared keying material and select the cryptographic parameters. Everything after this phase is encrypted.
  • Server Parameters: Establish other handshake parameters (whether the client is authenticated, application-layer protocol support, etc.).
  • Authentication: Authenticate the server (and, optionally, the client) and provide key confirmation and handshake integrity.

In the Key Exchange phase, the client sends the ClientHello(Section 4.1.2) message, which contains a random nonce(ClientHello.random); its offered protocol versions; a list ofsymmetric cipher/HKDF hash pairs; either a list of Diffie-Hellman key shares (in the"key_share" (Section 4.2.8) extension), a list of pre-shared key labels (in the"pre_shared_key" (Section 4.2.11) extension), or both; andpotentially additional extensions. Additional fields and/or messagesmay also be present for middlebox compatibility.

The server processes the ClientHello and determines the appropriatecryptographic parameters for the connection. It then responds with itsown ServerHello (Section 4.1.3), which indicates the negotiated connectionparameters. The combination of the ClientHelloand the ServerHello determines the shared keys. If (EC)DHEkey establishment is in use, then the ServerHellocontains a "key_share" extension with the server's ephemeralDiffie-Hellman share; the server's share MUST be in the same group as one of theclient's shares. If PSK key establishment isin use, then the ServerHello contains a "pre_shared_key"extension indicating which of the client's offered PSKs was selected.Note that implementations can use (EC)DHE and PSK together, in whichcase both extensions will be supplied.

The server then sends two messages to establish the Server Parameters:

EncryptedExtensions:

responses to ClientHello extensions that are not required todetermine the cryptographic parameters, other than thosethat are specific to individual certificates. [Section 4.3.1]

CertificateRequest:

if certificate-based client authentication is desired, thedesired parameters for that certificate. This message isomitted if client authentication is not desired. [Section 4.3.2]

Finally, the client and server exchange Authentication messages. TLSuses the same set of messages every time that certificate-basedauthentication is needed. (PSK-based authentication happens as a sideeffect of key exchange.)Specifically:

Certificate:

The certificate of the endpoint and any per-certificate extensions.This message is omitted by the server if not authenticating with acertificate and by the client if the server did not sendCertificateRequest (thus indicating that the client should notauthenticate with a certificate). Note that if rawpublic keys[RFC7250] or the cached information extension[RFC7924] are in use, then this message will notcontain a certificate but rather some other value corresponding tothe server's long-term key. [Section 4.4.2]

CertificateVerify:

A signature over the entire handshake using the private keycorresponding to the public key in the Certificate message. Thismessage is omitted if the endpoint is not authenticating via acertificate. [Section 4.4.3]

Finished:

A MAC (Message Authentication Code) over the entire handshake.This message provides key confirmation, binds the endpoint's identityto the exchanged keys, and in PSK modealso authenticates the handshake. [Section 4.4.4]

Upon receiving the server's messages, the client responds with its Authenticationmessages, namely Certificate and CertificateVerify (if requested), and Finished.

At this point, the handshake is complete, and the client and serverderive the keying material required by the record layer to exchangeapplication-layer data protected through authenticated encryption.Application Data MUST NOT be sent prior to sending the Finished message,except as specifiedinSection 2.3.Note that while the server may send Application Data prior to receivingthe client's Authentication messages, any data sent at that point is,of course, being sent to an unauthenticated peer.

2.1.Incorrect DHE Share

If the client has not provided a sufficient "key_share" extension (e.g., itincludes only DHE or ECDHE groups unacceptable to or unsupported by theserver), the server corrects the mismatch with a HelloRetryRequest andthe client needs to restart the handshake with an appropriate"key_share" extension, as shown in Figure 2.If no common cryptographic parameters can be negotiated,the server MUST abort the handshake with an appropriate alert.

         Client                                               Server         ClientHello         + key_share             -------->                                                   HelloRetryRequest                                 <--------               + key_share         ClientHello         + key_share             -------->                                                         ServerHello                                                         + key_share                                               {EncryptedExtensions}                                               {CertificateRequest*}                                                      {Certificate*}                                                {CertificateVerify*}                                                          {Finished}                                 <--------       [Application Data*]         {Certificate*}         {CertificateVerify*}         {Finished}              -------->         [Application Data]      <------->        [Application Data]
Figure 2:Message Flow for a Full Handshake with Mismatched Parameters

Note: The handshake transcript incorporates the initialClientHello/HelloRetryRequest exchange; it is not reset with the newClientHello.

TLS also allows several optimized variants of the basic handshake, asdescribed in the following sections.

2.2.Resumption and Pre-Shared Key (PSK)

Although TLS PSKs can be established externally,PSKs can also be established in a previous connection andthen used to establish a new connection ("session resumption" or "resuming" with a PSK).Once a handshake has completed, the server cansend the client a PSK identity that corresponds to a unique key derived fromthe initial handshake (seeSection 4.6.1). The clientcan then use that PSK identity in future handshakes to negotiate the useof the associated PSK. If the server accepts the PSK, then the security context of thenew connection is cryptographically tied to the original connection and the key derivedfrom the initial handshake is used to bootstrap the cryptographic stateinstead of a full handshake.In TLS 1.2 and below, this functionality was provided by "session IDs" and"session tickets"[RFC5077]. Both mechanisms are obsoleted in TLS 1.3.

PSKs can be used with (EC)DHE key exchange in order to provide forwardsecrecy in combination with shared keys, or can be used alone, at thecost of losing forward secrecy for the application data.

Figure 3 shows a pair of handshakes in which the first handshake establishesa PSK and the second handshake uses it:

       Client                                               ServerInitial Handshake:       ClientHello       + key_share               -------->                                                       ServerHello                                                       + key_share                                             {EncryptedExtensions}                                             {CertificateRequest*}                                                    {Certificate*}                                              {CertificateVerify*}                                                        {Finished}                                 <--------     [Application Data*]       {Certificate*}       {CertificateVerify*}       {Finished}                -------->                                 <--------      [NewSessionTicket]       [Application Data]        <------->      [Application Data]Subsequent Handshake:       ClientHello       + key_share*       + pre_shared_key          -------->                                                       ServerHello                                                  + pre_shared_key                                                      + key_share*                                             {EncryptedExtensions}                                                        {Finished}                                 <--------     [Application Data*]       {Finished}                -------->       [Application Data]        <------->      [Application Data]
Figure 3:Message Flow for Resumption and PSK

As the server is authenticating via a PSK, it does not send aCertificate or a CertificateVerify message. When a client offers resumptionvia a PSK, it SHOULD also supply a "key_share" extension to the server toallow the server to decline resumption and fall backto a full handshake, if needed. The server responds with a "pre_shared_key"extension to negotiate the use of PSK key establishment and can (as shown here)respond with a "key_share" extension to do (EC)DHE key establishment, thusproviding forward secrecy.

When PSKs are provisioned externally, the PSK identity and the KDF hashalgorithm tobe used with the PSK MUST also be provisioned.

Note:

When using an externally provisioned pre-shared secret, a criticalconsideration is using sufficient entropy during the key generation, asdiscussed in[RFC4086]. Deriving a shared secret from a password or otherlow-entropy sources is not secure. A low-entropy secret, or password, issubject to dictionary attacks based on the PSK binder. The specified PSKauthentication is not a strong password-based authenticated key exchange evenwhen used with Diffie-Hellman key establishment. Specifically, it does notprevent an attacker that can observe the handshake from performinga brute-force attack on the password/pre-shared key.

2.3.0-RTT Data

When clients and servers share a PSK (either obtained externally orvia a previous handshake), TLS 1.3 allows clients to send data on thefirst flight ("early data"). The client uses the PSK to authenticatethe server and to encrypt the early data.

As shown inFigure 4, the 0-RTT data is just added to the 1-RTThandshake in the first flight. The rest of the handshake uses the same messagesas for a 1-RTT handshake with PSK resumption.

         Client                                               Server         ClientHello         + early_data         + key_share*         + psk_key_exchange_modes         + pre_shared_key         (Application Data*)     -------->                                                         ServerHello                                                    + pre_shared_key                                                        + key_share*                                               {EncryptedExtensions}                                                       + early_data*                                                          {Finished}                                 <--------       [Application Data*]         (EndOfEarlyData)         {Finished}              -------->         [Application Data]      <------->        [Application Data]               +  Indicates noteworthy extensions sent in the                  previously noted message.               *  Indicates optional or situation-dependent                  messages/extensions that are not always sent.               () Indicates messages protected using keys                  derived from a client_early_traffic_secret.               {} Indicates messages protected using keys                  derived from a [sender]_handshake_traffic_secret.               [] Indicates messages protected using keys                  derived from [sender]_application_traffic_secret_N.
Figure 4:Message Flow for a 0-RTT Handshake

IMPORTANT NOTE: The security properties for 0-RTT data are weaker thanthose for other kinds of TLS data. Specifically:

  1. The protocol does not provide any forward secrecy guarantees for this data.The server's behavior determines what forward secrecy guarantees, if any, apply(seeSection 8.1). This behavior is not communicated to the clientas part of the protocol. Therefore, absent out-of-band knowledge of theserver's behavior, the client should assume that this data is not forwardsecret.
  2. There are no guarantees of non-replay between connections.Protection against replay for ordinary TLS 1.3 1-RTT data isprovided via the server's Random value, but 0-RTT data does not dependon the ServerHello and therefore has weaker guarantees. This is especiallyrelevant if the data is authenticated either with TLS clientauthentication or inside the application protocol. The same warningsapply to any use of the early_exporter_secret.

0-RTT data cannot be duplicated within a connection (i.e., the server willnot process the same data twice for the same connection), and anattacker will not be able to make 0-RTT data appear to be 1-RTT data(because it is protected with different keys).Appendix F.5contains a description of potential attacks, andSection 8describes mechanisms which the server can use to limit the impact ofreplay.

3.Presentation Language

This document deals with the formatting of data in an external representation.The following very basic and somewhat casually defined presentation syntax willbe used.

3.1.Basic Block Size

The representation of all data items is explicitly specified. The basic datablock size is one byte (i.e., 8 bits). Multiple-byte data items areconcatenations of bytes, from left to right, from top to bottom. From the bytestream, a multi-byte item (a numeric in the following example) is formed (using Cnotation) by:

   value = (byte[0] << 8*(n-1)) | (byte[1] << 8*(n-2)) |           ... | byte[n-1];

This byte ordering for multi-byte values is the commonplace network byte orderor big-endian format.

3.2.Miscellaneous

Comments begin with "/*" and end with "*/".

Optional components are denoted by enclosing them in "[[ ]]" (doublebrackets).

Single-byte entities containing uninterpreted data are of typeopaque.

A type alias T' for an existing type T is defined by:

   T T';

3.3.Numbers

The basic numeric data type is an unsigned byte (uint8). All larger numericdata types are constructed from a fixed-length series of bytes concatenated asdescribed inSection 3.1 and are also unsigned. The following numerictypes are predefined.

   uint8 uint16[2];   uint8 uint24[3];   uint8 uint32[4];   uint8 uint64[8];

All values, here and elsewhere in the specification, are transmitted in network byte(big-endian) order; the uint32 represented by the hex bytes 01 02 03 04 isequivalent to the decimal value 16909060.

3.4.Vectors

A vector (single-dimensioned array) is a stream of homogeneous data elements.For presentation purposes, this specification refers to vectors as lists.The size of the vector may be specified at documentation time or leftunspecified until runtime. In either case, the length declares the number ofbytes, not the number of elements, in the vector. The syntax for specifying anew type, T', that is a fixed-length vector of type T is

   T T'[n];

Here, T' occupies n bytes in the data stream, where n is a multiple of the sizeof T. The length of the vector is not included in the encoded stream.

In the following example, Datum is defined to be three consecutive bytes thatthe protocol does not interpret, while Data is three consecutive Datum,consuming a total of nine bytes.

   opaque Datum[3];      /* three uninterpreted bytes */   Datum Data[9];        /* three consecutive 3-byte vectors */

Variable-length vectors are defined by specifying a subrange of legal lengths,inclusively, using the notation <floor..ceiling>. When these are encoded, theactual length precedes the vector's contents in the byte stream. The lengthwill be in the form of a number consuming as many bytes as required to hold thevector's specified maximum (ceiling) length. A variable-length vector with anactual length field of zero is referred to as an empty vector.

   T T'<floor..ceiling>;

In the following example, "mandatory" is a vector that must contain between 300and 400 bytes of type opaque. It can never be empty. The actual length fieldconsumes two bytes, a uint16, which is sufficient to represent the value 400(seeSection 3.3). Similarly, "longer" can represent up to 800 bytes ofdata, or 400 uint16 elements, and it may be empty. Its encoding will include atwo-byte actual length field prepended to the vector. The length of an encodedvector must be an exact multiple of the length of a single element (e.g.,a 17-byte vector of uint16 would be illegal).

   opaque mandatory<300..400>;         /* length field is two bytes, cannot be empty */   uint16 longer<0..800>;         /* zero to 400 16-bit unsigned integers */

3.5.Enumerateds

An additional sparse data type, called "enum" or"enumerated", is available. Each definition is a different type. Only enumerateds ofthe same type may be assigned or compared. Every element of anenumerated must be assigned a value, as demonstrated in the followingexample. Since the elements of the enumerated are not ordered, theycan be assigned any unique value, in any order.

   enum { e1(v1), e2(v2), ... , en(vn) [[, (n)]] } Te;

Future extensions or additions to the protocol may define new values.Implementations need to be able to parse and ignore unknown values unless thedefinition of the field states otherwise.

An enumerated occupies as much space in the byte stream as would its maximaldefined ordinal value. The following definition would cause one byte to be usedto carry fields of type Color.

   enum { red(3), blue(5), white(7) } Color;

One may optionally specify a value without its associated tag to force thewidth definition without defining a superfluous element.

In the following example, Taste will consume two bytes in the data stream butcan only assume the values 1, 2, or 4 in the current version of the protocol.

   enum { sweet(1), sour(2), bitter(4), (32000) } Taste;

The names of the elements of an enumeration are scoped within the defined type.In the first example, a fully qualified reference to the second element of theenumeration would be Color.blue. Such qualification is not required if thetarget of the assignment is well specified.

   Color color = Color.blue;     /* overspecified, legal */   Color color = blue;           /* correct, type implicit */

The names assigned to enumerateds do not need to be unique. The numerical valuecan describe a range over which the same name applies. The value includes theminimum and maximum inclusive values in that range, separated by two periodcharacters. This is principally useful for reserving regions of the space.

   enum { sad(0), meh(1..254), happy(255) } Mood;

3.6.Constructed Types

Structure types may be constructed from primitive types for convenience. Eachspecification declares a new, unique type. The syntax used for definitions is muchlike that of C.

   struct {       T1 f1;       T2 f2;       ...       Tn fn;   } T;

Fixed- and variable-length list (vector) fields are allowed using the standard listsyntax. Structures V1 and V2 in the variants example (Section 3.8) demonstrate this.

The fields within a structure may be qualified using the type's name, with asyntax much like that available for enumerateds. For example, T.f2 refers tothe second field of the previous declaration.

3.7.Constants

Fields and variables may be assigned a fixed value using "=", as in:

   struct {       T1 f1 = 8;  /* T.f1 must always be 8 */       T2 f2;   } T;

3.8.Variants

Defined structures may have variants based on some knowledge that isavailable within the environment. The selector must be an enumeratedtype that defines the possible variants the structure defines. Eacharm of the select (below) specifies the type of that variant's field and anoptional field label. The mechanism by which the variant is selectedat runtime is not prescribed by the presentation language.

   struct {       T1 f1;       T2 f2;       ....       Tn fn;       select (E) {           case e1: Te1 [[fe1]];           case e2: Te2 [[fe2]];           ....           case en: Ten [[fen]];       };   } Tv;

For example:

   enum { apple(0), orange(1) } VariantTag;   struct {       uint16 number;       opaque string<0..10>; /* variable length */   } V1;   struct {       uint32 number;       opaque string[10];    /* fixed length */   } V2;   struct {       VariantTag type;       select (VariantRecord.type) {           case apple:  V1;           case orange: V2;       };   } VariantRecord;

4.Handshake Protocol

The handshake protocol is used to negotiate the security parametersof a connection. Handshake messages are supplied to the TLS record layer, wherethey are encapsulated within one or more TLSPlaintext or TLSCiphertext structures which areprocessed and transmitted as specified by the current active connection state.

   enum {       client_hello(1),       server_hello(2),       new_session_ticket(4),       end_of_early_data(5),       encrypted_extensions(8),       certificate(11),       certificate_request(13),       certificate_verify(15),       finished(20),       key_update(24),       message_hash(254),       (255)   } HandshakeType;   struct {       HandshakeType msg_type;    /* handshake type */       uint24 length;             /* remaining bytes in message */       select (Handshake.msg_type) {           case client_hello:          ClientHello;           case server_hello:          ServerHello;           case end_of_early_data:     EndOfEarlyData;           case encrypted_extensions:  EncryptedExtensions;           case certificate_request:   CertificateRequest;           case certificate:           Certificate;           case certificate_verify:    CertificateVerify;           case finished:              Finished;           case new_session_ticket:    NewSessionTicket;           case key_update:            KeyUpdate;       };   } Handshake;

Protocol messages MUST be sent in the order defined inSection 4.4.1 and shown in the diagrams inSection 2.A peer which receives a handshake message in an unexpected orderMUST abort the handshake with an "unexpected_message" alert.

New handshake message types are assigned by IANA as described inSection 11.

4.1.Key Exchange Messages

The key exchange messages are used to determine the security capabilitiesof the client and the server and to establish shared secrets, includingthe traffic keys used to protect the rest of the handshake and the data.

4.1.1.Cryptographic Negotiation

In TLS, the cryptographic negotiation proceeds by the client offering thefollowing four sets of options in its ClientHello:

  • A list of cipher suites which indicates the AEAD algorithm/HKDF hashpairs which the client supports.
  • A "supported_groups" (Section 4.2.7) extension which indicates the (EC)DHE groupswhich the client supports and a "key_share" (Section 4.2.8) extension which contains(EC)DHE shares for some or all of these groups.
  • A "signature_algorithms" (Section 4.2.3) extension which indicates the signaturealgorithms which the client can accept. A "signature_algorithms_cert" extension (Section 4.2.3) may also beadded to indicate certificate-specific signature algorithms.
  • A "pre_shared_key" (Section 4.2.11) extension whichcontains a list of symmetric key identities known to the client and a"psk_key_exchange_modes" (Section 4.2.9)extension which indicates the key exchange modes that may be usedwith PSKs.

If the server does not select a PSK, then the first three of theseoptions are entirely orthogonal: the server independently selects acipher suite, an (EC)DHE group and key share for key establishment,and a signature algorithm/certificate pair to authenticate itself tothe client. If there is no overlap between the received "supported_groups"and the groups supported by the server, then the server MUST abort thehandshake with a "handshake_failure" or an "insufficient_security" alert.

If the server selects a PSK, then it MUST also select a keyestablishment mode from the list indicated by the client's"psk_key_exchange_modes" extension (at present, PSK alone or with (EC)DHE). Notethat if the PSK can be used without (EC)DHE, then non-overlap in the"supported_groups" parameters need not be fatal, as it is in thenon-PSK case discussed in the previous paragraph.

If the server selects an (EC)DHE group and the client did not offer acompatible "key_share" extension in the initial ClientHello, the server MUSTrespond with a HelloRetryRequest (Section 4.1.4) message.

If the server successfully selects parameters and does not require aHelloRetryRequest, it indicates the selected parameters in the ServerHello asfollows:

  • If PSK is being used, then the server will send a"pre_shared_key" extension indicating the selected key.
  • When (EC)DHE is in use, the server will also provide a "key_share"extension. If PSK is not being used, then (EC)DHE and certificate-basedauthentication are always used.
  • When authenticating via a certificate, the server will sendthe Certificate (Section 4.4.2) and CertificateVerify(Section 4.4.3) messages. In TLS 1.3as defined by this document, either a PSK or a certificateis always used, but not both. Future documents may define howto use them together.

If the server is unable to negotiate a supported set of parameters(i.e., there is no overlap between the client and server parameters),it MUST abort the handshake with eithera "handshake_failure" or "insufficient_security" fatal alert(seeSection 6).

4.1.2.Client Hello

When a client first connects to a server, it is REQUIRED to send theClientHello as its first TLS message. The client will also send aClientHello when the server has responded to its ClientHello with aHelloRetryRequest. In that case, the client MUST send the sameClientHello without modification, except as follows:

  • If a "key_share" extension was supplied in the HelloRetryRequest,replacing the list of shares with a list containing a singleKeyShareEntry from the indicated group.
  • Removing the "early_data" extension (Section 4.2.10) if one waspresent. Early data is not permitted after a HelloRetryRequest.
  • Including a "cookie" extension if one was provided in theHelloRetryRequest.
  • Updating the "pre_shared_key" extension if present byrecomputing the "obfuscated_ticket_age" and binder valuesand (optionally) removingany PSKs which are incompatible with the server's indicatedcipher suite.
  • Optionally adding, removing, or changing the length of the "padding"extension[RFC7685].
  • Other modifications that may be allowed by an extension defined in thefuture and present in the HelloRetryRequest.

Because TLS 1.3 forbids renegotiation, if a server has negotiated TLS1.3 and receives a ClientHello at any other time, it MUST terminatethe connection with an "unexpected_message" alert.

If a server established a TLS connection with a previous version of TLSand receives a TLS 1.3 ClientHello in a renegotiation, it MUST retain theprevious protocol version. In particular, it MUST NOT negotiate TLS 1.3.

Structure of this message:

   uint16 ProtocolVersion;   opaque Random[32];   uint8 CipherSuite[2];    /* Cryptographic suite selector */   struct {       ProtocolVersion legacy_version = 0x0303;    /* TLS v1.2 */       Random random;       opaque legacy_session_id<0..32>;       CipherSuite cipher_suites<2..2^16-2>;       opaque legacy_compression_methods<1..2^8-1>;       Extension extensions<8..2^16-1>;   } ClientHello;
legacy_version:

In previous versions of TLS, this field was used for version negotiationand represented the highest version number supported by the client.Experience has shown that many servers do not properly implementversion negotiation, leading to "version intolerance" in whichthe server rejects an otherwise acceptable ClientHello with a versionnumber higher than it supports.In TLS 1.3, the client indicates its version preferences in the"supported_versions" extension (Section 4.2.1) and the legacy_version field MUSTbe set to 0x0303, which is the version number for TLS 1.2.TLS 1.3 ClientHellos are identified as havinga legacy_version of 0x0303 and a supported_versions extensionpresent with 0x0304 as the highest version indicated therein.(SeeAppendix E for details about backward compatibility.)A server which receives a legacy_version value not equal to 0x0303 MUST abortthe handshake with an "illegal_parameter" alert.

random:

32 bytes generated by a secure random number generator.SeeAppendix C for additional information.

legacy_session_id:

Versions of TLS before TLS 1.3 supported a "session resumption"feature which has been merged with pre-shared keys in this version(seeSection 2.2). A client which has a cached session IDset by a pre-TLS 1.3 server SHOULD set this field to that value. Incompatibility mode (seeAppendix E.4), this field MUST be non-empty,so a client not offering a pre-TLS 1.3 session MUST generate anew 32-byte value. This value need not be random but SHOULD beunpredictable to avoid implementations fixating on a specific value(also known as ossification).Otherwise, it MUST be set as a zero-length list (i.e., azero-valued single byte length field).

cipher_suites:

A list of the symmetric cipher options supported by theclient, specifically the record protection algorithm (includingsecret key length) and a hash to be used with HKDF, in descendingorder of client preference. Values are defined inAppendix B.4.If the list contains cipher suites thatthe server does not recognize, support, or wish to use, the serverMUST ignore those cipher suites and process the remaining ones asusual. If the client isattempting a PSK key establishment, it SHOULD advertise at least onecipher suite indicating a Hash associated with the PSK.

legacy_compression_methods:

Versions of TLS before 1.3 supported compression with the list ofsupported compression methods being sent in this field. For every TLS 1.3ClientHello, this list MUST contain exactly one byte, set tozero, which corresponds to the "null" compression method inprior versions of TLS. If a TLS 1.3 ClientHello isreceived with any other value in this field, the server MUSTabort the handshake with an "illegal_parameter" alert. Note that TLS 1.3servers might receive TLS 1.2 or prior ClientHellos which containother compression methods and (if negotiating such a prior version)MUST follow the procedures forthe appropriate prior version of TLS.

extensions:

Clients request extended functionality from servers by sendingdata in the extensions field. The actual "Extension" format isdefined inSection 4.2. In TLS 1.3, the useof certain extensions is mandatory, as functionality has moved intoextensions to preserve ClientHello compatibility with previous versions of TLS.Servers MUST ignore unrecognized extensions.

All versions of TLS allow an extensions field to optionally follow thecompression_methods field. TLS 1.3 ClientHellomessages always contain extensions (minimally "supported_versions", otherwise,they will be interpreted as TLS 1.2 ClientHello messages).However, TLS 1.3 servers might receive ClientHello messages without anextensions field from prior versions of TLS.The presence of extensions can be detected by determining whether thereare bytes following the compression_methods field at the end of theClientHello. Note that this method of detecting optional data differsfrom the normal TLS method of having a variable-length field, but itis used for compatibility with TLS before extensions were defined.TLS 1.3 servers will need to perform this check first and onlyattempt to negotiate TLS 1.3 if the "supported_versions" extensionis present.If negotiating a version of TLS prior to 1.3, a server MUST check thatthe message either contains no data after legacy_compression_methodsor that it contains a valid extensions block with no data following.If not, then it MUST abort the handshake with a "decode_error" alert.

In the event that a client requests additional functionality usingextensions and this functionality is not supplied by the server, theclient MAY abort the handshake.

After sending the ClientHello message, the client waits for a ServerHelloor HelloRetryRequest message. If early datais in use, the client may transmit early Application Data(Section 2.3) while waiting for the next handshake message.

4.1.3.Server Hello

The server will send this message in response to a ClientHello messageto proceed with the handshake if it is able to negotiate an acceptableset of handshake parameters based on the ClientHello.

Structure of this message:

   struct {       ProtocolVersion legacy_version = 0x0303;    /* TLS v1.2 */       Random random;       opaque legacy_session_id_echo<0..32>;       CipherSuite cipher_suite;       uint8 legacy_compression_method = 0;       Extension extensions<6..2^16-1>;   } ServerHello;
legacy_version:

In previous versions of TLS, this field was used for version negotiationand represented the selected version number for the connection. Unfortunately,some middleboxes fail when presented with new values.In TLS 1.3, the TLS server indicates its version using the"supported_versions" extension (Section 4.2.1),and the legacy_version field MUSTbe set to 0x0303, which is the version number for TLS 1.2.(SeeAppendix E for details about backward compatibility.)

random:

32 bytes generated by a secure random number generator.SeeAppendix C for additional information.The last 8 bytes MUST be overwritten as describedbelow if negotiating TLS 1.2 or TLS 1.1, but theremaining bytes MUST be random.This structure is generated by the server and MUST begenerated independently of the ClientHello.random.

legacy_session_id_echo:

The contents of the client's legacy_session_id field. Note thatthis field is echoed even if the client's value corresponded toa cached pre-TLS 1.3 session which the server has chosen notto resume. A client which receives a legacy_session_id_echo fieldthat does not match what it sent in the ClientHelloMUST abort the handshake with an "illegal_parameter"alert.

cipher_suite:

The single cipher suite selected by the server from the ClientHello.cipher_suiteslist. A client which receives a cipher suitethat was not offered MUST abort the handshake with an "illegal_parameter"alert.

legacy_compression_method:

A single byte which MUST have the value 0.

extensions:

A list of extensions. The ServerHello MUST only include extensionswhich are required to establish the cryptographic context and negotiatethe protocol version. All TLS 1.3 ServerHello messages MUST contain the"supported_versions" extension. Current ServerHello messages additionally containeither the "pre_shared_key" extension or the "key_share" extension, or both (when usinga PSK with (EC)DHE key establishment). Other extensions(seeSection 4.2) are sentseparately in the EncryptedExtensions message.

For reasons of backward compatibility with middleboxes(seeAppendix E.4), the HelloRetryRequestmessage uses the same structure as the ServerHello, but withRandom set to the special value of the SHA-256 of"HelloRetryRequest":

  CF 21 AD 74 E5 9A 61 11 BE 1D 8C 02 1E 65 B8 91  C2 A2 11 16 7A BB 8C 5E 07 9E 09 E2 C8 A8 33 9C

Upon receiving a message with type server_hello, implementationsMUST first examine the Random value and, if it matchesthis value, process it as described inSection 4.1.4).

TLS 1.3 has a downgrade protection mechanism embedded in the server'srandom value. TLS 1.3 servers which negotiate TLS 1.2 or below inresponse to a ClientHello MUST set the last 8 bytes of theirRandom value specially in their ServerHello.

If negotiating TLS 1.2, TLS 1.3 servers MUST set the last 8 bytes of theirRandom value to the bytes:

  44 4F 57 4E 47 52 44 01

If negotiating TLS 1.1 or below, TLS 1.3 servers MUST, and TLS 1.2servers SHOULD, set the last 8 bytes of their ServerHello.Random value to thebytes:

  44 4F 57 4E 47 52 44 00

TLS 1.3 clients receiving a ServerHello indicating TLS 1.2 or belowMUST check that the last 8 bytes are not equal to either of these values.TLS 1.2 clients SHOULD also check that the last 8 bytes are notequal to the second value if the ServerHello indicates TLS 1.1 orbelow. If a match is found, the client MUST abort the handshakewith an "illegal_parameter" alert. This mechanism provides limitedprotection against downgrade attacks over and above what is providedby the Finished exchange: because the ServerKeyExchange, a messagepresent in TLS 1.2 and below, includes a signature over both randomvalues, it is not possible for an active attacker to modify therandom values without detection as long as ephemeral ciphers are used.It does not provide downgrade protection when static RSA is used.

Note: This is a change from[RFC5246], so in practice many TLS 1.2 clientsand servers will not behave as specified above.

A legacy TLS client performing renegotiation with TLS 1.2 or priorand which receives a TLS 1.3 ServerHello during renegotiationMUST abort the handshake with a "protocol_version" alert.Note that renegotiation is not possible when TLS 1.3 has beennegotiated.

4.1.4.Hello Retry Request

The server will send this message in response to a ClientHello messageif it is able to find an acceptable set of parameters but theClientHello does not contain sufficient information to proceed withthe handshake. As discussed inSection 4.1.3, the HelloRetryRequesthas the same format as a ServerHello message, and thelegacy_version, legacy_session_id_echo, cipher_suite, and legacy_compression_method fields have the same meaning. However, for convenience wediscuss "HelloRetryRequest" throughout this document as if it werea distinct message.

The server's extensions MUST contain "supported_versions".Additionally, it SHOULD contain the minimal set of extensions necessary for theclient to generate a correct ClientHello pair. As with the ServerHello, aHelloRetryRequest MUST NOT contain any extensions that were not firstoffered by the client in its ClientHello, with the exception ofoptionally the "cookie" (seeSection 4.2.2) extension.

Upon receipt of a HelloRetryRequest, the client MUST checkthe legacy_version, legacy_session_id_echo, cipher_suite,and legacy_compression_method as specified inSection 4.1.3 and then process theextensions, starting with determining the version using"supported_versions". Clients MUST abort the handshake withan "illegal_parameter" alert if the HelloRetryRequest would not result inany change in the ClientHello. If a client receives a secondHelloRetryRequest in the same connection (i.e., wherethe ClientHello was itself in response to a HelloRetryRequest), itMUST abort the handshake with an "unexpected_message" alert.

Otherwise, the client MUST process all extensions in theHelloRetryRequest and send a second updated ClientHello. TheHelloRetryRequest extensions defined in this specification are:

A client which receives a cipher suite that was notoffered MUST abort the handshake. Servers MUST ensure that theynegotiate the same cipher suite when receiving a conformant updatedClientHello (if the server selects the cipher suite as the first stepin the negotiation, then this will happen automatically). Uponreceiving the ServerHello, clients MUST check that the cipher suitesupplied in the ServerHello is the same as that in theHelloRetryRequest and otherwise abort the handshake with an"illegal_parameter" alert.

In addition, in its updated ClientHello, the client SHOULD NOT offerany pre-shared keys associated with a hash other than that of theselected cipher suite. This allows the client to avoid having tocompute partial hash transcripts for multiple hashes in the secondClientHello.

The value of selected_version in the HelloRetryRequest "supported_versions"extension MUST be retained in the ServerHello, and a client MUST abort thehandshake with an "illegal_parameter" alert if the value changes.

4.2.Extensions

A number of TLS messages contain tag-length-value encoded extensions structures.

   struct {       ExtensionType extension_type;       opaque extension_data<0..2^16-1>;   } Extension;   enum {       server_name(0),                             /* RFC 6066 */       max_fragment_length(1),                     /* RFC 6066 */       status_request(5),                          /* RFC 6066 */       supported_groups(10),                       /* RFC 8422, 7919 */       signature_algorithms(13),                   /* RFC 8446 */       use_srtp(14),                               /* RFC 5764 */       heartbeat(15),                              /* RFC 6520 */       application_layer_protocol_negotiation(16), /* RFC 7301 */       signed_certificate_timestamp(18),           /* RFC 6962 */       client_certificate_type(19),                /* RFC 7250 */       server_certificate_type(20),                /* RFC 7250 */       padding(21),                                /* RFC 7685 */       pre_shared_key(41),                         /* RFC 8446 */       early_data(42),                             /* RFC 8446 */       supported_versions(43),                     /* RFC 8446 */       cookie(44),                                 /* RFC 8446 */       psk_key_exchange_modes(45),                 /* RFC 8446 */       certificate_authorities(47),                /* RFC 8446 */       oid_filters(48),                            /* RFC 8446 */       post_handshake_auth(49),                    /* RFC 8446 */       signature_algorithms_cert(50),              /* RFC 8446 */       key_share(51),                              /* RFC 8446 */       (65535)   } ExtensionType;

Here:

  • "extension_type" identifies the particular extension type.
  • "extension_data" contains information specific to the particularextension type.

The contents of the "extension_data" field are typically defined by anextension-specific structure defined in the TLS presentation language. Unlessotherwise specified, trailing data is forbidden. That is, senders MUST NOTinclude data after the structure in the "extension_data" field. Whenprocessing an extension, receivers MUST abort the handshake with a"decode_error" alert if there is data left over after parsing the structure.This does not apply if the receiver does not implement or is configured toignore an extension.

The list of extension types is maintained by IANA as described inSection 11.

Extensions are generally structured in a request/response fashion,though some extensions are just requests with no correspondingresponse (i.e., indications). The client sends its extension requestsin the ClientHello message, and the server sends its extensionresponses in the ServerHello, EncryptedExtensions, HelloRetryRequest,and Certificate messages. The server sends extension requests in theCertificateRequest message which a client MAY respond to with aCertificate message. The server MAY also send unsolicited extensionsin the NewSessionTicket, though the client does not respond directlyto these.

Implementations MUST NOT send extension responsesif the remote endpoint did not send the corresponding extension requests,with the exception of the "cookie" extension in the HelloRetryRequest.Upon receiving such an extension, an endpoint MUST abort the handshake with an"unsupported_extension" alert.

The table below indicates the messages where a given extension mayappear, using the following notation: CH (ClientHello), SH(ServerHello), EE (EncryptedExtensions), CT (Certificate), CR(CertificateRequest), NST (NewSessionTicket), and HRR(HelloRetryRequest). If an implementation receives an extension whichit recognizes and which is not specified for the message in which itappears, it MUST abort the handshake with an "illegal_parameter" alert.

Table 1:TLS Extensions
ExtensionTLS 1.3
server_name[RFC6066]CH, EE
max_fragment_length[RFC6066]CH, EE
status_request[RFC6066]CH, CR, CT
supported_groups[RFC7919]CH, EE
signature_algorithms (RFC8446)CH, CR
use_srtp[RFC5764]CH, EE
heartbeat[RFC6520]CH, EE
application_layer_protocol_negotiation[RFC7301]CH, EE
signed_certificate_timestamp[RFC6962]CH, CR, CT
client_certificate_type[RFC7250]CH, EE
server_certificate_type[RFC7250]CH, EE
padding[RFC7685]CH
cached_info[RFC7924]CH, EE
key_share (RFC 8446)CH, SH, HRR
pre_shared_key (RFC 8446)CH, SH
psk_key_exchange_modes (RFC 8446)CH
early_data (RFC 8446)CH, EE, NST
cookie (RFC 8446)CH, HRR
supported_versions (RFC 8446)CH, SH, HRR
certificate_authorities (RFC 8446)CH, CR
oid_filters (RFC 8446)CR
post_handshake_auth (RFC 8446)CH
signature_algorithms_cert (RFC 8446)CH, CR

When multiple extensions of different types are present, theextensions MAY appear in any order, with the exception of"pre_shared_key" (Section 4.2.11) which MUST bethe last extension in the ClientHello (but can appear anywhere inthe ServerHello extensions block).There MUST NOT be more than one extension of the same type in a givenextension block.

In TLS 1.3, unlike TLS 1.2, extensions are negotiated for eachhandshake even when in resumption-PSK mode. However, 0-RTT parameters arethose negotiated in the previous handshake; mismatches may requirerejecting 0-RTT (seeSection 4.2.10).

There are subtle (and not so subtle) interactions that may occur in thisprotocol between new features and existing features which may result in asignificant reduction in overall security. The following considerations shouldbe taken into account when designing new extensions:

  • Some cases where a server does not agree to an extension are errorconditions (e.g., the handshake cannot continue), and some aresimply refusals to support particular features. In general, erroralerts should be used for the former and a field in the serverextension response for the latter.
  • Extensions should, as far as possible, be designed to prevent any attack thatforces use (or non-use) of a particular feature by manipulation of handshakemessages. This principle should be followed regardless of whether the featureis believed to cause a security problem.Often the fact that the extension fields are included in the inputs to theFinished message hashes will be sufficient, but extreme care is needed whenthe extension changes the meaning of messages sent in the handshake phase.Designers and implementors should be aware of the fact that until thehandshake has been authenticated, active attackers can modify messages andinsert, remove, or replace extensions.

4.2.1.Supported Versions

   struct {       select (Handshake.msg_type) {           case client_hello:                ProtocolVersion versions<2..254>;           case server_hello: /* and HelloRetryRequest */                ProtocolVersion selected_version;       };   } SupportedVersions;

The "supported_versions" extension is used by the client to indicatewhich versions of TLS it supports and by the server to indicatewhich version it is using. The extension contains a list ofsupported versions in preference order, with the most preferredversion first. Implementations of this specification MUST send thisextension in the ClientHello containing all versions of TLS which they areprepared to negotiate (for this specification, that means minimally0x0304, but if previous versions of TLS are allowed to be negotiated,they MUST be present as well).

If this extension is not present, servers which are compliant withthis specification and which also support TLS 1.2MUST negotiate TLS 1.2 or prior as specified in[RFC5246], even if ClientHello.legacy_version is 0x0304 or later.Servers MAY abort the handshake upon receiving a ClientHello withlegacy_version 0x0304 or later.

If this extension is present in the ClientHello, servers MUST NOT use theClientHello.legacy_version value for version negotiation and MUST use only the"supported_versions" extension to determine clientpreferences. Servers MUST only select a version of TLS present in thatextension and MUST ignore any unknown versions that are present in thatextension. Note that thismechanism makes it possible to negotiate a version prior to TLS 1.2 ifone side supports a sparse range. Implementations of TLS 1.3 which chooseto support prior versions of TLS SHOULD support TLS 1.2.Servers MUST be prepared to receive ClientHellos that include thisextension but do not include 0x0304 in the list of versions.

A server which negotiates a version of TLS prior to TLS 1.3 MUSTset ServerHello.version and MUST NOT send the "supported_versions"extension. A server which negotiates TLS 1.3 MUST respond by sending a"supported_versions" extension containing the selected version value(0x0304). It MUST set the ServerHello.legacy_version field to 0x0303 (TLS1.2).

After checking ServerHello.random to determine if the server handshake messageis a ServerHello or HelloRetryRequest, clients MUST check for this extensionprior to processing the rest of the ServerHello. This will require clients toparse the ServerHello in order to read the extension.If this extension is present, clients MUST ignore theServerHello.legacy_version value and MUST use only the"supported_versions" extension to determine the selected version. If the"supported_versions" extension in the ServerHello contains a version not offered by theclient or contains a version prior to TLS 1.3, the client MUST abort the handshake with an"illegal_parameter" alert.

4.2.2.Cookie

   struct {       opaque cookie<1..2^16-1>;   } Cookie;

Cookies serve two primary purposes:

  • Allowing the server to force the client to demonstrate reachabilityat their apparent network address (thus providing a measure of DoSprotection). This is primarily useful for non-connection-orientedtransports (see[RFC6347] for an example of this).
  • Allowing the server to offload state to the client, thus allowing it to senda HelloRetryRequest without storing any state. The server can do this bystoring the hash of the ClientHello in the HelloRetryRequest cookie(protected with some suitable integrity protection algorithm).

When sending a HelloRetryRequest, the server MAY provide a "cookie" extension to theclient (this is an exception to the usual rule that the only extensions thatmay be sent are those that appear in the ClientHello). When sending thenew ClientHello, the client MUST copy the contents of the extension received inthe HelloRetryRequest into a "cookie" extension in the new ClientHello.Clients MUST NOT use cookies in their initial ClientHello in subsequent connections.

When a server is operating statelessly, it may receive an unprotected record oftype change_cipher_spec between the first and second ClientHello (seeSection 5). Since the server is not storing any state, this will appearas if it were the first message to be received. Servers operating statelesslyMUST ignore these records.

4.2.3.Signature Algorithms

TLS 1.3 provides two extensions for indicating which signaturealgorithms may be used in digital signatures. The"signature_algorithms_cert" extension applies to signatures incertificates, and the "signature_algorithms" extension, which originallyappeared in TLS 1.2, applies to signatures in CertificateVerifymessages. The keys found in certificates MUST also be ofappropriate type for the signature algorithms they are usedwith. This is a particular issue for RSA keys and PSS signatures,as described below. If no "signature_algorithms_cert" extension is present,then the "signature_algorithms" extension also applies to signaturesappearing in certificates. Clients which desire the server to authenticateitself via a certificate MUST send the "signature_algorithms" extension. If a serveris authenticating via a certificate and the client has not sent a"signature_algorithms" extension, then the server MUST abort thehandshake with a "missing_extension" alert (seeSection 9.2).

The "signature_algorithms_cert" extension was added to allow implementationswhich supported different sets of algorithms for certificates and in TLS itselfto clearly signal their capabilities. TLS 1.2 implementations SHOULD also processthis extension. Implementations which have the same policy in both casesMAY omit the "signature_algorithms_cert" extension.

The "extension_data" field of these extensions contains aSignatureSchemeList value:

   enum {       /* RSASSA-PKCS1-v1_5 algorithms */       rsa_pkcs1_sha256(0x0401),       rsa_pkcs1_sha384(0x0501),       rsa_pkcs1_sha512(0x0601),       /* ECDSA algorithms */       ecdsa_secp256r1_sha256(0x0403),       ecdsa_secp384r1_sha384(0x0503),       ecdsa_secp521r1_sha512(0x0603),       /* RSASSA-PSS algorithms with public key OID rsaEncryption */       rsa_pss_rsae_sha256(0x0804),       rsa_pss_rsae_sha384(0x0805),       rsa_pss_rsae_sha512(0x0806),       /* EdDSA algorithms */       ed25519(0x0807),       ed448(0x0808),       /* RSASSA-PSS algorithms with public key OID RSASSA-PSS */       rsa_pss_pss_sha256(0x0809),       rsa_pss_pss_sha384(0x080a),       rsa_pss_pss_sha512(0x080b),       /* Legacy algorithms */       rsa_pkcs1_sha1(0x0201),       ecdsa_sha1(0x0203),       /* Reserved Code Points */       private_use(0xFE00..0xFFFF),       (0xFFFF)   } SignatureScheme;   struct {       SignatureScheme supported_signature_algorithms<2..2^16-2>;   } SignatureSchemeList;

Note: This enum is named "SignatureScheme" because there is alreadya "SignatureAlgorithm" type in TLS 1.2, which this replaces.We use the term "signature algorithm" throughout the text.

Each SignatureScheme value lists a single signature algorithm that theclient is willing to verify. The values are indicated in descending orderof preference. Note that a signature algorithm takes as input anarbitrary-length message, rather than a digest. Algorithms whichtraditionally act on a digest should be defined in TLS to firsthash the input with a specified hash algorithm and then proceed as usual.The code point groups listed above have the following meanings:

RSASSA-PKCS1-v1_5 algorithms:

Indicates a signature algorithm using RSASSA-PKCS1-v1_5[RFC8017]with the corresponding hash algorithm as defined in[SHS]. These valuesrefer solely to signatures which appear in certificates (seeSection 4.4.2.2) and are not defined for use in signedTLS handshake messages, although they MAY appear in "signature_algorithms"and "signature_algorithms_cert" for backward compatibility with TLS 1.2.

ECDSA algorithms:

Indicates a signature algorithm using ECDSA[ECDSA], the correspondingcurve as defined in ANSI X9.62[ECDSA] and FIPS 186-4[DSS], and thecorresponding hash algorithm as defined in[SHS]. The signature isrepresented as a DER-encoded[X690] ECDSA-Sig-Value structure as defined in[RFC4492].

RSASSA-PSS RSAE algorithms:

Indicates a signature algorithm using RSASSA-PSS[RFC8017] with maskgeneration function 1. Thedigest used in the mask generation function and the digest being signed areboth the corresponding hash algorithm as defined in[SHS].The length of the Salt MUST be equal to the length of the output of thedigest algorithm. If the public key is carriedin an X.509 certificate, it MUST use the rsaEncryption OID[RFC5280].

EdDSA algorithms:

Indicates a signature algorithm using EdDSA as defined in[RFC8032] or its successors. Note that these correspond to the"PureEdDSA" algorithms and not the "prehash" variants.

RSASSA-PSS PSS algorithms:

Indicates a signature algorithm using RSASSA-PSS[RFC8017] with maskgeneration function 1. Thedigest used in the mask generation function and the digest being signed areboth the corresponding hash algorithm as defined in[SHS].The length of the Salt MUST be equal to the length of the digestalgorithm. If the public key is carried in an X.509 certificate,it MUST use the RSASSA-PSS OID[RFC5756]. When used in certificate signatures,the algorithm parameters MUST be DER encoded. If the correspondingpublic key's parameters are present, then the parameters in the signatureMUST be identical to those in the public key.

Legacy algorithms:

Indicates algorithms which are being deprecated because they usealgorithms with known weaknesses, specifically SHA-1 which is usedin this context with either (1) RSA using RSASSA-PKCS1-v1_5 or (2) ECDSA. These valuesrefer solely to signatures which appear in certificates (seeSection 4.4.2.2) and are not defined for use insigned TLS handshake messages, although they MAY appear in "signature_algorithms"and "signature_algorithms_cert" for backward compatibility with TLS 1.2.Endpoints SHOULD NOT negotiate these algorithmsbut are permitted to do so solely for backward compatibility. Clientsoffering these values MUST listthem as the lowest priority (listed after all other algorithms inSignatureSchemeList). TLS 1.3 servers MUST NOT offer a SHA-1 signedcertificate unless no valid certificate chain can be producedwithout it (seeSection 4.4.2.2).

The signatures on certificates that are self-signed or certificates that aretrust anchors are not validated, since they begin a certification path (see[RFC5280], Section 3.2). A certificate that begins a certificationpath MAY use a signature algorithm that is not advertised as being supportedin the "signature_algorithms" and "signature_algorithms_cert" extensions.

Note that TLS 1.2 defines this extension differently. TLS 1.3 implementationswilling to negotiate TLS 1.2 MUST behave in accordance with the requirements of[RFC5246] when negotiating that version. In particular:

  • TLS 1.2 ClientHellos MAY omit this extension.
  • In TLS 1.2, the extension contained hash/signature pairs. The pairs areencoded in two octets, so SignatureScheme values have been allocated toalign with TLS 1.2's encoding. Some legacy pairs are left unallocated. Thesealgorithms are deprecated as of TLS 1.3. They MUST NOT be offered ornegotiated by any implementation. In particular, MD5[SLOTH], SHA-224, andDSA MUST NOT be used.
  • ECDSA signature schemes align with TLS 1.2's ECDSA hash/signature pairs.However, the old semantics did not constrain the signing curve. If TLS 1.2 isnegotiated, implementations MUST be prepared to accept a signature that usesany curve that they advertised in the "supported_groups" extension.
  • Implementations that advertise support for RSASSA-PSS (which is mandatory inTLS 1.3) MUST be prepared to accept a signature using that scheme even whenTLS 1.2 is negotiated. In TLS 1.2, RSASSA-PSS is used with RSA cipher suites.

4.2.4.Certificate Authorities

The "certificate_authorities" extension is used to indicate thecertificate authorities (CAs) which an endpoint supports and which SHOULDbe used by the receiving endpoint to guide certificate selection.

The body of the "certificate_authorities" extension consists of aCertificateAuthoritiesExtension structure.

   opaque DistinguishedName<1..2^16-1>;   struct {       DistinguishedName authorities<3..2^16-1>;   } CertificateAuthoritiesExtension;
authorities:

A list of the distinguished names[X501] of acceptablecertificate authorities, represented in DER-encoded[X690] format. Thesedistinguished names specify a desired distinguished name for a trust anchoror subordinate CA; thus, this message can be used todescribe known trust anchors as well as a desired authorization space.

The client MAY send the "certificate_authorities" extension in the ClientHellomessage. The server MAY send it in the CertificateRequest message.

The "trusted_ca_keys" extension[RFC6066], which serves a similarpurpose, but is more complicated, is not used in TLS 1.3(although it may appear in ClientHello messages from clients which areoffering prior versions of TLS).

4.2.5.OID Filters

The "oid_filters" extension allows servers to provide a list of OID/valuepairs which it would like the client's certificate to match. Thisextension, if provided by the server, MUST only be sent in the CertificateRequest message.

   struct {       opaque certificate_extension_oid<1..2^8-1>;       opaque certificate_extension_values<0..2^16-1>;   } OIDFilter;   struct {       OIDFilter filters<0..2^16-1>;   } OIDFilterExtension;
filters:

A list of certificate extension OIDs[RFC5280] with their allowed value(s) andrepresented in DER-encoded[X690] format. Some certificate extension OIDsallow multiple values (e.g., Extended Key Usage). If the server has includeda non-empty filters list, the client certificate included inthe response MUST contain all of the specified extension OIDs that the clientrecognizes. For each extension OID recognized by the client, all of thespecified values MUST be present in the client certificate (but thecertificate MAY have other values as well). However, the client MUST ignoreand skip any unrecognized certificate extension OIDs. If the client ignoredsome of the required certificate extension OIDs and supplied a certificatethat does not satisfy the request, the server MAY at its discretion eithercontinue the connection without client authentication or abort the handshakewith an "unsupported_certificate" alert. Any given OID MUST NOT appearmore than once in the filters list.

PKIX RFCs define a variety of certificate extension OIDs and their correspondingvalue types. Depending on the type, matching certificate extension values arenot necessarily bitwise-equal. It is expected that TLS implementations will relyon their PKI libraries to perform certificate selection using certificateextension OIDs.

This document defines matching rules for two standard certificate extensionsdefined in[RFC5280]:

  • The Key Usage extension in a certificate matches the request when all keyusage bits asserted in the request are also asserted in the Key Usagecertificate extension.
  • The Extended Key Usage extension in a certificate matches the request when allkey purpose OIDs present in the request are also found in the Extended KeyUsage certificate extension. The special anyExtendedKeyUsage OID MUST NOT beused in the request.

Separate specifications may define matching rules for other certificateextensions.

4.2.6.Post-Handshake Certificate-Based Client Authentication

The "post_handshake_auth" extension is used to indicate that a client is willingto perform post-handshake authentication (Section 4.6.2). ServersMUST NOT send a post-handshake CertificateRequest to clients which do notoffer this extension. Servers MUST NOT send this extension.

   struct {} PostHandshakeAuth;

The "extension_data" field of the "post_handshake_auth" extension is zero length.

4.2.7.Supported Groups

When sent by the client, the "supported_groups" extension indicatesthe named groups which the client supports for key exchange, orderedfrom most preferred to least preferred.

Note: In versions of TLS prior to TLS 1.3, this extension was named"elliptic_curves" and only contained elliptic curve groups. See[RFC8422] and[RFC7919]. This extension was also used to negotiateECDSA curves. Signature algorithms are now negotiated independently (seeSection 4.2.3).

The "extension_data" field of this extension contains a"NamedGroupList" value:

   enum {       /* Elliptic Curve Groups (ECDHE) */       secp256r1(0x0017), secp384r1(0x0018), secp521r1(0x0019),       x25519(0x001D), x448(0x001E),       /* Finite Field Groups (DHE) */       ffdhe2048(0x0100), ffdhe3072(0x0101), ffdhe4096(0x0102),       ffdhe6144(0x0103), ffdhe8192(0x0104),       /* Reserved Code Points */       ffdhe_private_use(0x01FC..0x01FF),       ecdhe_private_use(0xFE00..0xFEFF),       (0xFFFF)   } NamedGroup;   struct {       NamedGroup named_group_list<2..2^16-1>;   } NamedGroupList;
Elliptic Curve Groups (ECDHE):

Indicates support for the corresponding named curve, definedin either FIPS 186-4[DSS] or in[RFC7748].Values 0xFE00 through 0xFEFF are reserved for Private Use[RFC8126].

Finite Field Groups (DHE):

Indicates support for the corresponding finite fieldgroup, defined in[RFC7919].Values 0x01FC through 0x01FF are reserved for Private Use.

Items in "named_group_list" are ordered according to the sender'spreferences (most preferred choice first).

As of TLS 1.3, servers are permitted to send the "supported_groups"extension to the client. Clients MUST NOT act upon any informationfound in "supported_groups" prior to successful completion of thehandshake but MAY use the information learned from a successfullycompleted handshake to change what groups they use in their"key_share" extension in subsequent connections.If the server has a group it prefers to theones in the "key_share" extension but is still willing to accept theClientHello, it SHOULD send "supported_groups" to update the client'sview of its preferences; this extension SHOULD contain all groupsthe server supports, regardless of whether they are currentlysupported by the client.

4.2.8.Key Share

The "key_share" extension contains the endpoint's cryptographic parameters.

Clients MAY send an empty client_shares list in order to requestgroup selection from the server, at the cost of an additional round trip(seeSection 4.1.4).

   struct {       NamedGroup group;       opaque key_exchange<1..2^16-1>;   } KeyShareEntry;
group:

The named group for the key being exchanged.

key_exchange:

Key exchange information. The contents of this field aredetermined by the specified group and its correspondingdefinition.Finite Field Diffie-Hellman[DH76] parameters are described inSection 4.2.8.1; Elliptic Curve Diffie-Hellman parameters aredescribed inSection 4.2.8.2.

In the ClientHello message, the "extension_data" field of this extensioncontains a "KeyShareClientHello" value:

   struct {       KeyShareEntry client_shares<0..2^16-1>;   } KeyShareClientHello;
client_shares:

A list of offered KeyShareEntry values in descending order of client preference.

This list MAY be empty if the client is requesting a HelloRetryRequest.Each KeyShareEntry value MUST correspond to a group offered in the"supported_groups" extension and MUST appear in the same order. However, thevalues MAY be a non-contiguous subset of the "supported_groups" extension andMAY omit the most preferred groups. Such a situation could arise if the mostpreferred groups are new and unlikely to be supported in enough places tomake pregenerating key shares for them efficient.

Clients can offer as many KeyShareEntry values as the number of supportedgroups it is offering, eachrepresenting a single set of key exchange parameters. For instance, aclient might offer shares for several elliptic curves or multipleFFDHE groups. The key_exchange values for each KeyShareEntry MUST begenerated independently. Clients MUST NOT offer multipleKeyShareEntry values for the same group. Clients MUST NOT offer anyKeyShareEntry values for groups not listed in the client's"supported_groups" extension. Servers MAY check for violations ofthese rules and abort the handshake with an "illegal_parameter" alertif one is violated.

In a HelloRetryRequest message, the "extension_data" field of thisextension contains a KeyShareHelloRetryRequest value:

   struct {       NamedGroup selected_group;   } KeyShareHelloRetryRequest;
selected_group:

The mutually supported group the server intends to negotiate andis requesting a retried ClientHello/KeyShare for.

Upon receipt of this extension in a HelloRetryRequest, the client MUSTverify that (1) the selected_group field corresponds to a group which was providedin the "supported_groups" extension in the original ClientHello and (2)the selected_group field does not correspond to a group which wasprovided in the "key_share" extension in the original ClientHello. If either ofthese checks fails, then the client MUST abort the handshake with an"illegal_parameter" alert. Otherwise, when sending the new ClientHello, theclient MUST replace the original "key_share" extension with onecontaining only a new KeyShareEntry for the group indicated in theselected_group field of the triggering HelloRetryRequest.

In a ServerHello message, the "extension_data" field of thisextension contains a KeyShareServerHello value:

   struct {       KeyShareEntry server_share;   } KeyShareServerHello;
server_share:

A single KeyShareEntry value that is in the same group as one of theclient's shares.

If using (EC)DHE key establishment, servers offer exactly oneKeyShareEntry in the ServerHello. This value MUST be in the same groupas the KeyShareEntry value offeredby the client that the server has selected for the negotiated key exchange.Servers MUST NOT send a KeyShareEntry for any group notindicated in the client's "supported_groups" extension andMUST NOT send a KeyShareEntry when using the "psk_ke" PskKeyExchangeMode.If using (EC)DHE key establishment and a HelloRetryRequest containing a"key_share" extension was received by the client, the client MUST verify that theselected NamedGroup in the ServerHello is the same as that in the HelloRetryRequest.If this check fails, the client MUST abort the handshake with an "illegal_parameter"alert.

4.2.8.1.Diffie-Hellman Parameters

Diffie-Hellman[DH76] parameters for both clients and servers are encoded inthe opaque key_exchange field of a KeyShareEntry in a KeyShare structure.The opaque value contains theDiffie-Hellman public value (Y = g^X mod p) for the specified group(see[RFC7919] for group definitions)encoded as a big-endian integer and padded to the left with zeros to the size of p inbytes.

Note: For a given Diffie-Hellman group, the padding results in all public keyshaving the same length.

Peers MUST validate each other's public key Y by ensuring that 1 < Y< p-1. This check ensures that the remote peer is properly behaved andisn't forcing the local system into a small subgroup.

4.2.8.2.ECDHE Parameters

ECDHE parameters for both clients and servers are encoded in theopaque key_exchange field of a KeyShareEntry in a KeyShare structure.

For secp256r1, secp384r1, and secp521r1, the contents are the serializedvalue of the following struct:

   struct {       uint8 legacy_form = 4;       opaque X[coordinate_length];       opaque Y[coordinate_length];   } UncompressedPointRepresentation;

X and Y, respectively, are the binary representations of the x and yvalues in network byte order. There are no internal length markers,so each number representation occupies as many octets as implied bythe curve parameters. For P-256, this means that each of X and Y use32 octets, padded on the left by zeros if necessary. For P-384, theytake 48 octets each. For P-521, they take 66 octets each.

For the curves secp256r1, secp384r1, and secp521r1,peers MUST validate each other's public value Q by ensuringthat the point is a valid point on the elliptic curve.The appropriate validation procedures are defined in Section 4.3.7 of[ECDSA]and alternatively in Section 5.6.2.3 of[KEYAGREEMENT].This process consists of threesteps: (1) verify that Q is not the point at infinity (O), (2) verifythat for Q = (x, y) both integers x and y are in the correct interval, and (3)ensure that (x, y) is a correct solution to the elliptic curveequation. For these curves, implementors do not need to verifymembership in the correct subgroup.

For X25519 and X448, the contents of the public value is the K_Aor K_B value described in Section 6 of[RFC7748].This is 32 bytes for X25519 and 56 bytes for X448.

Note: Versions of TLS prior to 1.3 permitted point format negotiation;TLS 1.3 removes this feature in favor of a single point formatfor each curve.

4.2.9.Pre-Shared Key Exchange Modes

In order to use PSKs, clients MUST also send a "psk_key_exchange_modes"extension. The semantics of this extension are that the client onlysupports the use of PSKs with these modes, which restricts both theuse of PSKs offered in this ClientHello and those which the servermight supply via NewSessionTicket.

A client MUST provide a "psk_key_exchange_modes" extension if it offersa "pre_shared_key" extension. If clients offer "pre_shared_key" withouta "psk_key_exchange_modes" extension, servers MUST abort the handshake.Servers MUST NOT select a key exchange mode that is not listed by theclient. This extension also restricts the modes for use with PSK resumption.Servers SHOULD NOT send NewSessionTicket with tickets that are notcompatible with the advertised modes; however, if a server does so, the impactwill just be that the client's attempts at resumption fail.

The server MUST NOT send a "psk_key_exchange_modes" extension.

   enum { psk_ke(0), psk_dhe_ke(1), (255) } PskKeyExchangeMode;   struct {       PskKeyExchangeMode ke_modes<1..255>;   } PskKeyExchangeModes;
psk_ke:

PSK-only key establishment. In this mode, the server MUST NOTsupply a "key_share" value.

psk_dhe_ke:

PSK with (EC)DHE key establishment. In this mode,the client and server MUST supply "key_share" values as describedinSection 4.2.8.

Any future values that are allocated must ensure that the transmittedprotocol messages unambiguously identify which mode was selected bythe server; at present, this is indicated by the presence of the "key_share"in the ServerHello.

4.2.10.Early Data Indication

When a PSK is used and early data is allowed for that PSK(see for instanceAppendix B.3.4), the client can send Application Datain its first flight of messages. If the client opts to do so, it MUSTsupply both the "pre_shared_key" and "early_data" extensions.

The "extension_data" field of this extension contains an"EarlyDataIndication" value.

   struct {} Empty;   struct {       select (Handshake.msg_type) {           case new_session_ticket:   uint32 max_early_data_size;           case client_hello:         Empty;           case encrypted_extensions: Empty;       };   } EarlyDataIndication;

SeeSection 4.6.1 for details regarding the use of the max_early_data_size field.

The parameters for the 0-RTT data (version, symmetric cipher suite,Application-Layer Protocol Negotiation (ALPN)[RFC7301] protocol,etc.) are those associated with the PSK in use.For externally provisioned PSKs, the associated values are thoseprovisioned along with the key. For PSKs established via a NewSessionTicketmessage, the associated values are those which were negotiated in the connectionwhich established the PSK. The PSK used to encrypt the early dataMUST be the first PSK listed in the client's "pre_shared_key" extension.

For PSKs provisioned via NewSessionTicket, a server MUST validate thatthe ticket age for the selected PSK identity (computed by subtractingticket_age_add from PskIdentity.obfuscated_ticket_age modulo 2^32)is within a small tolerance of thetime since the ticket was issued (seeSection 8). If it is not,the server SHOULD proceed with the handshake but reject 0-RTT, andSHOULD NOT take any other action that assumes that this ClientHello isfresh.

0-RTT messages sent in the first flight have the same (encrypted) content typesas messages of the same type sent in other flights (handshake andapplication_data) but are protected underdifferent keys. After receiving the server's Finished message, if theserver has accepted early data, an EndOfEarlyData messagewill be sent to indicate the key change. This message will be encryptedwith the 0-RTT traffic keys.

A server which receives an "early_data" extensionMUST behave in one of three ways:

  • Ignore the extension and return a regular 1-RTT response. The server thenskips past early data by attempting to deprotect received records using the handshake traffickey, discarding records which fail deprotection (up to the configured max_early_data_size).Once a record is deprotectedsuccessfully, it is treated as the start of the client's second flightand the server proceeds as with an ordinary 1-RTT handshake.
  • Request that the client send another ClientHello by responding with aHelloRetryRequest. A client MUST NOT include the "early_data" extension inits followup ClientHello. The server then ignores early data by skippingall records with an external content type of "application_data" (indicatingthat they are encrypted), up to the configured max_early_data_size.
  • Return its own "early_data" extension in EncryptedExtensions,indicating that it intends toprocess the early data. It is not possible for the serverto accept only a subset of the early data messages.Even though the server sends a message accepting early data, the actual earlydata itself may already be in flight by the time the server generates this message.

In order to accept early data, the server MUST have selected the firstkey offered in the client's "pre_shared_key" extension. In addition,it MUST verify that the following values are the same as thoseassociated with the selected PSK:

  • The selected TLS version number
  • The selected cipher suite
  • The selected ALPN[RFC7301] protocol, if any

These requirements are a superset of those needed to perform a 1-RTThandshake using the PSK in question.

Future extensions MUST define their interaction with 0-RTT.

If any of these checks fail, the server MUST NOT respondwith the extension and must discard all the first-flightdata using one of the first two mechanisms listed above(thus falling back to 1-RTT or 2-RTT). If the client attemptsa 0-RTT handshake but the server rejects it, the server will generallynot have the 0-RTT record protection keys and must insteaduse trial decryption (either with the 1-RTT handshake keys orby looking for a cleartext ClientHello in the case of a HelloRetryRequest) tofind the first non-0-RTT message.

If the server chooses to accept the "early_data" extension,then it MUST comply with the same error-handling requirementsspecified for all records when processing early data records.Specifically, if the server fails to decrypt a 0-RTT record followingan accepted "early_data" extension, it MUST terminate the connectionwith a "bad_record_mac" alert as perSection 5.2.

If the server rejects the "early_data" extension, the clientapplication MAY opt to retransmit the Application Data previouslysent in early data once the handshake hasbeen completed. Note that automatic retransmission of early datacould result in incorrect assumptions regarding the status of the connection. For instance, when the negotiated connection selects adifferent ALPN protocol from what was used for the early data, anapplication might need to construct different messages. Similarly, ifearly data assumes anything about the connection state, it might besent in error after the handshake completes.

A TLS implementation SHOULD NOT automatically resend early data;applications are in a better position to decide when retransmissionis appropriate. A TLS implementation MUST NOT automatically resendearly data unless the negotiated connection selects the same ALPNprotocol.

4.2.11.Pre-Shared Key Extension

The "pre_shared_key" extension is used to negotiate the identity of thepre-shared key to be used with a given handshake in associationwith PSK key establishment.

The "extension_data" field of this extension contains a"PreSharedKeyExtension" value:

   struct {       opaque identity<1..2^16-1>;       uint32 obfuscated_ticket_age;   } PskIdentity;   opaque PskBinderEntry<32..255>;   struct {       PskIdentity identities<7..2^16-1>;       PskBinderEntry binders<33..2^16-1>;   } OfferedPsks;   struct {       select (Handshake.msg_type) {           case client_hello: OfferedPsks;           case server_hello: uint16 selected_identity;       };   } PreSharedKeyExtension;
identity:

A label for a key. For instance, a ticket (as definedinAppendix B.3.4) or a label for a pre-shared keyestablished externally.

obfuscated_ticket_age:

An obfuscated version of the age of the key.Section 4.2.11.1 describes how to form this valuefor identities established via the NewSessionTicket message.For identities established externally, an obfuscated_ticket_age of 0SHOULD be used, and servers MUST ignore the value.

identities:

A list of the identities that the client is willingto negotiate with the server. If sent alongside the "early_data"extension (seeSection 4.2.10), the first identity is theone used for 0-RTT data.

binders:

A series of HMAC values, one foreach value in the identities list and in the sameorder, computed as described below.

selected_identity:

The server's chosen identity expressed as a (0-based) index intothe identities in the client's "OfferedPsks.identities" list.

Each PSK is associated with a single Hash algorithm. For PSKs establishedvia the ticket mechanism (Section 4.6.1), this is the KDF Hash algorithmon the connection where the ticket was established.For externally established PSKs, the Hash algorithm MUST be set when thePSK is established or default to SHA-256 if no such algorithmis defined. The server MUST ensure that it selects a compatiblePSK (if any) and cipher suite.

In TLS versions prior to TLS 1.3, the Server Name Indication (SNI) value wasintended to be associated with the session (Section 3 of[RFC6066]), with theserver being required to enforce that the SNI value associated with the sessionmatches the one specified in the resumption handshake. However, in reality theimplementations were not consistent on which of two supplied SNI values theywould use, leading to the consistency requirement being de facto enforced by theclients. In TLS 1.3, the SNI value is always explicitly specified in theresumption handshake, and there is no need for the server to associate an SNI value with theticket. Clients, however, SHOULD store the SNI with the PSK to fulfillthe requirements ofSection 4.6.1.

Implementor's note: When session resumption is the primary use case of PSKs,the most straightforward way to implement thePSK/cipher suite matching requirements is to negotiate the ciphersuite first and then exclude any incompatible PSKs. Any unknown PSKs(e.g., ones not in the PSK database or encrypted with anunknown key) SHOULD simply be ignored. If no acceptable PSKs arefound, the server SHOULD perform a non-PSK handshake if possible.If backward compatibility is important, client-provided, externallyestablished PSKs SHOULD influence cipher suite selection.

Prior to accepting PSK key establishment, the server MUST validate thecorresponding binder value (seeSection 4.2.11.2 below). If this value isnot present or does not validate, the server MUST abort the handshake.Servers SHOULD NOT attempt to validate multiple binders; rather, theySHOULD select a single PSK and validate solely the binder thatcorresponds to that PSK.SeeSection 8.2 andAppendix F.6 for thesecurity rationale for this requirement.In order to accept PSK key establishment, theserver sends a "pre_shared_key" extension indicating the selectedidentity.

Clients MUST verify that the server's selected_identity is within therange supplied by the client, that the server selected a cipher suiteindicating a Hash associated with the PSK, and that a server"key_share" extension is present if required by theClientHello "psk_key_exchange_modes" extension. If these values are notconsistent, the client MUST abort the handshake with an"illegal_parameter" alert.

If the server supplies an "early_data" extension, the client MUSTverify that the server's selected_identity is 0. If anyother value is returned, the client MUST abort the handshakewith an "illegal_parameter" alert.

The "pre_shared_key" extension MUST be the last extension in theClientHello (this facilitates implementation as describedbelow). Servers MUST check that it is the last extension and otherwisefail the handshake with an "illegal_parameter" alert.

4.2.11.1.Ticket Age

The client's view of the age of a ticket is the time since the receiptof the NewSessionTicket message. Clients MUST NOT attempt to usetickets which have ages greater than the "ticket_lifetime" value whichwas provided with the ticket. The "obfuscated_ticket_age" field ofeach PskIdentity contains an obfuscated version of the ticket ageformed by taking the age in milliseconds and adding the "ticket_age_add"value that was included with the ticket (seeSection 4.6.1), modulo 2^32.This addition prevents passive observers from correlating connectionsunless tickets are reused. Note that the "ticket_lifetime" field inthe NewSessionTicket message is in seconds but the "obfuscated_ticket_age"is in milliseconds. Because ticket lifetimes arerestricted to a week, 32 bits is enough to represent any plausibleage, even in milliseconds.

4.2.11.2.PSK Binder

The PSK binder value forms a binding between a PSK and the currenthandshake, as well as a binding between the handshake in which the PSK wasgenerated (if via a NewSessionTicket message) and the current handshake.Each entry in the binders list is computed as an HMACover a transcript hash (seeSection 4.4.1) containing a partial ClientHelloup to and including the PreSharedKeyExtension.identities field. Thatis, it includes all of the ClientHello but not the binders listitself. The length fields for the message (including the overalllength, the length of the extensions block, and the length of the"pre_shared_key" extension) are all set as if binders of the correctlengths were present.

The PskBinderEntry is computed in the same way as the Finishedmessage (Section 4.4.4) but with the BaseKey being the binder_keyderived via the key schedule from the corresponding PSK whichis being offered (seeSection 7.1).

If the handshake includes a HelloRetryRequest, the initial ClientHelloand HelloRetryRequest are included in the transcript along with thenew ClientHello. For instance, if the client sends ClientHello1, itsbinder will be computed over:

   Transcript-Hash(Truncate(ClientHello1))

Where Truncate() removes the binders list from the ClientHello.

If the server responds with a HelloRetryRequest and the client then sendsClientHello2, its binder will be computed over:

   Transcript-Hash(ClientHello1,                   HelloRetryRequest,                   Truncate(ClientHello2))

The full ClientHello1/ClientHello2 is included in all other handshake hash computations.Note that in the first flight, Truncate(ClientHello1) is hashed directly,but in the second flight, ClientHello1 is hashed and then reinjected as a"message_hash" message, as described inSection 4.4.1.

4.2.11.3.Processing Order

Clients are permitted to "stream" 0-RTT data until theyreceive the server's Finished, only then sending the EndOfEarlyDatamessage, followed by the rest of the handshake.In order to avoid deadlocks, when accepting "early_data",servers MUST process the client's ClientHello and then immediatelysend their flight of messages, rather than waiting for the client'sEndOfEarlyData message before sending its ServerHello.

4.3.Server Parameters

The next two messages from the server, EncryptedExtensions andCertificateRequest, contain information from the serverthat determines the rest of the handshake. These messagesare encrypted with keys derived from the server_handshake_traffic_secret.

4.3.1.Encrypted Extensions

In all handshakes, the server MUST send theEncryptedExtensions message immediately after theServerHello message. This is the first message that is encryptedunder keys derived from the server_handshake_traffic_secret.

The EncryptedExtensions message contains extensionsthat can be protected, i.e., any which are not needed toestablish the cryptographic context but which are notassociated with individual certificates. The clientMUST check EncryptedExtensions for the presence of any forbiddenextensions and if any are found MUST abort the handshake with an"illegal_parameter" alert.

Structure of this message:

   struct {       Extension extensions<0..2^16-1>;   } EncryptedExtensions;
extensions:

A list of extensions. For more information, see the table inSection 4.2.

4.3.2.Certificate Request

A server which is authenticating with a certificate MAY optionallyrequest a certificate from the client. This message, if sent, MUSTfollow EncryptedExtensions.

Structure of this message:

   struct {       opaque certificate_request_context<0..2^8-1>;       Extension extensions<0..2^16-1>;   } CertificateRequest;
certificate_request_context:

An opaque string which identifies the certificate request andwhich will be echoed in the client's Certificate message. Thecertificate_request_context MUST be unique within the scopeof this connection (thus preventing replay of clientCertificateVerify messages). This field SHALL be zero lengthunless used for the post-handshake authentication exchangesdescribed inSection 4.6.2.When requesting post-handshake authentication, the server SHOULDmake the context unpredictable to the client (e.g., byrandomly generating it) in order to prevent an attacker whohas temporary access to the client's private key frompre-computing valid CertificateVerify messages.

extensions:

A list of extensions describing the parameters of thecertificate being requested. The "signature_algorithms"extension MUST be specified, and other extensions may optionally beincluded if defined for this message.Clients MUST ignore unrecognized extensions.

In prior versions of TLS, the CertificateRequest messagecarried a list of signature algorithms and certificate authoritieswhich the server would accept. In TLS 1.3, the former is expressedby sending the "signature_algorithms" and optionally "signature_algorithms_cert"extensions. The latter isexpressed by sending the "certificate_authorities" extension(seeSection 4.2.4).

Servers which are authenticating with a resumption PSK MUST NOT send theCertificateRequest message in the main handshake, though theyMAY send it in post-handshake authentication (seeSection 4.6.2)provided that the client has sent the "post_handshake_auth"extension (seeSection 4.2.6).Servers which are authenticating with an external PSKMUST NOT send the CertificateRequest message either in the main handshakeor request post-handshake authentication. Future specifications MAYprovide an extension to permit this.

4.4.Authentication Messages

As discussed inSection 2, TLS generally uses a commonset of messages for authentication, key confirmation, and handshakeintegrity: Certificate, CertificateVerify, and Finished.(The PSK binders also perform key confirmation, in asimilar fashion.) These threemessages are always sent as the last messages in their handshakeflight. The Certificate and CertificateVerify messages are onlysent under certain circumstances, as defined below. The Finishedmessage is always sent as part of the Authentication Block.These messages are encrypted under keys derived from the[sender]_handshake_traffic_secret.

The computations for the Authentication messages all uniformlytake the following inputs:

  • The certificate and signing key to be used.
  • A Handshake Context consisting of the list of messages to beincluded in the transcript hash.
  • A Base Key to be used to compute a MAC key.

Based on these inputs, the messages then contain:

Certificate

The certificate to be used for authentication, and anysupporting certificates in the chain. Note that certificate-basedclient authentication is not available in PSK handshake flows(including 0-RTT).

CertificateVerify:

A signature over the value Transcript-Hash(Handshake Context, Certificate)

Finished:

A MAC over the value Transcript-Hash(Handshake Context, Certificate, CertificateVerify)using a MAC key derived from the Base Key.

The following table defines the Handshake Context and MAC Base Keyfor each scenario:

Table 2:Authentication Inputs
ModeHandshake ContextBase Key
ServerClientHello ... later of EncryptedExtensions/CertificateRequestserver_handshake_traffic_secret
ClientClientHello ... later of server Finished/EndOfEarlyDataclient_handshake_traffic_secret
Post-HandshakeClientHello ... client Finished + CertificateRequestclient_application_traffic_secret_N

4.4.1.The Transcript Hash

Many of the cryptographic computations in TLS make use of a transcripthash. This value is computed by hashing the concatenation ofeach included handshake message, including the handshakemessage header carrying the handshake message type and length fields,but not including record layer headers. I.e.,

 Transcript-Hash(M1, M2, ... Mn) = Hash(M1 || M2 || ... || Mn)

As an exception to this general rule, when the server responds to aClientHello with a HelloRetryRequest, the value of ClientHello1 isreplaced with a special synthetic handshake message of handshaketype "message_hash" containing Hash(ClientHello1). I.e.,

 Transcript-Hash(ClientHello1, HelloRetryRequest, ... Mn) =     Hash(message_hash ||        /* Handshake type */          00 00 Hash.length  ||   /* Handshake message length (bytes) */          Hash(ClientHello1) ||  /* Hash of ClientHello1 */          HelloRetryRequest  || ... || Mn)

The reason for this construction is to allow the server to do astateless HelloRetryRequest by storing just the hash of ClientHello1in the cookie, rather than requiring it to export the entire intermediatehash state (seeSection 4.2.2).

For concreteness, the transcript hash is always taken from thefollowing sequence of handshake messages, starting at the firstClientHello and including only those messages that were sent:ClientHello, HelloRetryRequest, ClientHello, ServerHello,EncryptedExtensions, server CertificateRequest, server Certificate,server CertificateVerify, server Finished, EndOfEarlyData, clientCertificate, client CertificateVerify, client Finished.

In general, implementations can implement the transcript by keeping arunning transcript hash value based on the negotiated hash. Note,however, that subsequent post-handshake authentications do not includeeach other, just the messages through the end of the main handshake.

4.4.2.Certificate

This message conveys the endpoint's certificate chain to the peer.

The server MUST send a Certificate message whenever the agreed-uponkey exchange method uses certificates for authentication (thisincludes all key exchange methods defined in this document except PSK).

The client MUST send a Certificate message if and only if the server hasrequested certificate-based client authentication via a CertificateRequest message(Section 4.3.2). If the server requests certificate-based client authenticationbut no suitable certificate is available, the clientMUST send a Certificate message containing no certificates (i.e., withthe "certificate_list" field having length 0). A Finished message MUSTbe sent regardless of whether the Certificate message is empty.

Structure of this message:

   enum {       X509(0),       RawPublicKey(2),       (255)   } CertificateType;   struct {       select (certificate_type) {           case RawPublicKey:             /* From RFC 7250 ASN.1_subjectPublicKeyInfo */             opaque ASN1_subjectPublicKeyInfo<1..2^24-1>;           case X509:             opaque cert_data<1..2^24-1>;       };       Extension extensions<0..2^16-1>;   } CertificateEntry;   struct {       opaque certificate_request_context<0..2^8-1>;       CertificateEntry certificate_list<0..2^24-1>;   } Certificate;
certificate_request_context:

If this message is in response to a CertificateRequest, thevalue of certificate_request_context in that message. Otherwise(in the case of server authentication), this field SHALL be zero length.

certificate_list:

A list (chain) of CertificateEntry structures, eachcontaining a single certificate and list of extensions.

extensions:

A list of extension values for the CertificateEntry. The "Extension"format is defined inSection 4.2. Valid extensions for server certificatesat present include the OCSP Status extension[RFC6066] and theSignedCertificateTimestamp extension[RFC6962]; future extensions maybe defined for this message as well. Extensions in the Certificatemessage from the server MUST correspond to ones from the ClientHello message.Extensions in the Certificate message from the client MUST correspond toextensions in the CertificateRequest message from the server.If an extension applies to the entire chain, it SHOULD be includedin the first CertificateEntry.

If the corresponding certificate type extension("server_certificate_type" or "client_certificate_type") was not negotiatedin EncryptedExtensions, or the X.509 certificate type was negotiated, then eachCertificateEntry contains a DER-encoded X.509 certificate. The sender'scertificate MUST come in the first CertificateEntry in the list. Eachfollowing certificate SHOULD directly certify the one immediately preceding it.Because certificate validation requires that trust anchors bedistributed independently, a certificate that specifies a trust anchorMAY be omitted from the chain, provided that supported peers are knownto possess any omitted certificates.

Note: Prior to TLS 1.3, "certificate_list" ordering required each certificateto certify the one immediately preceding it;however, some implementations allowed some flexibility. Servers sometimes sendboth a current and deprecated intermediate for transitional purposes, and othersare simply configured incorrectly, but these cases can nonetheless be validatedproperly. For maximum compatibility, all implementations SHOULD be prepared tohandle potentially extraneous certificates and arbitrary orderings from any TLSversion, with the exception of the end-entity certificate which MUST be first.

If the RawPublicKey certificate type was negotiated, then thecertificate_list MUST contain no more than one CertificateEntry, whichcontains an ASN1_subjectPublicKeyInfo value as defined in[RFC7250],Section 3.

The OpenPGP certificate type[RFC6091] MUST NOT be used with TLS 1.3.

The server's certificate_list MUST always be non-empty. A client willsend an empty certificate_list if it does not have an appropriatecertificate to send in response to the server's authenticationrequest.

4.4.2.1.OCSP Status and SCT Extensions

[RFC6066] and[RFC6961] provide extensions to negotiate the serversending OCSP responses to the client. In TLS 1.2 and below, theserver replies with an empty extension to indicate negotiation of thisextension and the OCSP information is carried in a CertificateStatusmessage. In TLS 1.3, the server's OCSP information is carried inan extension in the CertificateEntry containing the associatedcertificate. Specifically, the body of the "status_request" extensionfrom the server MUST be a CertificateStatus structure as definedin[RFC6066], which is interpreted as defined in[RFC6960].

Note: The status_request_v2 extension[RFC6961] is deprecated. TLS 1.3 serversMUST NOT act upon its presence or information in it when processing ClientHello messages; in particular, they MUST NOT send the status_request_v2 extension in theEncryptedExtensions, CertificateRequest, or Certificate messages.TLS 1.3 servers MUST be able to process ClientHello messages that include it,as it MAY be sent by clients that wish to use it in earlier protocol versions.

A server MAY request that a client present an OCSP response with itscertificate by sending an empty "status_request" extension in itsCertificateRequest message. If the client opts to send an OCSP response, thebody of its "status_request" extension MUST be a CertificateStatus structure asdefined in[RFC6066].

Similarly,[RFC6962] provides a mechanism for a server to send aSigned Certificate Timestamp (SCT) as an extension in the ServerHelloin TLS 1.2 and below.In TLS 1.3, the server's SCT information is carried in an extension in theCertificateEntry.

4.4.2.2.Server Certificate Selection

The following rules apply to the certificates sent by the server:

  • The certificate type MUST be X.509v3[RFC5280], unless explicitly negotiatedotherwise (e.g.,[RFC7250]).
  • The end-entity certificate MUST allow the key to be used for signing witha signature scheme indicated in the client's "signature_algorithms"extension (seeSection 4.2.3). That is, the digitalSignature bitMUST be set if the Key Usage extension is present, and the public key (withassociated restrictions) MUST be compatible with some supported signaturescheme.
  • The "server_name"[RFC6066] and "certificate_authorities" extensions are used toguide certificate selection. As servers MAY require the presence of the "server_name"extension, clients SHOULD send this extension when the server is identified by name.

All certificates provided by the server MUST be signed by asignature algorithm advertised by the client, if it is able to provide sucha chain (seeSection 4.2.3).Certificates that are self-signedor certificates that are expected to be trust anchors are not validated aspart of the chain and therefore MAY be signed with any algorithm.

If the server cannot produce a certificate chain that is signed only via theindicated supported algorithms, then it SHOULD continue the handshake by sendingthe client a certificate chain of its choice that may include algorithmsthat are not known to be supported by the client.This fallback chain SHOULD NOT use the deprecated SHA-1 hash algorithm in general,but MAY do so if the client's advertisement permits it,and MUST NOT do so otherwise.

If the client cannot construct an acceptable chain using the providedcertificates and decides to abort the handshake, then it MUST abort thehandshake with an appropriate certificate-related alert (by default,"unsupported_certificate"; seeSection 6.2 for more information).

If the server has multiple certificates, it chooses one of them based on theabove-mentioned criteria (in addition to other criteria, such as transport-layer endpoint, local configuration, and preferences).

4.4.2.3.Client Certificate Selection

The following rules apply to certificates sent by the client:

  • The certificate type MUST be X.509v3[RFC5280], unless explicitly negotiatedotherwise (e.g.,[RFC7250]).
  • If the "certificate_authorities" extension in the CertificateRequestmessage was present, at least one of the certificates in the certificatechain SHOULD be issued by one of the listed CAs.
  • The certificates MUST be signed using an acceptable signaturealgorithm, as described inSection 4.3.2. Note that thisrelaxes the constraints on certificate-signing algorithms found inprior versions of TLS.
  • If the CertificateRequest message contained a non-empty "oid_filters"extension, the end-entity certificate MUST match the extension OIDsthat are recognized by the client, as described inSection 4.2.5.
4.4.2.4.Receiving a Certificate Message

In general, detailed certificate validation procedures are out of scope forTLS (see[RFC5280]). This section provides TLS-specific requirements.

If the server supplies an empty Certificate message, the client MUST abortthe handshake with a "decode_error" alert.

If the client does not send any certificates (i.e., it sends an emptyCertificate message),the server MAY at its discretion either continue the handshake without clientauthentication, or abort the handshake with a "certificate_required" alert. Also, if someaspect of the certificate chain was unacceptable (e.g., it was not signed by aknown, trusted CA), the server MAY at its discretion either continue thehandshake (considering the client unauthenticated) or abort the handshake.

Any endpoint receiving any certificate which it would need to validateusing any signature algorithm using an MD5 hash MUST abort thehandshake with a "bad_certificate" alert. SHA-1 is deprecated and itis RECOMMENDED that any endpoint receiving any certificate which itwould need to validate using any signature algorithm using a SHA-1hash abort the handshake with a "bad_certificate" alert. For clarity,this means that endpoints can accept these algorithms forcertificates that are self-signed or are trust anchors.

All endpoints are RECOMMENDED to transition to SHA-256 or better as soonas possible to maintain interoperability with implementationscurrently in the process of phasing out SHA-1 support.

Note that a certificate containing a key for one signature algorithmMAY be signed using a different signature algorithm (for instance,an RSA key signed with an ECDSA key).

4.4.3.Certificate Verify

This message is used to provide explicit proof that an endpointpossesses the private key corresponding to its certificate.The CertificateVerify message also provides integrity for the handshake upto this point. Servers MUST send this message when authenticating via a certificate.Clients MUST send this message whenever authenticating via a certificate (i.e., whenthe Certificate message is non-empty). When sent, this message MUST appear immediatelyafter the Certificate message and immediately prior to the Finished message.

Structure of this message:

   struct {       SignatureScheme algorithm;       opaque signature<0..2^16-1>;   } CertificateVerify;

The algorithm field specifies the signature algorithm used (seeSection 4.2.3 for the definition of this type). Thesignature is a digital signature using that algorithm. Thecontent that is covered under the signature is the hash output as described inSection 4.4.1, namely:

   Transcript-Hash(Handshake Context, Certificate)

The digital signature is then computed over the concatenation of:

  • A string that consists of octet 32 (0x20) repeated 64 times
  • The context string (defined below)
  • A single 0 byte which serves as the separator
  • The content to be signed

This structure is intended to prevent an attack on previous versionsof TLS in which the ServerKeyExchange format meant thatattackers could obtain a signature of a message with a chosen 32-byteprefix (ClientHello.random). The initial 64-byte pad clears that prefixalong with the server-controlled ServerHello.random.

The context string for a server signature is"TLS 1.3, server CertificateVerify"The context string for a client signature is"TLS 1.3, client CertificateVerify"It is used to provide separation between signatures made in differentcontexts, helping against potential cross-protocol attacks.

For example, if the transcript hash was 32 bytes of01 (this length would make sense for SHA-256), the content covered bythe digital signature for a server CertificateVerify would be:

   2020202020202020202020202020202020202020202020202020202020202020   2020202020202020202020202020202020202020202020202020202020202020   544c5320312e332c207365727665722043657274696669636174655665726966   79   00   0101010101010101010101010101010101010101010101010101010101010101

On the sender side, the process for computing the signature field of theCertificateVerify message takes as input:

  • The content covered by the digital signature
  • The private signing key corresponding to the certificate sent in theprevious message

If the CertificateVerify message is sent by a server, the signaturealgorithm MUST be one offered in the client's "signature_algorithms" extensionunless no valid certificate chain can be produced without unsupportedalgorithms (seeSection 4.2.3).

If sent by a client, the signature algorithm used in the signatureMUST be one of those present in the supported_signature_algorithmsfield of the "signature_algorithms" extension in the CertificateRequest message.

In addition, the signature algorithm MUST be compatible with the keyin the sender's end-entity certificate. RSA signatures MUST use anRSASSA-PSS algorithm, regardless of whether RSASSA-PKCS1-v1_5 algorithmsappear in "signature_algorithms". The SHA-1 algorithm MUST NOT be usedin any signatures of CertificateVerify messages.All SHA-1 signature algorithms in this specification are defined solelyfor use in legacy certificates and are not valid for CertificateVerifysignatures.

The receiver of a CertificateVerify message MUST verify the signature field.The verification process takes as input:

  • The content covered by the digital signature
  • The public key contained in the end-entity certificate found in theassociated Certificate message
  • The digital signature received in the signature field of theCertificateVerify message

If the verification fails, the receiver MUST terminate the handshakewith a "decrypt_error" alert.

4.4.4.Finished

The Finished message is the final message in the AuthenticationBlock. It is essential for providing authentication of the handshakeand of the computed keys.

Recipients of Finished messages MUST verify that the contents arecorrect and if incorrect MUST terminate the connectionwith a "decrypt_error" alert.

Once a side has sent its Finished message and has received andvalidated the Finished message from its peer, it may begin to send andreceive Application Data over the connection. There are twosettings in which it is permitted to send data prior toreceiving the peer's Finished:

  1. Clients sending 0-RTT data as described inSection 4.2.10.
  2. Servers MAY send data after sending their first flight, butbecause the handshake is not yet complete, they have no assuranceof either the peer's identity or its liveness (i.e.,the ClientHello might have been replayed).

The key used to compute the Finished message is computed from theBase Key defined inSection 4.4 using HKDF (seeSection 7.1). Specifically:

finished_key =    HKDF-Expand-Label(BaseKey, "finished", "", Hash.length)

Structure of this message:

   struct {       opaque verify_data[Hash.length];   } Finished;

The verify_data value is computed as follows:

   verify_data =       HMAC(finished_key,            Transcript-Hash(Handshake Context,                            Certificate*, CertificateVerify*))   * Only included if present.

HMAC[RFC2104] uses the Hash algorithm for the handshake.As noted above, the HMAC input can generally be implemented by a runninghash, i.e., just the handshake hash at this point.

In previous versions of TLS, the verify_data was always 12 octets long. InTLS 1.3, it is the size of the HMAC output for the Hash used for the handshake.

Note: Alerts and any other non-handshake record types are not handshake messagesand are not included in the hash computations.

Any records following a Finished message MUST be encrypted under theappropriate application traffic key as described inSection 7.2.In particular, this includes any alerts sent by theserver in response to client Certificate and CertificateVerify messages.

4.5.End of Early Data

   struct {} EndOfEarlyData;

If the server sent an "early_data" extension in EncryptedExtensions, the client MUST send anEndOfEarlyData message after receiving the server Finished. If the server doesnot send an "early_data" extension in EncryptedExtensions, then the client MUST NOT send anEndOfEarlyData message. This message indicates that all0-RTT application_data messages, if any, have been transmitted andthat the following records are protected under handshake traffic keys.Servers MUST NOT send this message, and clients receiving itMUST terminate the connection with an "unexpected_message" alert.This message is encrypted under keys derived from the client_early_traffic_secret.

4.6.Post-Handshake Messages

TLS also allows other messages to be sent after the main handshake.These messages use a handshake content type and are encrypted under theappropriate application traffic key.

4.6.1.New Session Ticket Message

At any time after the server has received the client Finished message,it MAY send a NewSessionTicket message. This message creates a uniqueassociation between the ticket value and a secret PSKderived from the resumption secret (seeSection 7).

The client MAY use this PSK for future handshakes by including theticket value in the "pre_shared_key" extension in its ClientHello(Section 4.2.11). Servers MAY send multiple tickets on asingle connection, either immediately after each other orafter specific events (seeAppendix C.4).For instance, the server might send a new ticket after post-handshakeauthentication in order to encapsulate the additional clientauthentication state. Multiple tickets are useful for clientsfor a variety of purposes, including:

  • Opening multiple parallel HTTP connections.
  • Performing connection racing across interfaces and address familiesvia (for example) Happy Eyeballs[RFC8305] or related techniques.

Any ticket MUST only be resumed with a cipher suite that has thesame KDF hash algorithm as that used to establish the original connection.

Clients MUST only resume if the new SNI value is valid for the servercertificate presented in the original session, and SHOULD only resume ifthe SNI value matches the one used in the original session. The latteris a performance optimization: normally, there is no reason to expectthat different servers covered by a single certificate would be able toaccept each other's tickets; hence, attempting resumption in that casewould waste a single-use ticket. If such an indication is provided(externally or by any other means), clients MAY resume with a differentSNI value.

On resumption, if reporting an SNI value to the calling application,implementations MUST use the value sent in the resumption ClientHello ratherthan the value sent in the previous session. Note that if a serverimplementation declines all PSK identities with different SNI values, these twovalues are always the same.

Note: Although the resumption secret depends on the client's secondflight, a server which does not request certificate-based client authentication MAY computethe remainder of the transcript independently and then send aNewSessionTicket immediately upon sending its Finished rather thanwaiting for the client Finished. This might be appropriate in caseswhere the client is expected to open multiple TLS connections inparallel and would benefit from the reduced overhead of a resumptionhandshake, for example.

   struct {       uint32 ticket_lifetime;       uint32 ticket_age_add;       opaque ticket_nonce<0..255>;       opaque ticket<1..2^16-1>;       Extension extensions<0..2^16-1>;   } NewSessionTicket;
ticket_lifetime:

Indicates the lifetime in seconds as a 32-bit unsigned integer innetwork byte order from the time of ticket issuance.Servers MUST NOT use any value greater than 604800 seconds (7 days).The value of zero indicates that the ticket should be discardedimmediately. Clients MUST NOT use tickets for longer than7 days after issuance, regardless of the ticket_lifetime, and MAY delete ticketsearlier based on local policy. A server MAY treat a ticket as validfor a shorter period of time than what is stated in theticket_lifetime.

ticket_age_add:

A securely generated, random 32-bit value that is used to obscure the age ofthe ticket that the client includes in the "pre_shared_key" extension.The client-side ticket age is added to this value modulo 2^32 toobtain the value that is transmitted by the client.The server MUST generate a fresh value for each ticket it sends.

ticket_nonce:

A per-ticket value that is unique across all tickets issued on this connection.

ticket:

The value of the ticket to be used as the PSK identity.The ticket itself is an opaque label. It MAY be either a databaselookup key or a self-encrypted and self-authenticated value.

extensions:

A list of extension values for the ticket. The "Extension"format is defined inSection 4.2. Clients MUST ignoreunrecognized extensions.

The sole extension currently defined for NewSessionTicket is"early_data", indicating that the ticket may be used to send 0-RTT data(Section 4.2.10). It contains the following value:

max_early_data_size:

The maximum amount of 0-RTT data that the client is allowed to send when usingthis ticket, in bytes. Only Application Data payload (i.e., plaintext butnot padding or the inner content type byte) is counted. A serverreceiving more than max_early_data_size bytes of 0-RTT dataSHOULD terminate the connection with an "unexpected_message" alert.Note that servers that reject early data due to lack of cryptographic materialwill be unable to differentiate padding from content, so clients SHOULD NOTdepend on being able to send large quantities of padding in early data records.

The PSK associated with the ticket is computed as:

    HKDF-Expand-Label(resumption_secret,                      "resumption", ticket_nonce, Hash.length)

Because the ticket_nonce value is distinct for each NewSessionTicketmessage, a different PSK will be derived for each ticket.

Note that in principle it is possible to continue issuing new ticketswhich indefinitely extend the lifetime of the keyingmaterial originally derived from an initial non-PSK handshake (whichwas most likely tied to the peer's certificate). It is RECOMMENDEDthat implementations place limits on the total lifetime of such keyingmaterial; these limits should take into account the lifetime of thepeer's certificate, the likelihood of intervening revocation,and the time since the peer's online CertificateVerify signature.

4.6.2.Post-Handshake Authentication

When the client has sent the "post_handshake_auth" extension (seeSection 4.2.6), a server MAY request certificate-based client authentication at any timeafter the handshake has completed by sending a CertificateRequest message. Theclient MUST respond with the appropriate Authentication messages (seeSection 4.4). If the client chooses to authenticate, it MUSTsend Certificate, CertificateVerify, and Finished. If it declines, it MUST senda Certificate message containing no certificates followed by Finished.All of the client's messages for a given responseMUST appear consecutively on the wire with no intervening messages of other types.

A client that receives a CertificateRequest message without having sentthe "post_handshake_auth" extension MUST send an "unexpected_message" fatalalert.

Note: Because certificate-based client authentication could involve prompting the user, serversMUST be prepared for some delay, including receiving an arbitrary number ofother messages between sending the CertificateRequest and receiving aresponse. In addition, clients which receive multiple CertificateRequests inclose succession MAY respond to them in a different order than they werereceived (the certificate_request_context value allows the server todisambiguate the responses).

4.6.3.Key and Initialization Vector Update

The KeyUpdate handshake message is used to indicate that the sender isupdating its sending cryptographic keys. This message can be sent byeither peer after it has sent a Finished message.Implementations that receive a KeyUpdate message prior to receiving a Finished messageMUST terminate the connection with an "unexpected_message" alert.After sending a KeyUpdate message, the sender SHALL send all its traffic using thenext generation of keys, computed as described inSection 7.2.Upon receiving a KeyUpdate, the receiver MUST update its receiving keys.

   enum {       update_not_requested(0), update_requested(1), (255)   } KeyUpdateRequest;   struct {       KeyUpdateRequest request_update;   } KeyUpdate;
request_update:

Indicates whether the recipient of the KeyUpdate should respond with itsown KeyUpdate. If an implementation receives any other value, it MUSTterminate the connection with an "illegal_parameter" alert.

If the request_update field is set to "update_requested", then the receiver MUSTsend a KeyUpdate of its own with request_update set to "update_not_requested" priorto sending its next Application Data record. This mechanism allows either side to force an update to theentire connection, but causes an implementation whichreceives multiple KeyUpdates while it is silent to respond witha single update. Note that implementations may receive an arbitrarynumber of messages between sending a KeyUpdate with request_update setto "update_requested" and receiving thepeer's KeyUpdate, because those messages may already be in flight.However, because send and receive keys are derived from independenttraffic secrets, retaining the receive traffic secret does not threatenthe forward secrecy of data sent before the sender changed keys.

If implementations independently send their own KeyUpdates withrequest_update set to "update_requested", and they cross in flight, then each sidewill also send a response, with the result that each side incrementsby two generations.

Both sender and receiver MUST encrypt their KeyUpdatemessages with the old keys. Additionally, both sides MUST enforce thata KeyUpdate with the old key is received before accepting any messagesencrypted with the new key. Failure to do so may allow message truncationattacks.

5.Record Protocol

The TLS record protocol takes messages to be transmitted, fragmentsthe data into manageable blocks, protects the records, and transmitsthe result. Received data is verified, decrypted, reassembled, andthen delivered to higher-level clients.

TLS records are typed, which allows multiple higher-level protocols tobe multiplexed over the same record layer. This document specifiesfour content types: handshake, application_data, alert, andchange_cipher_spec.The change_cipher_spec record is used only for compatibility purposes(seeAppendix E.4).

An implementation may receive an unencrypted record of typechange_cipher_spec consisting of the single byte value 0x01 at anytime after the first ClientHello message has been sent or received and beforethe peer's Finished message has been received and MUST simply drop it withoutfurther processing. Note that this record may appear at a point at thehandshake where the implementation is expecting protected records,and so it is necessary to detect thiscondition prior to attempting to deprotect the record. Animplementation which receives any other change_cipher_spec value orwhich receives a protected change_cipher_spec record MUST abort thehandshake with an "unexpected_message" alert. If an implementation detectsa change_cipher_spec recordreceived before the first ClientHello message or after the peer's Finishedmessage, it MUST be treated as an unexpected record type (though statelessservers may not be able to distinguish these cases from allowed cases).

Implementations MUST NOT send record types not defined in thisdocument unless negotiated by some extension. If a TLS implementationreceives an unexpected record type, it MUST terminate the connectionwith an "unexpected_message" alert. New record content type valuesare assigned by IANA in the TLS ContentType registry as described inSection 11.

5.1.Record Layer

The record layer fragments information blocks into TLSPlaintextrecords carrying data in chunks of 2^14 bytes or less. Messageboundaries are handled differently depending on the underlyingContentType. Any future content types MUST specify appropriaterules.Note that these rules are stricter than what was enforced in TLS 1.2.

Handshake messages MAY be coalesced into a single TLSPlaintextrecord or fragmented across several records, provided that:

  • Handshake messages MUST NOT be interleaved with other recordtypes. That is, if a handshake message is split over two or morerecords, there MUST NOT be any other records between them.
  • Handshake messages MUST NOT span key changes. Implementations MUST verify thatall messages immediately preceding a key change align with a record boundary;if not, then they MUST terminate the connection with an "unexpected_message"alert. Because the ClientHello, EndOfEarlyData, ServerHello, Finished, andKeyUpdate messages can immediately precede a key change, implementations MUSTsend these messages in alignment with a record boundary.

Implementations MUST NOT send zero-length fragments of Handshaketypes, even if those fragments contain padding.

Alert messages (Section 6) MUST NOT be fragmented acrossrecords, and multiple alert messages MUST NOT be coalesced into asingle TLSPlaintext record. In other words, a record with an Alerttype MUST contain exactly one message.

Application Data messages contain data that is opaque toTLS. Application Data messages are always protected. Zero-lengthfragments of Application Data MAY be sent, as they are potentiallyuseful as a traffic analysis countermeasure. Application Data fragmentsMAY be split across multiple records or coalesced into a single record.

   enum {       invalid(0),       change_cipher_spec(20),       alert(21),       handshake(22),       application_data(23),       (255)   } ContentType;   struct {       ContentType type;       ProtocolVersion legacy_record_version;       uint16 length;       opaque fragment[TLSPlaintext.length];   } TLSPlaintext;
type:

The higher-level protocol used to process the enclosed fragment.

legacy_record_version:

MUST be set to 0x0303 for all records generated by aTLS 1.3 implementation other than an initial ClientHello (i.e., onenot generated after a HelloRetryRequest), where itMAY also be 0x0301 for compatibility purposes.This field is deprecated and MUST be ignored for all purposes.Previous versions of TLS would use other values in this fieldunder some circumstances.

length:

The length (in bytes) of the following TLSPlaintext.fragment. Thelength MUST NOT exceed 2^14 bytes. An endpoint that receives a recordthat exceeds this length MUST terminate the connection with a"record_overflow" alert.

fragment

The data being transmitted. This value is transparent and is treated as anindependent block to be dealt with by the higher-level protocolspecified by the type field.

This document describes TLS 1.3, which uses the version 0x0304.This version value is historical, deriving from the use of 0x0301for TLS 1.0 and 0x0300 for SSL 3.0. In order to maximize backwardcompatibility, a record containing an initial ClientHello SHOULD have version0x0301 (reflecting TLS 1.0) and a record containing a second ClientHello ora ServerHello MUST have version0x0303 (reflecting TLS 1.2).When negotiating prior versions of TLS, endpointsfollow the procedure and requirements provided inAppendix E.

When record protection has not yet been engaged, TLSPlaintextstructures are written directly onto the wire. Once record protectionhas started, TLSPlaintext records are protected and sent asdescribed in the following section. Note that Application Datarecords MUST NOT be written to the wire unprotected (seeSection 2 for details).

5.2.Record Payload Protection

The record protection functions translate a TLSPlaintext structure into aTLSCiphertext structure. The deprotection functions reverse the process. In TLS 1.3,as opposed to previous versions of TLS, all ciphers are modeled as"Authenticated Encryption with Associated Data" (AEAD)[RFC5116].AEAD functions provide a unified encryption and authenticationoperation which turns plaintext into authenticated ciphertext andback again. Each encrypted record consists of a plaintext header followedby an encrypted body, which itself contains a type and optional padding.

   struct {       opaque content[TLSPlaintext.length];       ContentType type;       uint8 zeros[length_of_padding];   } TLSInnerPlaintext;   struct {       ContentType opaque_type = application_data; /* 23 */       ProtocolVersion legacy_record_version = 0x0303; /* TLS v1.2 */       uint16 length;       opaque encrypted_record[TLSCiphertext.length];   } TLSCiphertext;
content:

The TLSPlaintext.fragment value, containing the byte encoding of ahandshake or an alert message, or the raw bytes of the application'sdata to send.

type:

The TLSPlaintext.type value containing the content type of the record.

zeros:

An arbitrary-length run of zero-valued bytes mayappear in the cleartext after the type field. This provides anopportunity for senders to pad any TLS record by a chosen amount aslong as the total stays within record size limits. SeeSection 5.4 for more details.

opaque_type:

The outer opaque_type field of a TLSCiphertext record is always set to thevalue 23 (application_data) for outward compatibility withmiddleboxes accustomed to parsing previous versions of TLS. Theactual content type of the record is found in TLSInnerPlaintext.type afterdecryption.

legacy_record_version:

The legacy_record_version field is always 0x0303. TLS 1.3 TLSCiphertextsare not generated until after TLS 1.3 has been negotiated, so there areno historical compatibility concerns where other values might be received.Note that the handshake protocol, including the ClientHello and ServerHellomessages, authenticates the protocol version, so this value is redundant.

length:

The length (in bytes) of the following TLSCiphertext.encrypted_record, whichis the sum of the lengths of the content and the padding, plus onefor the inner content type, plus any expansion added by the AEAD algorithm.The length MUST NOT exceed 2^14 + 256 bytes.An endpoint that receives a record that exceeds this length MUSTterminate the connection with a "record_overflow" alert.

encrypted_record:

The AEAD-encrypted form of the serialized TLSInnerPlaintext structure.

AEAD algorithms take as input a single key, a nonce, a plaintext, and "additionaldata" to be included in the authentication check, as described in Section 2.1of[RFC5116]. The key is either the client_write_key or the server_write_key,the nonce is derived from the sequence number and theclient_write_iv or server_write_iv (seeSection 5.3), and the additional data input is therecord header. I.e.,

   additional_data = TLSCiphertext.opaque_type ||                     TLSCiphertext.legacy_record_version ||                     TLSCiphertext.length

The plaintext input to the AEAD algorithm is the encoded TLSInnerPlaintext structure.Derivation of traffic keys is defined inSection 7.3.

The AEAD output consists of the ciphertext output from the AEADencryption operation. The length of the plaintext is greater than thecorresponding TLSPlaintext.length due to the inclusion of TLSInnerPlaintext.type andany padding supplied by the sender. The length of theAEAD output will generally be larger than the plaintext, but by anamount that varies with the AEAD algorithm. Since the ciphers mightincorporate padding, the amount of overhead could vary with differentlengths of plaintext. Symbolically,

   AEADEncrypted =       AEAD-Encrypt(write_key, nonce, additional_data, plaintext)

The encrypted_record field of TLSCiphertext is set to AEADEncrypted.

In order to decrypt and verify, the cipher takes as input the key, nonce,additional data, and the AEADEncrypted value. The output is either the plaintextor an error indicating that the decryption failed. There is no separateintegrity check. Symbolically,

   plaintext of encrypted_record =       AEAD-Decrypt(peer_write_key, nonce, additional_data, AEADEncrypted)

If the decryption fails, the receiver MUST terminate the connectionwith a "bad_record_mac" alert.

An AEAD algorithm used in TLS 1.3 MUST NOT produce an expansion greater than255 octets. An endpoint that receives a record from its peer withTLSCiphertext.length larger than 2^14 + 256 octets MUST terminatethe connection with a "record_overflow" alert.This limit is derived from the maximum TLSInnerPlaintext length of2^14 octets + 1 octet for ContentType + the maximum AEAD expansion of 255 octets.

5.3.Per-Record Nonce

A 64-bit sequence number is maintained separately for reading and writingrecords. The appropriate sequence number is incremented by one afterreading or writing each record. Each sequence number is set to zeroat the beginning of a connection and whenever the key is changed; thefirst record transmitted under a particular traffic key MUST usesequence number 0.

Because the size of sequence numbers is 64-bit, they should notwrap. If a TLS implementation would need towrap a sequence number, it MUST either rekey (Section 4.6.3) orterminate the connection.

Each AEAD algorithm will specify a range of possible lengths for theper-record nonce, from N_MIN bytes to N_MAX bytes of input[RFC5116].The length of the TLS per-record nonce (iv_length) is set to the larger of8 bytes and N_MIN for the AEAD algorithm (see[RFC5116], Section 4).An AEAD algorithm where N_MAX is less than 8 bytes MUST NOT be used with TLS.The per-record nonce for the AEAD construction is formed as follows:

  1. The 64-bit record sequence number is encoded in network byte orderand padded to the left with zeros to iv_length.
  2. The padded sequence number is XORed with either the static client_write_ivor server_write_iv (depending on the role).

The resulting quantity (of length iv_length) is used as the per-record nonce.

Note: This is a different construction from that in TLS 1.2, whichspecified a partially explicit nonce.

5.4.Record Padding

All encrypted TLS records can be padded to inflate the size of theTLSCiphertext. This allows the sender to hide the size of thetraffic from an observer.

When generating a TLSCiphertext record, implementations MAY choose to pad.An unpadded record is just a record with a padding length of zero.Padding is a string of zero-valued bytes appended to the ContentTypefield before encryption. Implementations MUST set the padding octetsto all zeros before encrypting.

Application Data records may contain a zero-length TLSInnerPlaintext.content ifthe sender desires. This permits generation of plausibly sized covertraffic in contexts where the presence or absence of activity may besensitive. Implementations MUST NOT send Handshake and Alert recordsthat have a zero-length TLSInnerPlaintext.content; if such a messageis received, the receiving implementation MUST terminate the connectionwith an "unexpected_message" alert.

The padding sent is automatically verified by the record protectionmechanism; upon successful decryption of a TLSCiphertext.encrypted_record,the receiving implementation scans the field from the end toward thebeginning until it finds a non-zero octet. This non-zero octet is thecontent type of the message.This padding scheme was selected because it allows padding of any encryptedTLS record by an arbitrary size (from zero up to TLS record sizelimits) without introducing new content types. The design alsoenforces all-zero padding octets, which allows for quick detection ofpadding errors.

Implementations MUST limit their scanning to the cleartext returnedfrom the AEAD decryption. If a receiving implementation does not finda non-zero octet in the cleartext, it MUST terminate theconnection with an "unexpected_message" alert.

The presence of padding does not change the overall record size limitations:the full encoded TLSInnerPlaintext MUST NOT exceed 2^14 + 1 octets. If themaximum fragment length is reduced -- as for example by the record_size_limitextension from[RFC8449] -- then the reduced limit applies to the full plaintext,including the content type and padding.

Selecting a padding policy that suggests when and how much to pad is acomplex topic and is beyond the scope of this specification. If theapplication-layer protocol on top of TLS has its own padding, it may bepreferable to pad Application Data TLS records within the applicationlayer. Padding for encrypted Handshake or Alert records muststill be handled at the TLS layer, though. Later documents may definepadding selection algorithms or define a padding policy requestmechanism through TLS extensions or some other means.

5.5.Limits on Key Usage

There are cryptographic limits on the amount of plaintext which can besafely encrypted under a given set of keys.[AEAD-LIMITS] providesan analysis of these limits under the assumption that the underlyingprimitive (AES or ChaCha20) has no weaknesses. Implementations SHOULDdo a key update as described inSection 4.6.3 prior to reaching these limits.

For AES-GCM, up to 2^24.5 full-size records (about 24 million)may be encrypted on a given connection while keeping a safetymargin of approximately 2^-57 for Authenticated Encryption (AE) security.For ChaCha20/Poly1305, the record sequence number would wrap before thesafety limit is reached.

6.Alert Protocol

TLS provides an Alert content type to indicate closure informationand errors. Like other messages, alert messages are encrypted asspecified by the current connection state.

Alert messages convey a description of the alert and a legacy fieldthat conveyed the severity level of the message in previous versions ofTLS. Alerts are divided intotwo classes: closure alerts and error alerts. In TLS 1.3, theseverity is implicit in the type of alertbeing sent, and the "level" field can safely be ignored. The "close_notify" alertis used to indicate orderly closure of one direction of the connection.Upon receiving such an alert, the TLS implementation SHOULDindicate end-of-data to the application.

Error alerts indicate abortive closure of theconnection (seeSection 6.2). Upon receiving an error alert,the TLS implementation SHOULD indicate an error to the application andMUST NOT allow any further data to be sent or received on theconnection. Servers and clients MUST forget the secret values andkeys established in failed connections, with the exception ofthe PSKs associated with session tickets, which SHOULD be discarded ifpossible.

All the alerts listed inSection 6.2 MUST be sent withAlertLevel=fatal and MUST be treated as error alerts when receivedregardless of the AlertLevel in themessage. Unknown Alert types MUST be treated as error alerts.

Note: TLS defines two generic alerts (seeSection 6) to useupon failure to parse a message. Peers which receive a message whichcannot be parsed according to the syntax (e.g., have a lengthextending beyond the message boundary or contain an out-of-rangelength) MUST terminate the connection with a "decode_error"alert. Peers which receive a message which is syntactically correctbut semantically invalid (e.g., a DHE share of p - 1, or an invalidenum) MUST terminate the connection with an "illegal_parameter" alert.

   enum { warning(1), fatal(2), (255) } AlertLevel;   enum {       close_notify(0),       unexpected_message(10),       bad_record_mac(20),       record_overflow(22),       handshake_failure(40),       bad_certificate(42),       unsupported_certificate(43),       certificate_revoked(44),       certificate_expired(45),       certificate_unknown(46),       illegal_parameter(47),       unknown_ca(48),       access_denied(49),       decode_error(50),       decrypt_error(51),       protocol_version(70),       insufficient_security(71),       internal_error(80),       inappropriate_fallback(86),       user_canceled(90),       missing_extension(109),       unsupported_extension(110),       unrecognized_name(112),       bad_certificate_status_response(113),       unknown_psk_identity(115),       certificate_required(116),       no_application_protocol(120),       (255)   } AlertDescription;   struct {       AlertLevel level;       AlertDescription description;   } Alert;

6.1.Closure Alerts

The client and the server must share knowledge that the connection is ending inorder to avoid a truncation attack.

close_notify:

This alert notifies the recipient that the sender will not sendany more messages on this connection. Any data received after aclosure alert has been received MUST be ignored.

user_canceled:

This alert notifies the recipient that the sender is canceling thehandshake for some reason unrelated to a protocol failure. If a usercancels an operation after the handshake is complete, just closing theconnection by sending a "close_notify" is more appropriate. This alertSHOULD be followed by a "close_notify". This alert generallyhas AlertLevel=warning.

Either party MAY initiate a close of its write side of the connection bysending a "close_notify" alert. Any data received after a closure alert hasbeen received MUST be ignored. If a transport-level close is received priorto a "close_notify", the receiver cannot know that all the data that was senthas been received.

Each party MUST send a "close_notify" alert before closing its write sideof the connection, unless it has already sent some error alert. Thisdoes not have any effect on its read side of the connection. Note that this isa change from versions of TLS prior to TLS 1.3 in which implementations wererequired to react to a "close_notify" by discarding pending writes andsending an immediate "close_notify" alert of their own. That previousrequirement could cause truncation in the read side. Both parties need notwait to receive a "close_notify" alert before closing their read side of theconnection, though doing so would introduce the possibility of truncation.

If the application protocol using TLS provides that any data may be carriedover the underlying transport after the TLS connection is closed, the TLSimplementation MUST receive a "close_notify" alert before indicatingend-of-data to the application layer. No part of thisstandard should be taken to dictate the manner in which a usage profile for TLSmanages its data transport, including when connections are opened or closed.

Note: It is assumed that closing the write side of a connection reliablydelivers pending data before destroying the transport.

6.2.Error Alerts

Error handling in TLS is very simple. When anerror is detected, the detecting party sends a message to itspeer. Upon transmission or receipt of a fatal alert message, bothparties MUST immediately close the connection.

Whenever an implementation encounters a fatal error condition, itSHOULD send an appropriate fatal alert and MUST close the connectionwithout sending or receiving any additional data. Throughout thisspecification, when the phrases "terminate the connection" and "abort thehandshake" are used without a specific alert it means that theimplementation SHOULD send the alert indicated by the descriptionsbelow. The phrases "terminate the connection with an X alert" and"abort the handshake with an X alert" mean that the implementationMUST send alert X if it sends any alert. Allalerts defined below in this section, as well as all unknown alerts,are universally considered fatal as of TLS 1.3 (seeSection 6).The implementation SHOULD provide a way to facilitate loggingthe sending and receiving of alerts.

The following error alerts are defined:

unexpected_message:

An inappropriate message (e.g., the wrong handshake message, prematureApplication Data, etc.) was received. This alert should never beobserved in communication between proper implementations.

bad_record_mac:

This alert is returned if a record is received which cannot bedeprotected. Because AEAD algorithms combine decryption andverification, and also to avoid side-channel attacks,this alert is used for all deprotection failures.This alert should never be observed in communication betweenproper implementations, except when messages were corruptedin the network.

record_overflow:

A TLSCiphertext record was received that had a length more than2^14 + 256 bytes, or a record decrypted to a TLSPlaintext recordwith more than 2^14 bytes (or some other negotiated limit).This alert should never be observed in communication betweenproper implementations, except when messages were corruptedin the network.

handshake_failure:

Receipt of a "handshake_failure" alert message indicates that thesender was unable to negotiate an acceptable set of securityparameters given the options available.

bad_certificate:

A certificate was corrupt, contained signatures that did notverify correctly, etc.

unsupported_certificate:

A certificate was of an unsupported type.

certificate_revoked:

A certificate was revoked by its signer.

certificate_expired:

A certificate has expired or is not currently valid.

certificate_unknown:

Some other (unspecified) issue arose in processing thecertificate, rendering it unacceptable.

illegal_parameter:

A field in the handshake was incorrect or inconsistent withother fields. This alert is used for errors which conform tothe formal protocol syntax but are otherwise incorrect.

unknown_ca:

A valid certificate chain or partial chain was received, but thecertificate was not accepted because the CA certificate could notbe located or could not be matched with a known trust anchor.

access_denied:

A valid certificate or PSK was received, but when access control wasapplied, the sender decided not to proceed with negotiation.

decode_error:

A message could not be decoded because some field was out of thespecified range or the length of the message was incorrect.This alert is used for errors where the message does not conformto the formal protocol syntax.This alert should never be observed in communication betweenproper implementations, except when messages were corruptedin the network.

decrypt_error:

A handshake (not record layer) cryptographic operation failed, including being unableto correctly verify a signature or validate a Finished messageor a PSK binder.

protocol_version:

The protocol version the peer has attempted to negotiate isrecognized but not supported (seeAppendix E).

insufficient_security:

Returned instead of "handshake_failure" when a negotiation hasfailed specifically because the server requires parameters moresecure than those supported by the client.

internal_error:

An internal error unrelated to the peer or the correctness of theprotocol (such as a memory allocation failure) makes it impossibleto continue.

inappropriate_fallback:

Sent by a server in response to an invalid connection retry attemptfrom a client (see[RFC7507]).

missing_extension:

Sent by endpoints that receive a handshake message not containing anextension that is mandatory to send for the offered TLS versionor other negotiated parameters.

unsupported_extension:

Sent by endpoints receiving any handshake message containing an extensionknown to be prohibited for inclusion in the given handshake message, or includingany extensions in a ServerHello or Certificate not first offered in thecorresponding ClientHello or CertificateRequest.

unrecognized_name:

Sent by servers when no server exists identified by the nameprovided by the client via the "server_name" extension(see[RFC6066]).

bad_certificate_status_response:

Sent by clients when an invalid or unacceptable OCSP response isprovided by the server via the "status_request" extension(see[RFC6066]).

unknown_psk_identity:

Sent by servers when PSK key establishment is desired but no acceptable PSK identity is provided by the client. Sending this alert is OPTIONAL; servers MAY instead choose to send a "decrypt_error" alert to merely indicate an invalid PSK identity.

certificate_required:

Sent by servers when a client certificate is desired but none was provided bythe client.

no_application_protocol:

Sent by servers when a client"application_layer_protocol_negotiation" extension advertisesonly protocols that the server does not support(see[RFC7301]).

New Alert values are assigned by IANA as described inSection 11.

7.Cryptographic Computations

The TLS handshake establishes one or more input secrets whichare combined to create the actual working keying material, as detailedbelow. The key derivation process incorporates both the input secretsand the handshake transcript. Note that because the handshaketranscript includes the random values from the Hello messages,any given handshake will have different traffic secrets, evenif the same input secrets are used, as is the case whenthe same PSK is used for multiple connections.

7.1.Key Schedule

The key derivation process makes use of the HKDF-Extract and HKDF-Expandfunctions as defined for HKDF[RFC5869], as well as the functionsdefined below:

    HKDF-Expand-Label(Secret, Label, Context, Length) =         HKDF-Expand(Secret, HkdfLabel, Length)    Where HkdfLabel is specified as:    struct {        uint16 length = Length;        opaque label<7..255> = "tls13 " + Label;        opaque context<0..255> = Context;    } HkdfLabel;    Derive-Secret(Secret, Label, Messages) =         HKDF-Expand-Label(Secret, Label,                           Transcript-Hash(Messages), Hash.length)

The Hash function used by Transcript-Hash and HKDF is the cipher suite hashalgorithm.Hash.length is its output length in bytes. Messages is the concatenation of theindicated handshake messages, including the handshake message typeand length fields, but not including record layer headers. Note thatin some cases a zero-length Context (indicated by "") is passed toHKDF-Expand-Label. The labels specified in this document are allASCII strings and do not include a trailing NUL byte.

Note: With common hash functions, any label longer than 12 charactersrequires an additional iteration of the hash function to compute.The labels in this specification have all been chosen to fit withinthis limit.

Keys are derived from two input secrets usingthe HKDF-Extract and Derive-Secret functions. The general patternfor adding a new secret is to use HKDF-Extract with the Saltbeing the current secret state and the Input Keying Material (IKM) being the newsecret to be added. In this version of TLS 1.3, the twoinput secrets are:

  • PSK (a pre-shared key established externally or derived fromthe resumption_secret value from a previous connection)
  • (EC)DHE shared secret (Section 7.4)

This produces a full key derivation schedule shown in the diagram below.In this diagram, the following formatting conventions apply:

  • HKDF-Extract is drawn as taking the Salt argument from the top andthe IKM argument from the left, with its output to the bottom andthe name of the output on the right.
  • Derive-Secret's Secret argument is indicated by the incomingarrow. For instance, the Early Secret is the Secret forgenerating the client_early_traffic_secret.
  • "0" indicates a string of Hash.length bytes set to zero.

Note: the key derivation labels use the string "master" even thoughthe values are referred to as "main" secrets. This mismatch is aresult of renaming the values while retaining compatibility.

[[OPEN ISSUE: Replace the strings with hex value?]]

                 0                 |                 v   PSK ->  HKDF-Extract = Early Secret                 |                 +-----> Derive-Secret(.,                 |                     "ext binder" |                 |                     "res binder",                 |                     "")                 |                     = binder_key                 |                 +-----> Derive-Secret(., "c e traffic",                 |                     ClientHello)                 |                     = client_early_traffic_secret                 |                 +-----> Derive-Secret(., "e exp master",                 |                     ClientHello)                 |                     = early_exporter_secret                 v           Derive-Secret(., "derived", "")                 |                 v(EC)DHE -> HKDF-Extract = Handshake Secret                 |                 +-----> Derive-Secret(., "c hs traffic",                 |                     ClientHello...ServerHello)                 |                     = client_handshake_traffic_secret                 |                 +-----> Derive-Secret(., "s hs traffic",                 |                     ClientHello...ServerHello)                 |                     = server_handshake_traffic_secret                 v           Derive-Secret(., "derived", "")                 |                 v      0 -> HKDF-Extract = Main Secret                 |                 +-----> Derive-Secret(., "c ap traffic",                 |                     ClientHello...server Finished)                 |                     = client_application_traffic_secret_0                 |                 +-----> Derive-Secret(., "s ap traffic",                 |                     ClientHello...server Finished)                 |                     = server_application_traffic_secret_0                 |                 +-----> Derive-Secret(., "exp master",                 |                     ClientHello...server Finished)                 |                     = exporter_secret                 |                 +-----> Derive-Secret(., "res master",                                       ClientHello...client Finished)                                       = resumption_secret

The general pattern here is that the secrets shown down the left sideof the diagram are just raw entropy without context, whereas thesecrets down the right side include Handshake Context and thereforecan be used to derive working keys without additional context.Note that the differentcalls to Derive-Secret may take different Messages arguments,even with the same secret. In a 0-RTT exchange, Derive-Secret iscalled with four distinct transcripts; in a 1-RTT-only exchange,it is called with three distinct transcripts.

If a given secret is not available, then the 0-value consisting ofa string of Hash.length bytes set to zeros is used. Note that this does not mean skippingrounds, so if PSK is not in use, Early Secret will still beHKDF-Extract(0, 0). For the computation of the binder_key, the label is"ext binder" for external PSKs (those provisioned outside of TLS)and "res binder" for resumption PSKs (those provisioned as the resumptionsecret of a previous handshake). The different labels preventthe substitution of one type of PSK for the other.

There are multiple potential Early Secret values, depending onwhich PSK the server ultimately selects. The client will need to computeone for each potential PSK; if no PSK is selected, it will then need tocompute the Early Secret corresponding to the zero PSK.

Once all the values which are to be derived from a given secret havebeen computed, that secret SHOULD be erased.

7.2.Updating Traffic Secrets

Once the handshake is complete, it is possible for either side toupdate its sending traffic keys using the KeyUpdate handshake messagedefined inSection 4.6.3. The next generation of traffic keys is computed bygenerating client_/server_application_traffic_secret_N+1 fromclient_/server_application_traffic_secret_N as described inthis section and then re-deriving the traffic keys as described inSection 7.3.

The next-generation application_traffic_secret is computed as:

    application_traffic_secret_N+1 =        HKDF-Expand-Label(application_traffic_secret_N,                          "traffic upd", "", Hash.length)

Once client_/server_application_traffic_secret_N+1 and its associatedtraffic keys have been computed, implementations SHOULD deleteclient_/server_application_traffic_secret_N and its associated traffic keys.

7.3.Traffic Key Calculation

The traffic keying material is generated from the following input values:

  • A secret value
  • A purpose value indicating the specific value being generated
  • The length of the key being generated

The traffic keying material is generated from an input traffic secret value using:

    [sender]_write_key = HKDF-Expand-Label(Secret, "key", "", key_length)    [sender]_write_iv  = HKDF-Expand-Label(Secret, "iv", "", iv_length)

[sender] denotes the sending side. The value of Secret for each record typeis shown in the table below.

Table 3:Secrets for Traffic Keys
Record TypeSecret
0-RTT Applicationclient_early_traffic_secret
Handshake[sender]_handshake_traffic_secret
Application Data[sender]_application_traffic_secret_N

All the traffic keying material is recomputed whenever theunderlying Secret changes (e.g., when changing from the handshake toApplication Data keys or upon a key update).

7.4.(EC)DHE Shared Secret Calculation

7.4.1.Finite Field Diffie-Hellman

For finite field groups, a conventional Diffie-Hellman[DH76] computation is performed.The negotiated key (Z) is converted to a byte string by encoding in big-endian form andleft-padded with zeros up to the size of the prime. This byte string is used as theshared secret in the key schedule as specified above.

Note that this construction differs from previous versions of TLS which removeleading zeros.

7.4.2.Elliptic Curve Diffie-Hellman

For secp256r1, secp384r1 and secp521r1, ECDH calculations (including parameterand key generation as well as the shared secret calculation) areperformed according to[IEEE1363] using the ECKAS-DH1 scheme with the identitymap as the key derivation function (KDF), so that the shared secret is thex-coordinate of the ECDH shared secret elliptic curve point representedas an octet string. Note that this octet string ("Z" in IEEE 1363 terminology)as output by FE2OSP (the Field Element to Octet String ConversionPrimitive) has constant length for any given field; leading zerosfound in this octet string MUST NOT be truncated.

(Note that this use of the identity KDF is a technicality. Thecomplete picture is that ECDH is employed with a non-trivial KDFbecause TLS does not directly use this secret for anythingother than for computing other secrets.)

For X25519 and X448, the ECDH calculations are as follows:

  • The public key to put into the KeyShareEntry.key_exchange structure is theresult of applying the ECDH scalar multiplication function to the secret keyof appropriate length (into scalar input) and the standard public basepoint(into u-coordinate point input).
  • The ECDH shared secret is the result of applying the ECDH scalar multiplicationfunction to the secret key (into scalar input) and the peer's public key(into u-coordinate point input). The output is used raw, with no processing.

For these curves, implementations SHOULD use the approach specifiedin[RFC7748] to calculate the Diffie-Hellman shared secret.Implementations MUST check whether the computed Diffie-Hellmanshared secret is the all-zero value and abort if so, as described inSection 6 of[RFC7748]. If implementors use an alternativeimplementation of these elliptic curves, they SHOULD perform theadditional checks specified in Section 7 of[RFC7748].

7.5.Exporters

[RFC5705] defines keying material exporters for TLS in terms of the TLSpseudorandom function (PRF). This document replaces the PRF with HKDF, thusrequiring a new construction. The exporter interface remains the same.

The exporter value is computed as:

TLS-Exporter(label, context_value, key_length) =    HKDF-Expand-Label(Derive-Secret(Secret, label, ""),                      "exporter", Hash(context_value), key_length)

Where Secret is either the early_exporter_secret or theexporter_secret. Implementations MUST use the exporter_secret unlessexplicitly specified by the application. The early_exporter_secret isdefined for use in settings where an exporter is needed for 0-RTT data.A separate interface for the early exporter is RECOMMENDED; this avoidsthe exporter user accidentally using an early exporter when a regularone is desired or vice versa.

If no context is provided, the context_value is zero length. Consequently,providing no context computes the same value as providing an empty context.This is a change from previous versions of TLS where an empty context produced adifferent output than an absent context. As of this document's publication, noallocated exporter label is used both with and without a context. Futurespecifications MUST NOT define a use of exporters that permit both an emptycontext and no context with the same label. New uses of exporters SHOULD providea context in all exporter computations, though the value could be empty.

Requirements for the format of exporter labels are defined in Section 4of[RFC5705].

8.0-RTT and Anti-Replay

As noted inSection 2.3 andAppendix F.5, TLS does not provide inherent replayprotections for 0-RTT data. There are two potential threats to beconcerned with:

  • Network attackers who mount a replay attack by simply duplicating aflight of 0-RTT data.
  • Network attackers who take advantage of client retry behaviorto arrange for the server to receive multiple copies of an applicationmessage. This threat already existsto some extent because clients that value robustness respond to network errors byattempting to retry requests. However, 0-RTT adds an additionaldimension for any server system which does not maintain globallyconsistent server state. Specifically, if a server system hasmultiple zones where tickets from zone A will not be accepted inzone B, then an attacker can duplicate a ClientHello and earlydata intended for A to both A and B. At A, the data willbe accepted in 0-RTT, but at B the server will reject 0-RTTdata and instead force a full handshake. If the attacker blocksthe ServerHello from A, then the client will complete thehandshake with B and probably retry the request, leading to duplication onthe server system as a whole.

The first class of attack can be prevented by sharing state to guarantee thatthe 0-RTT data is accepted at most once. Servers SHOULD provide that level ofreplay safety by implementing one of the methods described in this section orby equivalent means. It is understood, however, that due to operationalconcerns not all deployments will maintain state at that level. Therefore, innormal operation, clients will not know which, if any, of these mechanismsservers actually implement and hence MUST only send early data which they deemsafe to be replayed.

In addition to the direct effects of replays, there is a class of attacks whereeven operations normally considered idempotent could be exploited by a largenumber of replays (timing attacks, resource limit exhaustion and others, asdescribed inAppendix F.5). Those can be mitigated by ensuring that every0-RTT payload can be replayed only a limited number of times. The server MUSTensure that any instance of it (be it a machine, a thread, or any other entitywithin the relevant serving infrastructure) would accept 0-RTT for the same0-RTT handshake at most once; this limits the number of replays to the number ofserver instances in the deployment. Such a guarantee can be accomplished bylocally recording data from recently received ClientHellos and rejectingrepeats, or by any other method that provides the same or a stronger guarantee.The "at most once per server instance" guarantee is a minimum requirement;servers SHOULD limit 0-RTT replays further when feasible.

The second class of attack cannot be prevented at the TLS layer andMUST be dealt with by any application. Note that any application whoseclients implement any kind of retry behavior already needs toimplement some sort of anti-replay defense.

8.1.Single-Use Tickets

The simplest form of anti-replay defense is for the server to onlyallow each session ticket to be used once. For instance, the servercan maintain a database of all outstanding valid tickets, deleting eachticket from the database as it is used. If an unknown ticket isprovided, the server would then fall back to a full handshake.

If the tickets are not self-contained but rather are database keys,and the corresponding PSKs are deleted upon use, then connections establishedusing PSKs enjoy not only anti-replay protection, but also forward secrecy onceall copies of the PSK from the database entry have been deleted.This mechanism also improves security for PSK usage when PSK is used without(EC)DHE.

Because this mechanism requires sharing the session database betweenserver nodes in environments with multiple distributed servers,it may be hard to achieve high rates of successful PSK 0-RTTconnections when compared to self-encrypted tickets. Unlikesession databases, session tickets can successfully do PSK-basedsession establishment even without consistent storage, though when0-RTT is allowed they still require consistent storage for anti-replayof 0-RTT data, as detailed in the followingsection.

8.2.Client Hello Recording

An alternative form of anti-replay is to record a unique value derivedfrom the ClientHello (generally either the random value or the PSKbinder) and reject duplicates. Recording all ClientHellos causes stateto grow without bound, but a server can instead record ClientHellos withina given time window and use the "obfuscated_ticket_age" to ensure thattickets aren't reused outside that window.

In order to implement this, when a ClientHello is received, the serverfirst verifies the PSK binder as described inSection 4.2.11. It then computes theexpected_arrival_time as described in the next section and rejects0-RTT if it is outside the recording window, falling back to the1-RTT handshake.

If the expected_arrival_time is in the window, then the serverchecks to see if it has recorded a matching ClientHello. If oneis found, it either aborts the handshake with an "illegal_parameter" alertor accepts the PSK but rejects 0-RTT. If no matching ClientHellois found, then it accepts 0-RTT and then stores the ClientHello foras long as the expected_arrival_time is inside the window.Servers MAY also implement data stores with false positives, such asBloom filters, in which case they MUST respond to apparent replay byrejecting 0-RTT but MUST NOT abort the handshake.

The server MUST derive the storage key only from validated sectionsof the ClientHello. If the ClientHello contains multiplePSK identities, then an attacker can create multiple ClientHelloswith different binder values for the less-preferred identity on theassumption that the server will not verify it (as recommendedbySection 4.2.11).I.e., if theclient sends PSKs A and B but the server prefers A, then theattacker can change the binder for B without affecting the binderfor A. If the binder for B is part of the storage key,then this ClientHello will not appear as a duplicate,which will cause the ClientHello to be accepted, and maycause side effects such as replay cache pollution, although any0-RTT data will not be decryptable because it will use differentkeys. If the validated binder or the ClientHello.randomis used as the storage key, then this attack is not possible.

Because this mechanism does not require storing all outstandingtickets, it may be easier to implement in distributed systems withhigh rates of resumption and 0-RTT, at the cost of potentiallyweaker anti-replay defense because of the difficulty of reliablystoring and retrieving the received ClientHello messages.In many such systems, it is impractical to have globallyconsistent storage of all the received ClientHellos.In this case, the best anti-replay protection is provided byhaving a single storage zone beauthoritative for a given ticket and refusing 0-RTT for thatticket in any other zone. This approach prevents simplereplay by the attacker because only one zone will accept0-RTT data. A weaker design is to implement separate storage foreach zone but allow 0-RTT in any zone. This approach limitsthe number of replays to once per zone. Application messageduplication of course remains possible with either design.

When implementations are freshly started, they SHOULDreject 0-RTT as long as any portion of their recording window overlapsthe startup time. Otherwise, they run the risk of acceptingreplays which were originally sent during that period.

Note: If the client's clock is running much faster than the server's,then a ClientHello may be received that is outside the window in thefuture, in which case it might be accepted for 1-RTT, causing a client retry,and then acceptable later for 0-RTT. This is another variant ofthe second form of attack described inSection 8.

8.3.Freshness Checks

Because the ClientHello indicates the time at which the client sentit, it is possible to efficiently determine whether a ClientHello waslikely sent reasonably recently and only accept 0-RTT for such aClientHello, otherwise falling back to a 1-RTT handshake.This is necessary for the ClientHello storage mechanismdescribed inSection 8.2 because otherwise the serverneeds to store an unlimited number of ClientHellos, and is a useful optimization forself-contained single-use tickets because it allows efficient rejection of ClientHelloswhich cannot be used for 0-RTT.

In order to implement this mechanism, a server needs to store the timethat the server generated the session ticket, offset by an estimate ofthe round-trip time between client and server. I.e.,

    adjusted_creation_time = creation_time + estimated_RTT

This value can be encoded in the ticket, thus avoiding the need tokeep state for each outstanding ticket. The server can determine theclient's view of the age of the ticket by subtracting the ticket's"ticket_age_add" value from the "obfuscated_ticket_age" parameter inthe client's "pre_shared_key" extension. The server can determine theexpected_arrival_time of the ClientHello as:

    expected_arrival_time = adjusted_creation_time + clients_ticket_age

When a new ClientHello is received, the expected_arrival_time is thencompared against the current server wall clock time and if they differby more than a certain amount, 0-RTT is rejected, though the 1-RTThandshake can be allowed to complete.

There are several potential sources of error that might causemismatches between the expected_arrival_time and the measuredtime. Variations in client and server clockrates are likely to be minimal, though potentially the absolutetimes may be off by large values.Network propagation delays are the most likely causes ofa mismatch in legitimate values for elapsed time. Both theNewSessionTicket and ClientHello messages might be retransmitted andtherefore delayed, which might be hidden by TCP. For clientson the Internet, this implies windowson the order of ten seconds to account for errors in clocks andvariations in measurements; other deployment scenariosmay have different needs. Clock skew distributions are notsymmetric, so the optimal tradeoff may involve an asymmetric rangeof permissible mismatch values.

Note that freshness checking alone is not sufficient to preventreplays because it does not detect them during the error window,which -- depending on bandwidth and system capacity -- could includebillions of replays in real-world settings. In addition, thisfreshness checking is only done at the time the ClientHello isreceived, and not when subsequent early Application Data records arereceived. After early data is accepted, records may continue to bestreamed to the server over a longer time period.

9.Compliance Requirements

9.1.Mandatory-to-Implement Cipher Suites

In the absence of an application profile standard specifying otherwise:

A TLS-compliant application MUST implement the TLS_AES_128_GCM_SHA256[GCM]cipher suite and SHOULD implement the TLS_AES_256_GCM_SHA384[GCM] andTLS_CHACHA20_POLY1305_SHA256[RFC8439] cipher suites (seeAppendix B.4).

A TLS-compliant application MUST support digital signatures withrsa_pkcs1_sha256 (for certificates), rsa_pss_rsae_sha256 (forCertificateVerify and certificates), and ecdsa_secp256r1_sha256. ATLS-compliant application MUST support key exchange with secp256r1(NIST P-256) and SHOULD support key exchange with X25519[RFC7748].

9.2.Mandatory-to-Implement Extensions

In the absence of an application profile standard specifying otherwise, aTLS-compliant application MUST implement the following TLS extensions:

All implementations MUST send and use these extensions when offeringapplicable features:

  • "supported_versions" is REQUIRED for all ClientHello, ServerHello, and HelloRetryRequest messages.
  • "signature_algorithms" is REQUIRED for certificate authentication.
  • "supported_groups" is REQUIRED for ClientHello messages using DHE or ECDHE key exchange.
  • "key_share" is REQUIRED for DHE or ECDHE key exchange.
  • "pre_shared_key" is REQUIRED for PSK key agreement.
  • "psk_key_exchange_modes" is REQUIRED for PSK key agreement.

A client is considered to be attempting to negotiate using thisspecification if the ClientHello contains a "supported_versions"extension with 0x0304 contained in its body.Such a ClientHello message MUST meet the following requirements:

  • If not containing a "pre_shared_key" extension, it MUST contain botha "signature_algorithms" extension and a "supported_groups" extension.
  • If containing a "supported_groups" extension, it MUST also contain a"key_share" extension, and vice versa. An empty KeyShare.client_shareslist is permitted.

Servers receiving a ClientHello which does not conform to theserequirements MUST abort the handshake with a "missing_extension"alert.

Additionally, all implementations MUST support the use of the "server_name"extension with applications capable of using it.Servers MAY require clients to send a valid "server_name" extension.Servers requiring this extension SHOULD respond to a ClientHellolacking a "server_name" extension by terminating the connection with a"missing_extension" alert.

9.3.Protocol Invariants

This section describes invariants that TLS endpoints and middleboxes MUSTfollow. It also applies to earlier versions of TLS.

TLS is designed to be securely and compatibly extensible. Newer clients orservers, when communicating with newer peers, should negotiate themost preferred common parameters. The TLS handshake provides downgradeprotection: Middleboxes passing traffic between a newer client andnewer server without terminating TLS should be unable to influence thehandshake (seeAppendix F.1). At the same time, deploymentsupdate at different rates, so a newer client or server MAY continue tosupport older parameters, which would allow it to interoperate witholder endpoints.

For this to work, implementations MUST correctly handle extensible fields:

  • A client sending a ClientHello MUST support all parameters advertised in it.Otherwise, the server may fail to interoperate by selecting one of thoseparameters.
  • A server receiving a ClientHello MUST correctly ignore all unrecognizedcipher suites, extensions, and other parameters. Otherwise, it may fail tointeroperate with newer clients. In TLS 1.3, a client receiving aCertificateRequest or NewSessionTicket MUST also ignore all unrecognizedextensions.
  • A middlebox which terminates a TLS connection MUST behave as a compliantTLS server (to the original client), including having a certificatewhich the client is willing to accept, and also as a compliant TLS client (to theoriginal server), including verifying the original server's certificate.In particular, it MUST generate its own ClientHellocontaining only parameters it understands, and it MUST generate a freshServerHello random value, rather than forwarding the endpoint's value.

    Note that TLS's protocol requirements and security analysis only apply to thetwo connections separately. Safely deploying a TLS terminator requiresadditional security considerations which are beyond the scope of this document.

  • A middlebox which forwards ClientHello parameters it does not understand MUSTNOT process any messages beyond that ClientHello. It MUST forward allsubsequent traffic unmodified. Otherwise, it may fail to interoperate withnewer clients and servers.

    Forwarded ClientHellos may contain advertisements for features not supportedby the middlebox, so the response may include future TLS additions themiddlebox does not recognize. These additions MAY change any message beyondthe ClientHello arbitrarily. In particular, the values sent in the ServerHellomight change, the ServerHello format might change, and the TLSCiphertext formatmight change.

The design of TLS 1.3 was constrained by widely deployed non-compliant TLSmiddleboxes (seeAppendix E.4); however, it does not relax the invariants.Those middleboxes continue to be non-compliant.

10.Security Considerations

Security issues are discussed throughout this memo, especially inAppendix C,Appendix E, andAppendix F.

11.IANA Considerations

[[OPEN ISSUE: Should we remove this? I am reluctant to create a situationwhere one needs to read 8446 to process this document.]]

[[OPEN ISSUE: Add some text to rename the extended_master_secret entry inthe extensions registry to extended_main_secret, after the above is resolved.]]

This document uses several registries that were originally created in[RFC4346] and updated in[RFC8447]. IANA has updated these to reference this document.The registries and their allocation policies are below:

  • TLS Cipher Suites registry: values with the first byte in the range0-254 (decimal) are assigned via Specification Required[RFC8126].Values with the first byte 255 (decimal) are reserved for PrivateUse[RFC8126].

    IANA has added the cipher suites listed inAppendix B.4 tothe registry. The "Value" and "Description" columns are taken from the table.The "DTLS-OK" and "Recommended" columns are both marked as "Y" for each newcipher suite.

  • TLS ContentType registry: Future values are allocated viaStandards Action[RFC8126].
  • TLS Alerts registry: Future values are allocated via StandardsAction[RFC8126]. IANA has populated this registrywith the values fromAppendix B.2. The"DTLS-OK" column is marked as "Y" for all such values.Values marked as "_RESERVED" have comments describing their previous usage.
  • TLS HandshakeType registry: Future values are allocated viaStandards Action[RFC8126]. IANA has updated this registryto rename item 4 from "NewSessionTicket" to "new_session_ticket"and populated this registry with the values fromAppendix B.3.The "DTLS-OK" column is marked as "Y" for all such values.Values marked "_RESERVED" have comments describing their previous ortemporary usage.

This document also uses the TLS ExtensionType Values registry originally created in[RFC4366]. IANA has updated it to reference this document. Changes to theregistry follow:

  • IANA has updated the registration policy as follows:

    Values with the first byte in the range 0-254 (decimal) are assignedvia Specification Required[RFC8126]. Values with the first byte255 (decimal) are reserved for Private Use[RFC8126].

  • IANA has updated this registry to include the"key_share", "pre_shared_key", "psk_key_exchange_modes","early_data", "cookie", "supported_versions","certificate_authorities", "oid_filters", "post_handshake_auth", and "signature_algorithms_cert" extensions with the values defined in this document and the "Recommended" value of "Y".
  • IANA has updated this registry to include a "TLS1.3" column which lists the messages in which the extension mayappear. This column has beeninitially populated from the table inSection 4.2,with any extension not listed there marked as "-" to indicate thatit is not used by TLS 1.3.

This document updates an entry in the TLS Certificate Types registryoriginally created in[RFC6091] and updated in[RFC8447]. IANA hasupdated the entry for value 1 to have the name "OpenPGP_RESERVED","Recommended" value "N", and comment "Used in TLS versions priorto 1.3." IANA has updated the entry for value 0 to have the name"X509", "Recommended" value "Y", and comment "Was X.509 before TLS 1.3".

This document updates an entry in the TLS Certificate Status Typesregistry originally created in[RFC6961]. IANA has updated the entryfor value 2 to have the name "ocsp_multi_RESERVED" and comment "Usedin TLS versions prior to 1.3".

This document updates two entries in the TLS Supported Groupsregistry (created under a different name by[RFC4492]; now maintainedby[RFC8422]) and updated by[RFC7919] and[RFC8447]. The entriesfor values 29 and 30 (x25519 and x448) have been updated to alsorefer to this document.

In addition, this document defines two new registries that are maintainedby IANA:

  • TLS SignatureScheme registry: Values with the first byte in the range0-253 (decimal) are assigned via Specification Required[RFC8126].Values with the first byte 254 or 255 (decimal) are reserved for PrivateUse[RFC8126]. Values with the first byte in the range 0-6 or with thesecond byte in the range 0-3 that are not currently allocated are reserved forbackward compatibility.This registry has a "Recommended" column.The registry has been initially populated with the values described inSection 4.2.3. The following values are marked as"Recommended": ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384,rsa_pss_rsae_sha256, rsa_pss_rsae_sha384, rsa_pss_rsae_sha512,rsa_pss_pss_sha256, rsa_pss_pss_sha384, rsa_pss_pss_sha512, and ed25519.The"Recommended" column is assigned a value of "N" unless explicitly requested, and adding a value with a "Recommended" value of "Y" requires Standards Action[RFC8126]. IESG Approval is REQUIRED for a Y->N transition.
  • TLS PskKeyExchangeMode registry: Values in therange 0-253 (decimal) are assigned via Specification Required[RFC8126]. The values 254 and 255 (decimal) arereserved for Private Use[RFC8126]. This registry has a"Recommended" column. The registry has been initiallypopulated with psk_ke (0) and psk_dhe_ke (1). Both are marked as"Recommended". The"Recommended" column is assigned a value of "N" unless explicitlyrequested, and adding a value with a "Recommended" value of "Y"requires Standards Action[RFC8126]. IESG Approval is REQUIREDfor a Y->N transition.

12.References

12.1.Normative References

[DH76]
Diffie, W. andM. Hellman,"New directions in cryptography",IEEE Transactions on Information Theory Vol. 22, pp. 644-654,DOI 10.1109/tit.1976.1055638,,<https://doi.org/10.1109/tit.1976.1055638>.
[ECDSA]
American National Standards Institute,"Public Key Cryptography for the Financial Services Industry: The Elliptic Curve Digital Signature Algorithm (ECDSA)",ANSI ANS X9.62-2005,.
[GCM]
Dworkin, M.,"Recommendation for Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC",NIST Special Publication 800-38D,.
[IEEE1363]
"IEEE Standard Specifications for Public-Key Cryptography",IEEE standard,DOI 10.1109/ieeestd.2000.92292,n.d.,<https://doi.org/10.1109/ieeestd.2000.92292>.
[RFC2104]
Krawczyk, H.,Bellare, M., andR. Canetti,"HMAC: Keyed-Hashing for Message Authentication",RFC 2104,DOI 10.17487/RFC2104,,<https://www.rfc-editor.org/info/rfc2104>.
[RFC2119]
Bradner, S.,"Key words for use in RFCs to Indicate Requirement Levels",BCP 14,RFC 2119,DOI 10.17487/RFC2119,,<https://www.rfc-editor.org/info/rfc2119>.
[RFC5116]
McGrew, D.,"An Interface and Algorithms for Authenticated Encryption",RFC 5116,DOI 10.17487/RFC5116,,<https://www.rfc-editor.org/info/rfc5116>.
[RFC5280]
Cooper, D.,Santesson, S.,Farrell, S.,Boeyen, S.,Housley, R., andW. Polk,"Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile",RFC 5280,DOI 10.17487/RFC5280,,<https://www.rfc-editor.org/info/rfc5280>.
[RFC5705]
Rescorla, E.,"Keying Material Exporters for Transport Layer Security (TLS)",RFC 5705,DOI 10.17487/RFC5705,,<https://www.rfc-editor.org/info/rfc5705>.
[RFC5756]
Turner, S.,Brown, D.,Yiu, K.,Housley, R., andT. Polk,"Updates for RSAES-OAEP and RSASSA-PSS Algorithm Parameters",RFC 5756,DOI 10.17487/RFC5756,,<https://www.rfc-editor.org/info/rfc5756>.
[RFC5869]
Krawczyk, H. andP. Eronen,"HMAC-based Extract-and-Expand Key Derivation Function (HKDF)",RFC 5869,DOI 10.17487/RFC5869,,<https://www.rfc-editor.org/info/rfc5869>.
[RFC6066]
Eastlake 3rd, D.,"Transport Layer Security (TLS) Extensions: Extension Definitions",RFC 6066,DOI 10.17487/RFC6066,,<https://www.rfc-editor.org/info/rfc6066>.
[RFC6655]
McGrew, D. andD. Bailey,"AES-CCM Cipher Suites for Transport Layer Security (TLS)",RFC 6655,DOI 10.17487/RFC6655,,<https://www.rfc-editor.org/info/rfc6655>.
[RFC6960]
Santesson, S.,Myers, M.,Ankney, R.,Malpani, A.,Galperin, S., andC. Adams,"X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP",RFC 6960,DOI 10.17487/RFC6960,,<https://www.rfc-editor.org/info/rfc6960>.
[RFC6961]
Pettersen, Y.,"The Transport Layer Security (TLS) Multiple Certificate Status Request Extension",RFC 6961,DOI 10.17487/RFC6961,,<https://www.rfc-editor.org/info/rfc6961>.
[RFC6962]
Laurie, B.,Langley, A., andE. Kasper,"Certificate Transparency",RFC 6962,DOI 10.17487/RFC6962,,<https://www.rfc-editor.org/info/rfc6962>.
[RFC6979]
Pornin, T.,"Deterministic Usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)",RFC 6979,DOI 10.17487/RFC6979,,<https://www.rfc-editor.org/info/rfc6979>.
[RFC7301]
Friedl, S.,Popov, A.,Langley, A., andE. Stephan,"Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension",RFC 7301,DOI 10.17487/RFC7301,,<https://www.rfc-editor.org/info/rfc7301>.
[RFC7507]
Moeller, B. andA. Langley,"TLS Fallback Signaling Cipher Suite Value (SCSV) for Preventing Protocol Downgrade Attacks",RFC 7507,DOI 10.17487/RFC7507,,<https://www.rfc-editor.org/info/rfc7507>.
[RFC7627]
Bhargavan, K., Ed.,Delignat-Lavaud, A.,Pironti, A.,Langley, A., andM. Ray,"Transport Layer Security (TLS) Session Hash and Extended Master Secret Extension",RFC 7627,DOI 10.17487/RFC7627,,<https://www.rfc-editor.org/info/rfc7627>.
[RFC7748]
Langley, A.,Hamburg, M., andS. Turner,"Elliptic Curves for Security",RFC 7748,DOI 10.17487/RFC7748,,<https://www.rfc-editor.org/info/rfc7748>.
[RFC7919]
Gillmor, D.,"Negotiated Finite Field Diffie-Hellman Ephemeral Parameters for Transport Layer Security (TLS)",RFC 7919,DOI 10.17487/RFC7919,,<https://www.rfc-editor.org/info/rfc7919>.
[RFC8017]
Moriarty, K., Ed.,Kaliski, B.,Jonsson, J., andA. Rusch,"PKCS #1: RSA Cryptography Specifications Version 2.2",RFC 8017,DOI 10.17487/RFC8017,,<https://www.rfc-editor.org/info/rfc8017>.
[RFC8032]
Josefsson, S. andI. Liusvaara,"Edwards-Curve Digital Signature Algorithm (EdDSA)",RFC 8032,DOI 10.17487/RFC8032,,<https://www.rfc-editor.org/info/rfc8032>.
[RFC8126]
Cotton, M.,Leiba, B., andT. Narten,"Guidelines for Writing an IANA Considerations Section in RFCs",BCP 26,RFC 8126,DOI 10.17487/RFC8126,,<https://www.rfc-editor.org/info/rfc8126>.
[RFC8174]
Leiba, B.,"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words",BCP 14,RFC 8174,DOI 10.17487/RFC8174,,<https://www.rfc-editor.org/info/rfc8174>.
[RFC8439]
Nir, Y. andA. Langley,"ChaCha20 and Poly1305 for IETF Protocols",RFC 8439,DOI 10.17487/RFC8439,,<https://www.rfc-editor.org/info/rfc8439>.
[SHS]
Dang, Q.,"Secure Hash Standard",National Institute of Standards and Technology report,DOI 10.6028/nist.fips.180-4,,<https://doi.org/10.6028/nist.fips.180-4>.
[X690]
ITU-T,"Information technology - ASN.1 encoding Rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)",ISO/IEC 8824-1:2021,.

12.2.Informative References

[AEAD-LIMITS]
Luykx, A. andK. Paterson,"Limits on Authenticated Encryption Use in TLS",,<http://www.isg.rhul.ac.uk/~kp/TLS-AEbounds.pdf>.
[BBFGKZ16]
Bhargavan, K.,Brzuska, C.,Fournet, C.,Green, M.,Kohlweiss, M., andS. Zanella-Beguelin,"Downgrade Resilience in Key-Exchange Protocols",2016 IEEE Symposium on Security and Privacy (SP),DOI 10.1109/sp.2016.37,,<https://doi.org/10.1109/sp.2016.37>.
[BBK17]
Bhargavan, K.,Blanchet, B., andN. Kobeissi,"Verified Models and Reference Implementations for the TLS 1.3 Standard Candidate",2017 IEEE Symposium on Security and Privacy (SP),DOI 10.1109/sp.2017.26,,<https://doi.org/10.1109/sp.2017.26>.
[BDFKPPRSZZ16]
Bhargavan, K.,Delignat-Lavaud, A.,Fournet, C.,Kohlweiss, M.,Pan, J.,Protzenko, J.,Rastogi, A.,Swamy, N.,Zanella-Beguelin, S., andJ. Zinzindohoue,"Implementing and Proving the TLS 1.3 Record Layer",Proceedings of IEEE Symposium on Security and Privacy (San Jose) 2017,,<https://eprint.iacr.org/2016/1178>.
[Ben17a]
Benjamin, D.,"Presentation before the TLS WG at IETF 100",,<https://datatracker.ietf.org/meeting/100/materials/slides-100-tls-sessa-tls13/>.
[Ben17b]
Benjamin, D.,"Additional TLS 1.3 results from Chrome",,<https://www.ietf.org/mail-archive/web/tls/current/msg25168.html>.
[Blei98]
Bleichenbacher, D.,"Chosen Ciphertext Attacks against Protocols Based on RSA Encryption Standard PKCS #1",Proceedings of CRYPTO '98,.
[BMMRT15]
Badertscher, C.,Matt, C.,Maurer, U.,Rogaway, P., andB. Tackmann,"Augmented Secure Channels and the Goal of the TLS 1.3 Record Layer",ProvSec 2015,,<https://eprint.iacr.org/2015/394>.
[BT16]
Bellare, M. andB. Tackmann,"The Multi-User Security of Authenticated Encryption: AES-GCM in TLS 1.3",Proceedings of CRYPTO 2016,,<https://eprint.iacr.org/2016/564>.
[CCG16]
Cohn-Gordon, K.,Cremers, C., andL. Garratt,"On Post-compromise Security",2016 IEEE 29th Computer Security Foundations Symposium (CSF),DOI 10.1109/csf.2016.19,,<https://doi.org/10.1109/csf.2016.19>.
[CHECKOWAY]
Checkoway, S.,Maskiewicz, J.,Garman, C.,Fried, J.,Cohney, S.,Green, M.,Heninger, N.,Weinmann, R.,Rescorla, E., andH. Shacham,"A Systematic Analysis of the Juniper Dual EC Incident",Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security,DOI 10.1145/2976749.2978395,,<https://doi.org/10.1145/2976749.2978395>.
[CHHSV17]
Cremers, C.,Horvat, M.,Hoyland, J.,van der Merwe, T., andS. Scott,"Awkward Handshake: Possible mismatch of client/server view on client authentication in post-handshake mode in Revision 18",message to the TLS mailing list,,<https://www.ietf.org/mail-archive/web/tls/current/msg22382.html>.
[CHSV16]
Cremers, C.,Horvat, M.,Scott, S., andT. van der Merwe,"Automated Analysis and Verification of TLS 1.3: 0-RTT, Resumption and Delayed Authentication",2016 IEEE Symposium on Security and Privacy (SP),DOI 10.1109/sp.2016.35,,<https://doi.org/10.1109/sp.2016.35>.
[CK01]
Canetti, R. andH. Krawczyk,"Analysis of Key-Exchange Protocols and Their Use for Building Secure Channels",Lecture Notes in Computer Science pp. 453-474,DOI 10.1007/3-540-44987-6_28,,<https://doi.org/10.1007/3-540-44987-6_28>.
[CLINIC]
Miller, B.,Huang, L.,Joseph, A., andJ. Tygar,"I Know Why You Went to the Clinic: Risks and Realization of HTTPS Traffic Analysis",Privacy Enhancing Technologies pp. 143-163,DOI 10.1007/978-3-319-08506-7_8,,<https://doi.org/10.1007/978-3-319-08506-7_8>.
[DFGS15]
Dowling, B.,Fischlin, M.,Guenther, F., andD. Stebila,"A Cryptographic Analysis of the TLS 1.3 draft-10 Full and Pre-shared Key Handshake Protocol",Proceedings of ACM CCS 2015,,<https://eprint.iacr.org/2015/914>.
[DFGS16]
Dowling, B.,Fischlin, M.,Guenther, F., andD. Stebila,"A Cryptographic Analysis of the TLS 1.3 draft-10 Full and Pre-shared Key Handshake Protocol",TRON 2016,,<https://eprint.iacr.org/2016/081>.
[DOW92]
Diffie, W.,Van Oorschot, P., andM. Wiener,"Authentication and authenticated key exchanges",Designs, Codes and Cryptography Vol. 2, pp. 107-125,DOI 10.1007/bf00124891,,<https://doi.org/10.1007/bf00124891>.
[DSA-1571-1]
The Debian Project,"openssl -- predictable random number generator",,<https://www.debian.org/security/2008/dsa-1571>.
[DSS]
"Digital Signature Standard (DSS)",National Institute of Standards and Technology report,DOI 10.6028/nist.fips.186-4,,<https://doi.org/10.6028/nist.fips.186-4>.
[FETCH]
WHATWG,"Fetch Standard",,<https://fetch.spec.whatwg.org/>.
[FG17]
Fischlin, M. andF. Guenther,"Replay Attacks on Zero Round-Trip Time: The Case of the TLS 1.3 Handshake Candidates",Proceedings of Euro S&P 2017,,<https://eprint.iacr.org/2017/082>.
[FGSW16]
Fischlin, M.,Guenther, F.,Schmidt, B., andB. Warinschi,"Key Confirmation in Key Exchange: A Formal Treatment and Implications for TLS 1.3",Proceedings of IEEE Symposium on Security and Privacy (Oakland) 2016,,<http://ieeexplore.ieee.org/document/7546517/>.
[FW15]
Weimer, F.,"Factoring RSA Keys With TLS Perfect Forward Secrecy",.
[HCJC16]
Husák, M.,Čermák, M.,Jirsík, T., andP. Čeleda,"HTTPS traffic analysis and client identification using passive SSL/TLS fingerprinting",EURASIP Journal on Information Security Vol. 2016,DOI 10.1186/s13635-016-0030-7,,<https://doi.org/10.1186/s13635-016-0030-7>.
[HGFS15]
Hlauschek, C.,Gruber, M.,Fankhauser, F., andC. Schanes,"Prying Open Pandora's Box: KCI Attacks against TLS",Proceedings of USENIX Workshop on Offensive Technologies,.
[JSS15]
Jager, T.,Schwenk, J., andJ. Somorovsky,"On the Security of TLS 1.3 and QUIC Against Weaknesses in PKCS#1 v1.5 Encryption",Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security,DOI 10.1145/2810103.2813657,,<https://doi.org/10.1145/2810103.2813657>.
[KEYAGREEMENT]
Barker, E.,Chen, L.,Roginsky, A., andM. Smid,"Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography",National Institute of Standards and Technology report,DOI 10.6028/nist.sp.800-56ar2,,<https://doi.org/10.6028/nist.sp.800-56ar2>.
[Kraw10]
Krawczyk, H.,"Cryptographic Extraction and Key Derivation: The HKDF Scheme",Proceedings of CRYPTO 2010,,<https://eprint.iacr.org/2010/264>.
[Kraw16]
Krawczyk, H.,"A Unilateral-to-Mutual Authentication Compiler for Key Exchange (with Applications to Client Authentication in TLS 1.3",Proceedings of ACM CCS 2016,,<https://eprint.iacr.org/2016/711>.
[KW16]
Krawczyk, H. andH. Wee,"The OPTLS Protocol and TLS 1.3",Proceedings of Euro S&P 2016,,<https://eprint.iacr.org/2015/978>.
[LXZFH16]
Li, X.,Xu, J.,Zhang, Z.,Feng, D., andH. Hu,"Multiple Handshakes Security of TLS 1.3 Candidates",2016 IEEE Symposium on Security and Privacy (SP),DOI 10.1109/sp.2016.36,,<https://doi.org/10.1109/sp.2016.36>.
[Mac17]
MacCarthaigh, C.,"Security Review of TLS1.3 0-RTT",,<https://github.com/tlswg/tls13-spec/issues/1001>.
[PS18]
Patton, C. andT. Shrimpton,"Partially specified channels: The TLS 1.3 record layer without elision",,<https://eprint.iacr.org/2018/634>.
[PSK-FINISHED]
Cremers, C.,Horvat, M.,van der Merwe, T., andS. Scott,"Revision 10: possible attack if client authentication is allowed during PSK",message to the TLS mailing list,,,<https://www.ietf.org/mail-archive/web/tls/current/msg18215.html>.
[REKEY]
Abdalla, M. andM. Bellare,"Increasing the Lifetime of a Key: A Comparative Analysis of the Security of Re-keying Techniques",Advances in Cryptology - ASIACRYPT 2000 pp. 546-559,DOI 10.1007/3-540-44448-3_42,,<https://doi.org/10.1007/3-540-44448-3_42>.
[Res17a]
Rescorla, E.,"Preliminary data on Firefox TLS 1.3 Middlebox experiment",message to the TLS mailing list,,<https://www.ietf.org/mail-archive/web/tls/current/msg25091.html>.
[Res17b]
Rescorla, E.,"More compatibility measurement results",message to the TLS mailing list,,<https://www.ietf.org/mail-archive/web/tls/current/msg25179.html>.
[RFC3552]
Rescorla, E. andB. Korver,"Guidelines for Writing RFC Text on Security Considerations",BCP 72,RFC 3552,DOI 10.17487/RFC3552,,<https://www.rfc-editor.org/info/rfc3552>.
[RFC4086]
Eastlake 3rd, D.,Schiller, J., andS. Crocker,"Randomness Requirements for Security",BCP 106,RFC 4086,DOI 10.17487/RFC4086,,<https://www.rfc-editor.org/info/rfc4086>.
[RFC4346]
Dierks, T. andE. Rescorla,"The Transport Layer Security (TLS) Protocol Version 1.1",RFC 4346,DOI 10.17487/RFC4346,,<https://www.rfc-editor.org/info/rfc4346>.
[RFC4366]
Blake-Wilson, S.,Nystrom, M.,Hopwood, D.,Mikkelsen, J., andT. Wright,"Transport Layer Security (TLS) Extensions",RFC 4366,DOI 10.17487/RFC4366,,<https://www.rfc-editor.org/info/rfc4366>.
[RFC4492]
Blake-Wilson, S.,Bolyard, N.,Gupta, V.,Hawk, C., andB. Moeller,"Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS)",RFC 4492,DOI 10.17487/RFC4492,,<https://www.rfc-editor.org/info/rfc4492>.
[RFC5077]
Salowey, J.,Zhou, H.,Eronen, P., andH. Tschofenig,"Transport Layer Security (TLS) Session Resumption without Server-Side State",RFC 5077,DOI 10.17487/RFC5077,,<https://www.rfc-editor.org/info/rfc5077>.
[RFC5246]
Dierks, T. andE. Rescorla,"The Transport Layer Security (TLS) Protocol Version 1.2",RFC 5246,DOI 10.17487/RFC5246,,<https://www.rfc-editor.org/info/rfc5246>.
[RFC5764]
McGrew, D. andE. Rescorla,"Datagram Transport Layer Security (DTLS) Extension to Establish Keys for the Secure Real-time Transport Protocol (SRTP)",RFC 5764,DOI 10.17487/RFC5764,,<https://www.rfc-editor.org/info/rfc5764>.
[RFC5929]
Altman, J.,Williams, N., andL. Zhu,"Channel Bindings for TLS",RFC 5929,DOI 10.17487/RFC5929,,<https://www.rfc-editor.org/info/rfc5929>.
[RFC6091]
Mavrogiannopoulos, N. andD. Gillmor,"Using OpenPGP Keys for Transport Layer Security (TLS) Authentication",RFC 6091,DOI 10.17487/RFC6091,,<https://www.rfc-editor.org/info/rfc6091>.
[RFC6101]
Freier, A.,Karlton, P., andP. Kocher,"The Secure Sockets Layer (SSL) Protocol Version 3.0",RFC 6101,DOI 10.17487/RFC6101,,<https://www.rfc-editor.org/info/rfc6101>.
[RFC6176]
Turner, S. andT. Polk,"Prohibiting Secure Sockets Layer (SSL) Version 2.0",RFC 6176,DOI 10.17487/RFC6176,,<https://www.rfc-editor.org/info/rfc6176>.
[RFC6347]
Rescorla, E. andN. Modadugu,"Datagram Transport Layer Security Version 1.2",RFC 6347,DOI 10.17487/RFC6347,,<https://www.rfc-editor.org/info/rfc6347>.
[RFC6520]
Seggelmann, R.,Tuexen, M., andM. Williams,"Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS) Heartbeat Extension",RFC 6520,DOI 10.17487/RFC6520,,<https://www.rfc-editor.org/info/rfc6520>.
[RFC7230]
Fielding, R., Ed. andJ. Reschke, Ed.,"Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing",RFC 7230,DOI 10.17487/RFC7230,,<https://www.rfc-editor.org/info/rfc7230>.
[RFC7250]
Wouters, P., Ed.,Tschofenig, H., Ed.,Gilmore, J.,Weiler, S., andT. Kivinen,"Using Raw Public Keys in Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)",RFC 7250,DOI 10.17487/RFC7250,,<https://www.rfc-editor.org/info/rfc7250>.
[RFC7465]
Popov, A.,"Prohibiting RC4 Cipher Suites",RFC 7465,DOI 10.17487/RFC7465,,<https://www.rfc-editor.org/info/rfc7465>.
[RFC7568]
Barnes, R.,Thomson, M.,Pironti, A., andA. Langley,"Deprecating Secure Sockets Layer Version 3.0",RFC 7568,DOI 10.17487/RFC7568,,<https://www.rfc-editor.org/info/rfc7568>.
[RFC7685]
Langley, A.,"A Transport Layer Security (TLS) ClientHello Padding Extension",RFC 7685,DOI 10.17487/RFC7685,,<https://www.rfc-editor.org/info/rfc7685>.
[RFC7924]
Santesson, S. andH. Tschofenig,"Transport Layer Security (TLS) Cached Information Extension",RFC 7924,DOI 10.17487/RFC7924,,<https://www.rfc-editor.org/info/rfc7924>.
[RFC8305]
Schinazi, D. andT. Pauly,"Happy Eyeballs Version 2: Better Connectivity Using Concurrency",RFC 8305,DOI 10.17487/RFC8305,,<https://www.rfc-editor.org/info/rfc8305>.
[RFC8422]
Nir, Y.,Josefsson, S., andM. Pegourie-Gonnard,"Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS) Versions 1.2 and Earlier",RFC 8422,DOI 10.17487/RFC8422,,<https://www.rfc-editor.org/info/rfc8422>.
[RFC8446]
Rescorla, E.,"The Transport Layer Security (TLS) Protocol Version 1.3",RFC 8446,DOI 10.17487/RFC8446,,<https://www.rfc-editor.org/info/rfc8446>.
[RFC8447]
Salowey, J. andS. Turner,"IANA Registry Updates for TLS and DTLS",RFC 8447,DOI 10.17487/RFC8447,,<https://www.rfc-editor.org/info/rfc8447>.
[RFC8448]
Thomson, M.,"Example Handshake Traces for TLS 1.3",RFC 8448,DOI 10.17487/RFC8448,,<https://www.rfc-editor.org/info/rfc8448>.
[RFC8449]
Thomson, M.,"Record Size Limit Extension for TLS",RFC 8449,DOI 10.17487/RFC8449,,<https://www.rfc-editor.org/info/rfc8449>.
[RFC8879]
Ghedini, A. andV. Vasiliev,"TLS Certificate Compression",RFC 8879,DOI 10.17487/RFC8879,,<https://www.rfc-editor.org/info/rfc8879>.
[RFC8937]
Cremers, C.,Garratt, L.,Smyshlyaev, S.,Sullivan, N., andC. Wood,"Randomness Improvements for Security Protocols",RFC 8937,DOI 10.17487/RFC8937,,<https://www.rfc-editor.org/info/rfc8937>.
[RSA]
Rivest, R.,Shamir, A., andL. Adleman,"A method for obtaining digital signatures and public-key cryptosystems",Communications of the ACM Vol. 21, pp. 120-126,DOI 10.1145/359340.359342,,<https://doi.org/10.1145/359340.359342>.
[SIGMA]
Krawczyk, H.,"SIGMA: The ‘SIGn-and-MAc’ Approach to Authenticated Diffie-Hellman and Its Use in the IKE Protocols",Advances in Cryptology - CRYPTO 2003 pp. 400-425,DOI 10.1007/978-3-540-45146-4_24,,<https://doi.org/10.1007/978-3-540-45146-4_24>.
[SLOTH]
Bhargavan, K. andG. Leurent,"Transcript Collision Attacks: Breaking Authentication in TLS, IKE, and SSH",Proceedings 2016 Network and Distributed System Security Symposium,DOI 10.14722/ndss.2016.23418,,<https://doi.org/10.14722/ndss.2016.23418>.
[SSL2]
Hickman, K.,"The SSL Protocol",.
[TIMING]
Boneh, D. andD. Brumley,"Remote Timing Attacks Are Practical",USENIX Security Symposium,.
[X501]
ITU-T,"Information Technology - Open Systems Interconnection - The Directory: Models",ISO/IEC 9594-2:2020,.

Appendix A.State Machine

This appendix provides a summary of the legal state transitions for theclient and server handshakes. State names (in all capitals, e.g.,START) have no formal meaning but are provided for ease ofcomprehension. Actions which are taken only in certain circumstances areindicated in []. The notation "K_{send,recv} = foo" means "set the send/recvkey to the given key".

A.1.Client

                           START <----+            Send ClientHello |        | Recv HelloRetryRequest       [K_send = early data] |        |                             v        |        /                 WAIT_SH ----+        |                    | Recv ServerHello        |                    | K_recv = handshake    Can |                    V   send |                 WAIT_EE  early |                    | Recv EncryptedExtensions   data |           +--------+--------+        |     Using |                 | Using certificate        |       PSK |                 v        |           |            WAIT_CERT_CR        |           |        Recv |       | Recv CertificateRequest        |           | Certificate |       v        |           |             |    WAIT_CERT        |           |             |       | Recv Certificate        |           |             v       v        |           |              WAIT_CV        |           |                 | Recv CertificateVerify        |           +> WAIT_FINISHED <+        |                  | Recv Finished        \                  | [Send EndOfEarlyData]                           | K_send = handshake                           | [Send Certificate [+ CertificateVerify]] Can send                  | Send Finished app data   -->            | K_send = K_recv = application after here                v                       CONNECTED

Note that with the transitions as shown above, clients may send alertsthat derive from post-ServerHello messages in the clear or with theearly data keys. If clients need to send such alerts, they SHOULDfirst rekey to the handshake keys if possible.

A.2.Server

                             START <-----+              Recv ClientHello |         | Send HelloRetryRequest                               v         |                            RECVD_CH ----+                               | Select parameters                               v                            NEGOTIATED                               | Send ServerHello                               | K_send = handshake                               | Send EncryptedExtensions                               | [Send CertificateRequest]Can send                       | [Send Certificate + CertificateVerify]app data                       | Send Finishedafter   -->                    | K_send = applicationhere                  +--------+--------+             No 0-RTT |                 | 0-RTT                      |                 |  K_recv = handshake  |                 | K_recv = early data[Skip decrypt errors] |    +------> WAIT_EOED -+                      |    |       Recv |      | Recv EndOfEarlyData                      |    | early data |      | K_recv = handshake                      |    +------------+      |                      |                        |                      +> WAIT_FLIGHT2 <--------+                               |                      +--------+--------+              No auth |                 | Cert-based client auth                      |                 |                      |                 v                      |             WAIT_CERT                      |        Recv |       | Recv Certificate                      |       empty |       v                      | Certificate |    WAIT_CV                      |             |       | Recv                      |             v       | CertificateVerify                      +-> WAIT_FINISHED <---+                               | Recv Finished                               | K_recv = application                               v                           CONNECTED

Appendix B.Protocol Data Structures and Constant Values

This appendix provides the normative protocol types and the definitionsfor constants. Values listed as"_RESERVED" were used in previous versions of TLS and are listed herefor completeness. TLS 1.3 implementations MUST NOT send them butmight receive them from older TLS implementations.

B.1.Record Layer

   enum {       invalid(0),       change_cipher_spec(20),       alert(21),       handshake(22),       application_data(23),       (255)   } ContentType;   struct {       ContentType type;       ProtocolVersion legacy_record_version;       uint16 length;       opaque fragment[TLSPlaintext.length];   } TLSPlaintext;   struct {       opaque content[TLSPlaintext.length];       ContentType type;       uint8 zeros[length_of_padding];   } TLSInnerPlaintext;   struct {       ContentType opaque_type = application_data; /* 23 */       ProtocolVersion legacy_record_version = 0x0303; /* TLS v1.2 */       uint16 length;       opaque encrypted_record[TLSCiphertext.length];   } TLSCiphertext;

B.2.Alert Messages

   enum { warning(1), fatal(2), (255) } AlertLevel;   enum {       close_notify(0),       unexpected_message(10),       bad_record_mac(20),       decryption_failed_RESERVED(21),       record_overflow(22),       decompression_failure_RESERVED(30),       handshake_failure(40),       no_certificate_RESERVED(41),       bad_certificate(42),       unsupported_certificate(43),       certificate_revoked(44),       certificate_expired(45),       certificate_unknown(46),       illegal_parameter(47),       unknown_ca(48),       access_denied(49),       decode_error(50),       decrypt_error(51),       export_restriction_RESERVED(60),       protocol_version(70),       insufficient_security(71),       internal_error(80),       inappropriate_fallback(86),       user_canceled(90),       no_renegotiation_RESERVED(100),       missing_extension(109),       unsupported_extension(110),       certificate_unobtainable_RESERVED(111),       unrecognized_name(112),       bad_certificate_status_response(113),       bad_certificate_hash_value_RESERVED(114),       unknown_psk_identity(115),       certificate_required(116),       no_application_protocol(120),       (255)   } AlertDescription;   struct {       AlertLevel level;       AlertDescription description;   } Alert;

B.3.Handshake Protocol

   enum {       hello_request_RESERVED(0),       client_hello(1),       server_hello(2),       hello_verify_request_RESERVED(3),       new_session_ticket(4),       end_of_early_data(5),       hello_retry_request_RESERVED(6),       encrypted_extensions(8),       certificate(11),       server_key_exchange_RESERVED(12),       certificate_request(13),       server_hello_done_RESERVED(14),       certificate_verify(15),       client_key_exchange_RESERVED(16),       finished(20),       certificate_url_RESERVED(21),       certificate_status_RESERVED(22),       supplemental_data_RESERVED(23),       key_update(24),       message_hash(254),       (255)   } HandshakeType;   struct {       HandshakeType msg_type;    /* handshake type */       uint24 length;             /* remaining bytes in message */       select (Handshake.msg_type) {           case client_hello:          ClientHello;           case server_hello:          ServerHello;           case end_of_early_data:     EndOfEarlyData;           case encrypted_extensions:  EncryptedExtensions;           case certificate_request:   CertificateRequest;           case certificate:           Certificate;           case certificate_verify:    CertificateVerify;           case finished:              Finished;           case new_session_ticket:    NewSessionTicket;           case key_update:            KeyUpdate;       };   } Handshake;

B.3.1.Key Exchange Messages

   uint16 ProtocolVersion;   opaque Random[32];   uint8 CipherSuite[2];    /* Cryptographic suite selector */   struct {       ProtocolVersion legacy_version = 0x0303;    /* TLS v1.2 */       Random random;       opaque legacy_session_id<0..32>;       CipherSuite cipher_suites<2..2^16-2>;       opaque legacy_compression_methods<1..2^8-1>;       Extension extensions<8..2^16-1>;   } ClientHello;   struct {       ProtocolVersion legacy_version = 0x0303;    /* TLS v1.2 */       Random random;       opaque legacy_session_id_echo<0..32>;       CipherSuite cipher_suite;       uint8 legacy_compression_method = 0;       Extension extensions<6..2^16-1>;   } ServerHello;   struct {       ExtensionType extension_type;       opaque extension_data<0..2^16-1>;   } Extension;   enum {       server_name(0),                             /* RFC 6066 */       max_fragment_length(1),                     /* RFC 6066 */       status_request(5),                          /* RFC 6066 */       supported_groups(10),                       /* RFC 8422, 7919 */       signature_algorithms(13),                   /* RFC 8446 */       use_srtp(14),                               /* RFC 5764 */       heartbeat(15),                              /* RFC 6520 */       application_layer_protocol_negotiation(16), /* RFC 7301 */       signed_certificate_timestamp(18),           /* RFC 6962 */       client_certificate_type(19),                /* RFC 7250 */       server_certificate_type(20),                /* RFC 7250 */       padding(21),                                /* RFC 7685 */       pre_shared_key(41),                         /* RFC 8446 */       early_data(42),                             /* RFC 8446 */       supported_versions(43),                     /* RFC 8446 */       cookie(44),                                 /* RFC 8446 */       psk_key_exchange_modes(45),                 /* RFC 8446 */       certificate_authorities(47),                /* RFC 8446 */       oid_filters(48),                            /* RFC 8446 */       post_handshake_auth(49),                    /* RFC 8446 */       signature_algorithms_cert(50),              /* RFC 8446 */       key_share(51),                              /* RFC 8446 */       (65535)   } ExtensionType;   struct {       NamedGroup group;       opaque key_exchange<1..2^16-1>;   } KeyShareEntry;   struct {       KeyShareEntry client_shares<0..2^16-1>;   } KeyShareClientHello;   struct {       NamedGroup selected_group;   } KeyShareHelloRetryRequest;   struct {       KeyShareEntry server_share;   } KeyShareServerHello;   struct {       uint8 legacy_form = 4;       opaque X[coordinate_length];       opaque Y[coordinate_length];   } UncompressedPointRepresentation;   enum { psk_ke(0), psk_dhe_ke(1), (255) } PskKeyExchangeMode;   struct {       PskKeyExchangeMode ke_modes<1..255>;   } PskKeyExchangeModes;   struct {} Empty;   struct {       select (Handshake.msg_type) {           case new_session_ticket:   uint32 max_early_data_size;           case client_hello:         Empty;           case encrypted_extensions: Empty;       };   } EarlyDataIndication;   struct {       opaque identity<1..2^16-1>;       uint32 obfuscated_ticket_age;   } PskIdentity;   opaque PskBinderEntry<32..255>;   struct {       PskIdentity identities<7..2^16-1>;       PskBinderEntry binders<33..2^16-1>;   } OfferedPsks;   struct {       select (Handshake.msg_type) {           case client_hello: OfferedPsks;           case server_hello: uint16 selected_identity;       };   } PreSharedKeyExtension;
B.3.1.1.Version Extension
   struct {       select (Handshake.msg_type) {           case client_hello:                ProtocolVersion versions<2..254>;           case server_hello: /* and HelloRetryRequest */                ProtocolVersion selected_version;       };   } SupportedVersions;
B.3.1.2.Cookie Extension
   struct {       opaque cookie<1..2^16-1>;   } Cookie;
B.3.1.3.Signature Algorithm Extension
   enum {       /* RSASSA-PKCS1-v1_5 algorithms */       rsa_pkcs1_sha256(0x0401),       rsa_pkcs1_sha384(0x0501),       rsa_pkcs1_sha512(0x0601),       /* ECDSA algorithms */       ecdsa_secp256r1_sha256(0x0403),       ecdsa_secp384r1_sha384(0x0503),       ecdsa_secp521r1_sha512(0x0603),       /* RSASSA-PSS algorithms with public key OID rsaEncryption */       rsa_pss_rsae_sha256(0x0804),       rsa_pss_rsae_sha384(0x0805),       rsa_pss_rsae_sha512(0x0806),       /* EdDSA algorithms */       ed25519(0x0807),       ed448(0x0808),       /* RSASSA-PSS algorithms with public key OID RSASSA-PSS */       rsa_pss_pss_sha256(0x0809),       rsa_pss_pss_sha384(0x080a),       rsa_pss_pss_sha512(0x080b),       /* Legacy algorithms */       rsa_pkcs1_sha1(0x0201),       ecdsa_sha1(0x0203),       /* Reserved Code Points */       obsolete_RESERVED(0x0000..0x0200),       dsa_sha1_RESERVED(0x0202),       obsolete_RESERVED(0x0204..0x0400),       dsa_sha256_RESERVED(0x0402),       obsolete_RESERVED(0x0404..0x0500),       dsa_sha384_RESERVED(0x0502),       obsolete_RESERVED(0x0504..0x0600),       dsa_sha512_RESERVED(0x0602),       obsolete_RESERVED(0x0604..0x06FF),       private_use(0xFE00..0xFFFF),       (0xFFFF)   } SignatureScheme;   struct {       SignatureScheme supported_signature_algorithms<2..2^16-2>;   } SignatureSchemeList;
B.3.1.4.Supported Groups Extension
   enum {       unallocated_RESERVED(0x0000),       /* Elliptic Curve Groups (ECDHE) */       obsolete_RESERVED(0x0001..0x0016),       secp256r1(0x0017), secp384r1(0x0018), secp521r1(0x0019),       obsolete_RESERVED(0x001A..0x001C),       x25519(0x001D), x448(0x001E),       /* Finite Field Groups (DHE) */       ffdhe2048(0x0100), ffdhe3072(0x0101), ffdhe4096(0x0102),       ffdhe6144(0x0103), ffdhe8192(0x0104),       /* Reserved Code Points */       ffdhe_private_use(0x01FC..0x01FF),       ecdhe_private_use(0xFE00..0xFEFF),       obsolete_RESERVED(0xFF01..0xFF02),       (0xFFFF)   } NamedGroup;   struct {       NamedGroup named_group_list<2..2^16-1>;   } NamedGroupList;

Values within "obsolete_RESERVED" ranges are used in previous versionsof TLS and MUST NOT be offered or negotiated by TLS 1.3 implementations.The obsolete curves have various known/theoretical weaknesses or havehad very little usage, in some cases only due to unintentionalserver configuration issues. They are no longer considered appropriatefor general use and should be assumed to be potentially unsafe. The setof curves specified here is sufficient for interoperability with allcurrently deployed and properly configured TLS implementations.

B.3.2.Server Parameters Messages

   opaque DistinguishedName<1..2^16-1>;   struct {       DistinguishedName authorities<3..2^16-1>;   } CertificateAuthoritiesExtension;   struct {       opaque certificate_extension_oid<1..2^8-1>;       opaque certificate_extension_values<0..2^16-1>;   } OIDFilter;   struct {       OIDFilter filters<0..2^16-1>;   } OIDFilterExtension;   struct {} PostHandshakeAuth;   struct {       Extension extensions<0..2^16-1>;   } EncryptedExtensions;   struct {       opaque certificate_request_context<0..2^8-1>;       Extension extensions<0..2^16-1>;   } CertificateRequest;

B.3.3.Authentication Messages

   enum {       X509(0),       OpenPGP_RESERVED(1),       RawPublicKey(2),       (255)   } CertificateType;   struct {       select (certificate_type) {           case RawPublicKey:             /* From RFC 7250 ASN.1_subjectPublicKeyInfo */             opaque ASN1_subjectPublicKeyInfo<1..2^24-1>;           case X509:             opaque cert_data<1..2^24-1>;       };       Extension extensions<0..2^16-1>;   } CertificateEntry;   struct {       opaque certificate_request_context<0..2^8-1>;       CertificateEntry certificate_list<0..2^24-1>;   } Certificate;   struct {       SignatureScheme algorithm;       opaque signature<0..2^16-1>;   } CertificateVerify;   struct {       opaque verify_data[Hash.length];   } Finished;

B.3.4.Ticket Establishment

   struct {       uint32 ticket_lifetime;       uint32 ticket_age_add;       opaque ticket_nonce<0..255>;       opaque ticket<1..2^16-1>;       Extension extensions<0..2^16-1>;   } NewSessionTicket;

B.3.5.Updating Keys

   struct {} EndOfEarlyData;   enum {       update_not_requested(0), update_requested(1), (255)   } KeyUpdateRequest;   struct {       KeyUpdateRequest request_update;   } KeyUpdate;

B.4.Cipher Suites

A cipher suite defines the pair of the AEAD algorithm and hashalgorithm to be used with HKDF.Cipher suite names follow the naming convention:

   CipherSuite TLS_AEAD_HASH = VALUE;
Table 4:Cipher Suite Name Structure
ComponentContents
TLSThe string "TLS"
AEADThe AEAD algorithm used for record protection
HASHThe hash algorithm used with HKDF
VALUEThe two byte ID assigned for this cipher suite

This specification defines the following cipher suites for use with TLS 1.3.

Table 5:Cipher Suite List
DescriptionValue
TLS_AES_128_GCM_SHA256{0x13,0x01}
TLS_AES_256_GCM_SHA384{0x13,0x02}
TLS_CHACHA20_POLY1305_SHA256{0x13,0x03}
TLS_AES_128_CCM_SHA256{0x13,0x04}
TLS_AES_128_CCM_8_SHA256{0x13,0x05}

The corresponding AEAD algorithms AEAD_AES_128_GCM, AEAD_AES_256_GCM, andAEAD_AES_128_CCM are defined in[RFC5116]. AEAD_CHACHA20_POLY1305 is definedin[RFC8439]. AEAD_AES_128_CCM_8 is defined in[RFC6655]. The correspondinghash algorithms are defined in[SHS].

Although TLS 1.3 uses the same cipher suite space as previous versionsof TLS, TLS 1.3 cipher suites are defined differently, only specifyingthe symmetric ciphers, and cannot be used for TLS 1.2. Similarly,cipher suites for TLS 1.2 and lower cannot be used with TLS 1.3.

New cipher suite values are assigned by IANA as described inSection 11.

Appendix C.Implementation Notes

The TLS protocol cannot prevent many common security mistakes. This appendixprovides several recommendations to assist implementors.[RFC8448] provides test vectors for TLS 1.3 handshakes.

C.1.Random Number Generation and Seeding

TLS requires a cryptographically secure pseudorandom number generator (CSPRNG).In most cases, the operating system provides an appropriate facility suchas /dev/urandom, which should be used absent other (e.g., performance) concerns.It is RECOMMENDED to use an existing CSPRNG implementation inpreference to crafting a new one. Many adequate cryptographic librariesare already available under favorable license terms. Should those proveunsatisfactory,[RFC4086] provides guidance on the generation of random values.

TLS uses random values (1) in public protocol fields such as thepublic Random values in the ClientHello and ServerHello and (2) togenerate keying material. With a properly functioning CSPRNG, thisdoes not present a security problem, as it is not feasible to determinethe CSPRNG state from its output. However, with a broken CSPRNG, itmay be possible for an attacker to use the public output to determinethe CSPRNG internal state and thereby predict the keying material, asdocumented in[CHECKOWAY] and[DSA-1571-1].

Implementations can provide extra security againstthis form of attack by using separate CSPRNGs to generate public andprivate values.

[RFC8937] describes a way way for security protocol implementationsto augment their (pseudo)random number generators using a long-term private keyand a deterministic signature function. This improves randomness from broken orotherwise subverted random number generators.

C.2.Certificates and Authentication

Implementations are responsible for verifying the integrity of certificates andshould generally support certificate revocation messages. Absent a specificindication from an application profile, certificates shouldalways be verified to ensure proper signing by a trusted certificate authority(CA). The selection and addition of trust anchors should be done very carefully.Users should be able to view information about the certificate and trust anchor.Applications SHOULD also enforce minimum and maximum key sizes. For example,certification paths containing keys or signatures weaker than 2048-bit RSA or224-bit ECDSA are not appropriate for secure applications.

C.3.Implementation Pitfalls

Implementation experience has shown that certain parts of earlier TLSspecifications are not easy to understand and have been a source ofinteroperability and security problems. Many of these areas have been clarifiedin this document but this appendix contains a short list of the most importantthings that require special attention from implementors.

TLS protocol issues:

  • Do you correctly handle handshake messages that are fragmented tomultiple TLS records (seeSection 5.1)? Do you correctly handlecorner cases like a ClientHello that is split into several small fragments? Doyou fragment handshake messages that exceed the maximum fragmentsize? In particular, the Certificate and CertificateRequesthandshake messages can be large enough to require fragmentation.Certificate compression as defined in[RFC8879] can be usedto reduce the risk of fragmentation.
  • Do you ignore the TLS record layer version number in all unencrypted TLSrecords (seeAppendix E)?
  • Have you ensured that all support for SSL, RC4, EXPORT ciphers, andMD5 (via the "signature_algorithms" extension) is completely removed fromall possible configurations that support TLS 1.3 or later, and thatattempts to use these obsolete capabilities fail correctly?(seeAppendix E)?
  • Do you handle TLS extensions in ClientHellos correctly, includingunknown extensions?
  • When the server has requested a client certificate but nosuitable certificate is available, do you correctly send an emptyCertificate message, instead of omitting the whole message (seeSection 4.4.2)?
  • When processing the plaintext fragment produced by AEAD-Decrypt andscanning from the end for the ContentType, do you avoid scanningpast the start of the cleartext in the event that the peer has senta malformed plaintext of all zeros?
  • Do you properly ignore unrecognized cipher suites(Section 4.1.2), hello extensions (Section 4.2), named groups(Section 4.2.7), key shares (Section 4.2.8),supported versions (Section 4.2.1),and signature algorithms (Section 4.2.3) in theClientHello?
  • As a server, do you send a HelloRetryRequest to clients whichsupport a compatible (EC)DHE group but do not predict it in the"key_share" extension? As a client, do you correctly handle aHelloRetryRequest from the server?

Cryptographic details:

  • What countermeasures do you use to prevent timing attacks[TIMING]?
  • When using Diffie-Hellman key exchange, do you correctly preserveleading zero bytes in the negotiated key (seeSection 7.4.1)?
  • Does your TLS client check that the Diffie-Hellman parameters sentby the server are acceptable (seeSection 4.2.8.1)?
  • Do you use a strong and, most importantly, properly seeded random numbergenerator (seeAppendix C.1) when generating Diffie-Hellmanprivate values, the ECDSA "k" parameter, and other security-critical values?It is RECOMMENDED that implementations implement "deterministic ECDSA"as specified in[RFC6979]. Note that purely deterministic ECC signatures such asdeterministic ECDSA and EdDSA may be vulnerable to certain side-channel and faultinjection attacks in easily accessible IoT devices.
  • Do you zero-pad Diffie-Hellman public key values and sharedsecrets to the group size (seeSection 4.2.8.1 andSection 7.4.1)?
  • Do you verify signatures after making them, to protect against RSA-CRTkey leaks[FW15]?

C.4.Client Tracking Prevention

Clients SHOULD NOT reuse a ticket for multiple connections. Reuseof a ticket allows passive observers to correlate different connections.Servers that issue tickets SHOULD offer at least as many ticketsas the number of connections that a client might use; for example, a web browserusing HTTP/1.1[RFC7230] might open six connections to a server. Servers SHOULDissue new tickets with every connection. This ensures that clients arealways able to use a new ticket when creating a new connection.

Offering a ticket to a server additionally allows the server to correlatedifferent connections. This is possible independent of ticket reuse. Clientapplications SHOULD NOT offer tickets across connections that are meant to beuncorrelated. For example,[FETCH] defines network partition keys to separatecache lookups in web browsers.

C.5.Unauthenticated Operation

Previous versions of TLS offered explicitly unauthenticated cipher suites basedon anonymous Diffie-Hellman. These modes have been deprecated in TLS 1.3.However, it is still possible to negotiate parameters that do not provideverifiable server authentication by several methods, including:

  • Raw public keys[RFC7250].
  • Using a public key contained in a certificate but withoutvalidation of the certificate chain or any of its contents.

Either technique used alone is vulnerable to man-in-the-middle attacksand therefore unsafe for general use. However, it is also possible tobind such connections to an external authentication mechanism viaout-of-band validation of the server's public key, trust on firstuse, or a mechanism such as channel bindings (though thechannel bindings described in[RFC5929] are not defined forTLS 1.3). If no such mechanism is used, then the connection has no protectionagainst active man-in-the-middle attack; applications MUST NOT use TLSin such a way absent explicit configuration or a specific applicationprofile.

Appendix D.Updates to TLS 1.2

To align with the names used this document, the following terms from[RFC5246] are renamed:

  • The master secret, computed in Section 8.1 of[RFC5246], is renamed tothe main secret. It is referred to as main_secret in formulas andstructures, instead of master_secret. However, the label parameter to the PRFfunction is left unchanged for compatibility.
  • The premaster secret is renamed to the preliminary secret. It is referred toas preliminary_secret in formulas and structures, instead ofpre_master_secret.
  • The PreMasterSecret and EncryptedPreMasterSecret structures, defined inSection 7.4.7.1 of[RFC5246], are renamed to PreliminarySecret andEncryptedPreliminarySecret, respectively.

Correspondingly, the extension defined in[RFC7627] is renamed to the"Extended Main Secret" extension. The extension code point is renamed to"extended_main_secret". The label parameter to the PRF function in Section 4 of[RFC7627] is left unchanged for compatibility.

Appendix E.Backward Compatibility

The TLS protocol provides a built-in mechanism for version negotiation betweenendpoints potentially supporting different versions of TLS.

TLS 1.x and SSL 3.0 use compatible ClientHello messages. Servers can also handleclients trying to use future versions of TLS as long as the ClientHello formatremains compatible and there is at least one protocol version supported byboth the client and the server.

Prior versions of TLS used the record layer version number(TLSPlaintext.legacy_record_version andTLSCiphertext.legacy_record_version) for various purposes.As of TLS 1.3, this field is deprecated. The value ofTLSPlaintext.legacy_record_version MUST be ignored by all implementations.The value of TLSCiphertext.legacy_record_version is included in theadditional data for deprotection but MAY otherwise be ignoredor MAY be validated to match the fixed constant value.Version negotiation is performed using only the handshake versions(ClientHello.legacy_version and ServerHello.legacy_version, as well as theClientHello, HelloRetryRequest, and ServerHello "supported_versions" extensions).In order to maximize interoperability with older endpoints, implementationsthat negotiate the use of TLS 1.0-1.2 SHOULD set the record layerversion number to the negotiated version for the ServerHello and allrecords thereafter.

For maximum compatibility with previously non-standard behavior and misconfigureddeployments, all implementations SHOULD support validation of certification pathsbased on the expectations in this document, even when handling prior TLS versions'handshakes (seeSection 4.4.2.2).

TLS 1.2 and prior supported an "Extended Main Secret"[RFC7627] extensionwhich digested large parts of the handshake transcript into the secret andderived keys. Note this extension was renamed inAppendix D. Because TLS1.3 always hashes in the transcript up to the server Finished, implementationswhich support both TLS 1.3 and earlier versions SHOULD indicate the use of theExtended Main Secret extension in their APIs whenever TLS 1.3 is used.

E.1.Negotiating with an Older Server

A TLS 1.3 client who wishes to negotiate with servers that do notsupport TLS 1.3 will send anormal TLS 1.3 ClientHello containing 0x0303 (TLS 1.2) inClientHello.legacy_version but with the correct version(s) in the"supported_versions" extension. If the server does not support TLS 1.3, itwill respond with a ServerHello containing an older version number. If theclient agrees to use this version, the negotiation will proceed as appropriatefor the negotiated protocol. A client using a ticket for resumption SHOULD initiate theconnection using the version that was previously negotiated.

Note that 0-RTT data is not compatible with older servers and SHOULD NOTbe sent absent knowledge that the server supports TLS 1.3.SeeAppendix E.3.

If the version chosen by the server is not supported by the client (or is notacceptable), the client MUST abort the handshake with a "protocol_version" alert.

Some legacy server implementations are known to not implement the TLSspecification properly and might abort connections upon encounteringTLS extensions or versions which they are not aware of. Interoperabilitywith buggy servers is a complex topic beyond the scope of this document.Multiple connection attempts may be required in order to negotiatea backward-compatible connection; however, this practice is vulnerableto downgrade attacks and is NOT RECOMMENDED.

E.2.Negotiating with an Older Client

A TLS server can also receive a ClientHello indicating a version number smallerthan its highest supported version. If the "supported_versions" extensionis present, the server MUST negotiate using that extension as described inSection 4.2.1. If the "supported_versions" extension is notpresent, the server MUST negotiate the minimum of ClientHello.legacy_versionand TLS 1.2. For example, if the server supports TLS 1.0, 1.1, and 1.2,and legacy_version is TLS 1.0, the server will proceed with a TLS 1.0 ServerHello.If the "supported_versions" extension is absent and the server only supportsversions greater than ClientHello.legacy_version, the server MUST abort the handshakewith a "protocol_version" alert.

Note that earlier versions of TLS did not clearly specify the record layerversion number value in all cases (TLSPlaintext.legacy_record_version). Serverswill receive various TLS 1.x versions in this field, but its valueMUST always be ignored.

E.3.0-RTT Backward Compatibility

0-RTT data is not compatible with older servers. An older server will respondto the ClientHello with an older ServerHello, but it will not correctly skipthe 0-RTT data and will fail to complete the handshake. This can cause issues whena client attempts to use 0-RTT, particularly against multi-server deployments. Forexample, a deployment could deploy TLS 1.3 gradually with some serversimplementing TLS 1.3 and some implementing TLS 1.2, or a TLS 1.3 deploymentcould be downgraded to TLS 1.2.

A client that attempts to send 0-RTT data MUST fail a connection if it receivesa ServerHello with TLS 1.2 or older. It can then retrythe connection with 0-RTT disabled. To avoid a downgrade attack, theclient SHOULD NOT disable TLS 1.3, only 0-RTT.

To avoid this error condition, multi-server deployments SHOULD ensure a uniformand stable deployment of TLS 1.3 without 0-RTT prior to enabling 0-RTT.

E.4.Middlebox Compatibility Mode

Field measurements[Ben17a][Ben17b][Res17a][Res17b] have found that a significant number of middleboxesmisbehave when a TLS client/server pair negotiates TLS 1.3. Implementationscan increase the chance of making connections through those middleboxesby making the TLS 1.3 handshake look more like a TLS 1.2 handshake:

  • The client always provides a non-empty session ID in the ClientHello,as described in the legacy_session_id section ofSection 4.1.2.
  • If not offering early data, the client sends a dummychange_cipher_spec record (see the third paragraph ofSection 5)immediately before its second flight. Thismay either be before its second ClientHello or before its encryptedhandshake flight. If offering early data, the record is placedimmediately after the first ClientHello.
  • The server sends a dummy change_cipher_spec record immediatelyafter its first handshake message. This may either be after aServerHello or a HelloRetryRequest.

When put together, these changes make the TLS 1.3 handshake resembleTLS 1.2 session resumption, which improves the chance of successfullyconnecting through middleboxes. This "compatibility mode" is partiallynegotiated: the client can opt to provide a session ID or not,and the server has to echo it. Either side can send change_cipher_specat any time during the handshake, as they must be ignored by the peer,but if the client sends a non-empty session ID, the server MUST sendthe change_cipher_spec as described in this appendix.

E.5.Security Restrictions Related to Backward Compatibility

Implementations negotiating the use of older versions of TLS SHOULD preferforward secret and AEAD cipher suites, when available.

The security of RC4 cipher suites is considered insufficient for the reasonscited in[RFC7465]. Implementations MUST NOT offer or negotiate RC4 cipher suitesfor any version of TLS for any reason.

Old versions of TLS permitted the use of very low strength ciphers.Ciphers with a strength less than 112 bits MUST NOT be offered ornegotiated for any version of TLS for any reason.

The security of SSL 3.0[RFC6101] is considered insufficient for the reasons enumeratedin[RFC7568], and it MUST NOT be negotiated for any reason.

The security of SSL 2.0[SSL2] is considered insufficient for the reasons enumeratedin[RFC6176], and it MUST NOT be negotiated for any reason.

Implementations MUST NOT send an SSL version 2.0 compatible CLIENT-HELLO.Implementations MUST NOT negotiate TLS 1.3 or later using an SSL version 2.0 compatibleCLIENT-HELLO. Implementations are NOT RECOMMENDED to accept an SSL version 2.0 compatibleCLIENT-HELLO in order to negotiate older versions of TLS.

Implementations MUST NOT send a ClientHello.legacy_version or ServerHello.legacy_versionset to 0x0300 or less. Any endpoint receiving a Hello message withClientHello.legacy_version or ServerHello.legacy_version set to 0x0300 MUSTabort the handshake with a "protocol_version" alert.

Implementations MUST NOT send any records with a version less than 0x0300.Implementations SHOULD NOT accept any records with a version less than 0x0300(but may inadvertently do so if the record version number is ignored completely).

Implementations MUST NOT use the Truncated HMAC extension, defined inSection 7 of[RFC6066], as it is not applicable to AEAD algorithms and hasbeen shown to be insecure in some scenarios.

Appendix F.Overview of Security Properties

A complete security analysis of TLS is outside the scope of this document.In this appendix, we provide an informal description of the desired propertiesas well as references to more detailed work in the research literaturewhich provides more formal definitions.

We cover properties of the handshake separately from those of the record layer.

F.1.Handshake

The TLS handshake is an Authenticated Key Exchange (AKE) protocol whichis intended to provide both one-way authenticated (server-only) andmutually authenticated (client and server) functionality. At the completionof the handshake, each side outputs its view of the following values:

  • A set of "session keys" (the various secrets derived from the main secret)from which can be derived a set of working keys.
  • A set of cryptographic parameters (algorithms, etc.).
  • The identities of the communicating parties.

We assume the attacker to be an active network attacker, which means ithas complete control over the network used to communicate between the parties[RFC3552].Even under these conditions, the handshake should provide the properties listed below.Note that these properties are not necessarily independent, but reflectthe protocol consumers' needs.

Establishing the same session keys:

The handshake needs to output the same set of session keys on both sides ofthe handshake, provided that it completes successfully on each endpoint(see[CK01]; Definition 1, part 1).

Secrecy of the session keys:

The shared session keys should be known only to the communicatingparties and not to the attacker (see[CK01]; Definition 1, part 2).Note that in a unilaterally authenticated connection, the attacker can establishits own session keys with the server, but those session keys are distinct fromthose established by the client.

Peer Authentication:

The client's view of the peer identity should reflect the server'sidentity. If the client is authenticated, the server's view of thepeer identity should match the client's identity.

Uniqueness of the session keys:

Any two distinct handshakes should produce distinct, unrelated sessionkeys. Individual session keys produced by a handshake should also be distinctand independent.

Downgrade Protection:

The cryptographic parameters should be the same on both sides andshould be the same as if the peers had been communicating in theabsence of an attack (see[BBFGKZ16]; Definitions 8 and 9).

Forward secret with respect to long-term keys:

If the long-term keying material (in this case the signature keys in certificate-basedauthentication modes or the external/resumption PSK in PSK with (EC)DHE modes) is compromised afterthe handshake is complete, this does not compromise the security of thesession key (see[DOW92]), as long as the session key itself hasbeen erased. The forward secrecy property is not satisfiedwhen PSK is used in the "psk_ke" PskKeyExchangeMode.

Key Compromise Impersonation (KCI) resistance:

In a mutually authenticated connection with certificates, compromising the long-termsecret of one actor should not break that actor's authentication of their peer inthe given connection (see[HGFS15]). For example, if a client's signature key iscompromised, it should not be possible to impersonate arbitrary servers to that clientin subsequent handshakes.

Protection of endpoint identities:

The server's identity (certificate) should be protected against passiveattackers. The client's identity (certificate) should be protected againstboth passive and active attackers. This property does not hold for ciphersuites without confidentiality; while this specification does not define any such cipher suites,other documents may do so.

Informally, the signature-based modes of TLS 1.3 provide for theestablishment of a unique, secret, shared key established by an(EC)DHE key exchange and authenticated by the server's signature overthe handshake transcript, as well as tied to the server's identity bya MAC. If the client is authenticated by a certificate, it also signsover the handshake transcript and provides a MAC tied to bothidentities.[SIGMA] describes the design and analysis of this type of keyexchange protocol. If fresh (EC)DHE keys are used for each connection,then the output keys are forward secret.

The external PSK and resumption PSK bootstrap from a long-term sharedsecret into a unique per-connection set of short-term session keys. Thissecret may have been established in a previous handshake. IfPSK with (EC)DHE key establishment is used, these session keys will also be forwardsecret. The resumption PSK has been designed so that theresumption secret computed by connection N and needed to formconnection N+1 is separate from the traffic keys used by connection N,thus providing forward secrecy between the connections.In addition, if multiple tickets are established on the sameconnection, they are associated with different keys, so compromise ofthe PSK associated with one ticket does not lead to the compromise ofconnections established with PSKs associated with other tickets.This property is most interesting if tickets are stored in a database(and so can be deleted) rather than if they are self-encrypted.

The PSK binder value forms a binding between a PSKand the current handshake, as well as between the session where thePSK was established and the current session. This bindingtransitively includes the original handshake transcript, because thattranscript is digested into the values which produce the resumptionsecret. This requires that both the KDF used to produce theresumption secret and the MAC used to compute the binder be collisionresistant. SeeAppendix F.1.1 for more on this.Note: The binder does not cover the binder values from otherPSKs, though they are included in the Finished MAC.

Note: TLS does not currently permit the server to send a certificate_requestmessage in non-certificate-based handshakes (e.g., PSK).If this restriction were to be relaxed in future, theclient's signature would not cover the server's certificate directly.However, if the PSK was established through a NewSessionTicket, the client'ssignature would transitively cover the server's certificate throughthe PSK binder.[PSK-FINISHED]describes a concrete attack on constructions that do not bind tothe server's certificate (see also[Kraw16]). It is unsafe to use certificate-based clientauthentication when the client might potentially share the samePSK/key-id pair with two different endpoints. Implementations MUSTNOT combine external PSKs with certificate-based authentication ofeither the client or server. Future specifications MAY provide anextension to permit this.

If an exporter is used, then it produces values which are uniqueand secret (because they are generated from a unique session key).Exporters computed with different labels and contexts are computationallyindependent, so it is not feasible to compute one from another orthe session secret from the exported value.Note: Exporters canproduce arbitrary-length values; if exporters are to beused as channel bindings, the exported value MUST be largeenough to provide collision resistance. The exporters provided inTLS 1.3 are derived from the same Handshake Contexts as theearly traffic keys and the application traffic keys, respectively,and thus have similar security properties. Note that they donot include the client's certificate; future applicationswhich wish to bind to the client's certificate may needto define a new exporter that includes the full handshaketranscript.

For all handshake modes, the Finished MAC (and, where present, thesignature) prevents downgrade attacks. In addition, the use ofcertain bytes in the random nonces as described inSection 4.1.3allows the detection of downgrade to previous TLS versions.See[BBFGKZ16] for more details on TLS 1.3 and downgrade.

As soon as the client and the server have exchanged enough informationto establish shared keys, the remainder of the handshake is encrypted,thus providing protection against passive attackers, even if thecomputed shared key is not authenticated. Because the serverauthenticates before the client, the client can ensure that if itauthenticates to the server, it onlyreveals its identity to an authenticated server. Note that implementationsmust use the provided record-padding mechanism during the handshaketo avoid leaking information about the identities due to length.The client's proposed PSK identities are not encrypted, nor is theone that the server selects.

F.1.1.Key Derivation and HKDF

Key derivation in TLS 1.3 uses HKDF as defined in[RFC5869] andits two components, HKDF-Extract and HKDF-Expand. The full rationale for the HKDFconstruction can be found in[Kraw10] and the rationale for the way it is usedin TLS 1.3 in[KW16]. Throughout this document, eachapplication of HKDF-Extract is followed by one or more invocations ofHKDF-Expand. This ordering should always be followed (including in futurerevisions of this document); in particular, one SHOULD NOT use an output ofHKDF-Extract as an input to another application of HKDF-Extract without anHKDF-Expand in between. Multiple applications of HKDF-Expand to some ofthe same inputs are allowed aslong as these are differentiated via the key and/or the labels.

Note that HKDF-Expand implements a pseudorandom function (PRF) with both inputs andoutputs of variable length. In some of the uses of HKDF in this document(e.g., for generating exporters and the resumption_secret), it is necessarythat the application of HKDF-Expand be collision resistant; namely, it shouldbe infeasible to find two different inputs to HKDF-Expand that output the samevalue. This requires the underlying hash function to be collision resistantand the output length from HKDF-Expand to be of size at least 256 bits (or asmuch as needed for the hash function to prevent finding collisions).

F.1.2.Certificate-Based Client Authentication

A client that has sent certificate-based authentication data to a server, either duringthe handshake or in post-handshake authentication, cannot be sure whetherthe server afterwards considers the client to be authenticated or not.If the client needs to determine if the server considers theconnection to be unilaterally or mutually authenticated, this has tobe provisioned by the application layer. See[CHHSV17] for details.In addition, the analysis of post-handshake authentication from[Kraw16] shows that the client identified by the certificate sent inthe post-handshake phase possesses the traffic key. This party istherefore the client that participated in the original handshake orone to whom the original client delegated the traffic key (assumingthat the traffic key has not been compromised).

F.1.3.0-RTT

The 0-RTT mode of operation generally provides securityproperties similar to those of 1-RTT data, with the two exceptions that the 0-RTTencryption keys do not provide full forward secrecy and that theserver is not able to guarantee uniqueness of the handshake(non-replayability) without keeping potentially undue amounts ofstate. SeeSection 8 for mechanisms to limitthe exposure to replay.

F.1.4.Exporter Independence

The exporter_secret and early_exporter_secret arederived to be independent of the traffic keys and therefore donot represent a threat to the security of traffic encrypted withthose keys. However, because these secrets can be used tocompute any exporter value, they SHOULD be erased as soon aspossible. If the total set of exporter labels is known, thenimplementations SHOULD pre-compute the inner Derive-Secretstage of the exporter computation for all those labels,then erase the [early_]exporter_secret, followed byeach inner values as soon as it is known that it will not beneeded again.

F.1.5.Post-Compromise Security

TLS does not provide security for handshakes which take place after the peer'slong-term secret (signature key or external PSK) is compromised. It thereforedoes not provide post-compromise security[CCG16], sometimes also referred toas backwards or future secrecy. This is in contrast to KCI resistance, whichdescribes the security guarantees that a party has after its own long-termsecret has been compromised.

F.1.6.External References

The reader should refer to the following references for analysis of theTLS handshake:[DFGS15],[CHSV16],[DFGS16],[KW16],[Kraw16],[FGSW16],[LXZFH16],[FG17], and[BBK17].

F.2.Record Layer

The record layer depends on the handshake producing strong traffic secretswhich can be used to derive bidirectional encryption keys and nonces.Assuming that is true, and the keys are used for no more data thanindicated inSection 5.5, then the record layer should provide the followingguarantees:

Confidentiality:

An attacker should not be able to determine the plaintext contentsof a given record.

Integrity:

An attacker should not be able to craft a new record which isdifferent from an existing record which will be accepted by the receiver.

Order protection/non-replayability:

An attacker should not be able to cause the receiver to accept arecord which it has already accepted or cause the receiver to acceptrecord N+1 without having first processed record N.

Length concealment:

Given a record with a given external length, the attacker should not be ableto determine the amount of the record that is content versus padding.

Forward secrecy after key change:

If the traffic key update mechanism described inSection 4.6.3 has beenused and the previous generation key is deleted, an attacker who compromisesthe endpoint should not be able to decrypt traffic encrypted with the old key.

Informally, TLS 1.3 provides these properties by AEAD-protecting theplaintext with a strong key. AEAD encryption[RFC5116] provides confidentialityand integrity for the data. Non-replayability is provided by usinga separate nonce for each record, with the nonce being derived fromthe record sequence number (Section 5.3), with the sequencenumber being maintained independently at both sides; thus records whichare delivered out of order result in AEAD deprotection failures.In order to prevent mass cryptanalysis when the same plaintext isrepeatedly encrypted by different users under the same key(as is commonly the case for HTTP), the nonce is formed by mixingthe sequence number with a secret per-connection initializationvector derived along with the traffic keys.See[BT16] for analysis of this construction.

The rekeying technique in TLS 1.3 (seeSection 7.2) follows theconstruction of the serial generator as discussed in[REKEY], which shows that rekeying canallow keys to be used for a larger number of encryptions than withoutrekeying. This relies on the security of the HKDF-Expand-Label function as apseudorandom function (PRF). In addition, as long as this function is trulyone way, it is not possible to compute traffic keys from prior to a key change(forward secrecy).

TLS does not provide security for data which is communicated on a connectionafter a traffic secret of that connection is compromised. That is, TLS does notprovide post-compromise security/future secrecy/backward secrecy with respectto the traffic secret. Indeed, an attacker who learns a traffic secret cancompute all future traffic secrets on that connection. Systems which want suchguarantees need to do a fresh handshake and establish a new connection with an(EC)DHE exchange.

F.2.1.External References

The reader should refer to the following references for analysis of the TLS record layer:[BMMRT15],[BT16],[BDFKPPRSZZ16],[BBK17], and[PS18].

F.3.Traffic Analysis

TLS is susceptible to a variety of traffic analysis attacks based onobserving the length and timing of encrypted packets[CLINIC][HCJC16].This is particularly easy when there is a smallset of possible messages to be distinguished, such as for a videoserver hosting a fixed corpus of content, but still provides usableinformation even in more complicated scenarios.

TLS does not provide any specific defenses against this form of attackbut does include a padding mechanism for use by applications: Theplaintext protected by the AEAD function consists of content plusvariable-length padding, which allows the application to producearbitrary-length encrypted records as well as padding-only cover traffic toconceal the difference between periods of transmission and periodsof silence. Because thepadding is encrypted alongside the actual content, an attacker cannotdirectly determine the length of the padding, but may be able tomeasure it indirectly by the use of timing channels exposed duringrecord processing (i.e., seeing how long it takes to process arecord or trickling in records to see which ones elicit a responsefrom the server). In general, it is not known how to remove all ofthese channels because even a constant-time padding removal function willlikely feed the content into data-dependent functions.At minimum, a fully constant-time server or client would require closecooperation with the application-layer protocol implementation, includingmaking that higher-level protocol constant time.

Note: Robusttraffic analysis defenses will likely lead to inferior performancedue to delays in transmitting packets and increased traffic volume.

F.4.Side Channel Attacks

In general, TLS does not have specific defenses against side-channelattacks (i.e., those which attack the communications via secondarychannels such as timing), leaving those to the implementation of the relevantcryptographic primitives. However, certain features of TLS aredesigned to make it easier to write side-channel resistant code:

  • Unlike previous versions of TLS which used a compositeMAC-then-encrypt structure, TLS 1.3 only uses AEAD algorithms,allowing implementations to use self-contained constant-timeimplementations of those primitives.
  • TLS uses a uniform "bad_record_mac" alert for all decryptionerrors, which is intended to prevent an attacker from gainingpiecewise insight into portions of the message. Additional resistanceis provided by terminating the connection on such errors; a newconnection will have different cryptographic material, preventingattacks against the cryptographic primitives that require multipletrials.

Information leakage through side channels can occur at layers aboveTLS, in application protocols and the applications that usethem. Resistance to side-channel attacks depends on applications andapplication protocols separately ensuring that confidentialinformation is not inadvertently leaked.

F.5.Replay Attacks on 0-RTT

Replayable 0-RTT data presents a number of security threats toTLS-using applications, unless those applications are specificallyengineered to be safe under replay(minimally, this means idempotent, but in many cases mayalso require other stronger conditions, such as constant-timeresponse). Potential attacks include:

  • Duplication of actions which cause side effects (e.g., purchasing anitem or transferring money) to be duplicated, thus harming the site orthe user.
  • Attackers can store and replay 0-RTT messages in order toreorder them with respect to other messages (e.g., movinga delete to after a create).
  • Exploiting cache timing behavior to discover the content of 0-RTTmessages by replaying a 0-RTT message to a different cache nodeand then using a separate connection to measure request latency,to see if the two requests address the same resource.

If data can be replayed a large number of times, additional attacksbecome possible, such as making repeated measurements of thespeed of cryptographic operations. In addition, they maybe able to overload rate-limiting systems. For a further description ofthese attacks, see[Mac17].

Ultimately, servers have the responsibility to protect themselvesagainst attacks employing 0-RTT data replication. The mechanismsdescribed inSection 8 are intended toprevent replay at the TLS layer but do not provide complete protectionagainst receiving multiple copies of client data.TLS 1.3 falls back to the 1-RTThandshake when the server does not have any information about theclient, e.g., because it is in a different cluster which does notshare state or because the ticket has been deleted as described inSection 8.1. If the application-layer protocol retransmitsdata in this setting, then it is possible for an attacker to inducemessage duplication by sending the ClientHello to both the original cluster(which processes the data immediately) and another cluster which willfall back to 1-RTT and process the data upon application-layerreplay. The scale of this attack is limited by the client'swillingness to retry transactions and therefore only allows a limited amountof duplication, with each copy appearing as a new connection atthe server.

If implemented correctly, the mechanisms described inSection 8.1 andSection 8.2 prevent areplayed ClientHello and its associated 0-RTT data from being acceptedmultiple times by any cluster with consistent state; for serverswhich limit the use of 0-RTT to one cluster for a single ticket, then a givenClientHello and its associated 0-RTT data will only be accepted once.However, if state is not completely consistent,then an attacker might be able to have multiple copies of the data beaccepted during the replication window.Because clients do not know the exact details of server behavior, theyMUST NOT send messages in early data which are not safe to havereplayed and which they would not be willing to retry across multiple1-RTT connections.

Application protocols MUST NOT use 0-RTT data without a profile thatdefines its use. That profile needs to identify which messages orinteractions are safe to use with 0-RTT and how to handle thesituation when the server rejects 0-RTT and falls back to 1-RTT.

In addition, to avoid accidental misuse, TLS implementations MUST NOTenable 0-RTT (either sending or accepting) unless specificallyrequested by the application and MUST NOT automatically resend 0-RTTdata if it is rejected by the server unless instructed by theapplication. Server-side applications may wish to implement specialprocessing for 0-RTT data for some kinds of application traffic (e.g.,abort the connection, request that data be resent at the applicationlayer, or delay processing until the handshake completes). In order toallow applications to implement this kind of processing, TLSimplementations MUST provide a way for the application to determine ifthe handshake has completed.

F.5.1.Replay and Exporters

Replays of the ClientHello produce the same early exporter, thusrequiring additional care by applications which use these exporters.In particular, if these exporters are used as an authenticationchannel binding (e.g., by signing the output of the exporter)an attacker who compromises the PSK can transplant authenticatorsbetween connections without compromising the authentication key.

In addition, the early exporter SHOULD NOT be used to generateserver-to-client encryption keys because that would entailthe reuse of those keys. This parallels the use of the earlyapplication traffic keys only in the client-to-server direction.

F.6.PSK Identity Exposure

Because implementations respond to an invalid PSK binder by abortingthe handshake, it may be possible for an attacker to verify whethera given PSK identity is valid. Specifically, if a server acceptsboth external-PSK and certificate-based handshakes, a valid PSK identitywill result in a failed handshake, whereas an invalid identity willjust be skipped and result in a successful certificate handshake.Servers which solely support PSK handshakes may be able to resistthis form of attack by treating the cases where there is novalid PSK identity and where there is an identity but it has aninvalid binder identically.

F.7.Sharing PSKs

TLS 1.3 takes a conservative approach to PSKs by binding them to aspecific KDF. By contrast, TLS 1.2 allows PSKs to be used with anyhash function and the TLS 1.2 PRF. Thus, any PSK which is used withboth TLS 1.2 and TLS 1.3 must be used with only one hash in TLS 1.3,which is less than optimal if users want to provision a single PSK.The constructions in TLS 1.2 and TLS 1.3 are different, although theyare both based on HMAC. While there is no known way in which thesame PSK might produce related output in both versions, only limitedanalysis has been done. Implementations can ensure safety fromcross-protocol related output by not reusing PSKs between TLS 1.3 andTLS 1.2.

F.8.Attacks on Static RSA

Although TLS 1.3 does not use RSA key transport and so is notdirectly susceptible to Bleichenbacher-type attacks[Blei98]if TLS 1.3servers also support static RSA in the context of previousversions of TLS, then it may be possible to impersonate the serverfor TLS 1.3 connections[JSS15]. TLS1.3 implementations can prevent this attack by disabling supportfor static RSA across all versions of TLS. In principle, implementationsmight also be able to separate certificates with different keyUsagebits for static RSA decryption and RSA signature, but this techniquerelies on clients refusing to accept signatures using keysin certificates that do not have the digitalSignature bit set,and many clients do not enforce this restriction.

Appendix G.Changes Since -00

[[RFC EDITOR: Please remove in final RFC.]]

  • Update TLS 1.2 terminology
  • Specify "certificate-based" client authentication
  • Clarify that privacy guarantees don't apply when you have null encryption
  • Shorten some names
  • Address tracking implications of resumption

Contributors

      Martin Abadi      University of California, Santa Cruz      abadi@cs.ucsc.edu      Christopher Allen      (co-editor of TLS 1.0)      Alacrity Ventures      ChristopherA@AlacrityManagement.com      Richard Barnes      Cisco      rlb@ipv.sx      Steven M. Bellovin      Columbia University      smb@cs.columbia.edu      David Benjamin      Google      davidben@google.com      Benjamin Beurdouche      INRIA & Microsoft Research      benjamin.beurdouche@ens.fr      Karthikeyan Bhargavan      (editor of [RFC7627])      INRIA      karthikeyan.bhargavan@inria.fr      Simon Blake-Wilson      (co-author of [RFC4492])      BCI      sblakewilson@bcisse.com      Nelson Bolyard      (co-author of [RFC4492])      Sun Microsystems, Inc.      nelson@bolyard.com      Ran Canetti      IBM      canetti@watson.ibm.com      Matt Caswell      OpenSSL      matt@openssl.org      Stephen Checkoway      University of Illinois at Chicago      sfc@uic.edu      Pete Chown      Skygate Technology Ltd      pc@skygate.co.uk      Katriel Cohn-Gordon      University of Oxford      me@katriel.co.uk      Cas Cremers      University of Oxford      cas.cremers@cs.ox.ac.uk      Antoine Delignat-Lavaud      (co-author of [RFC7627])      INRIA      antdl@microsoft.com      Tim Dierks      (co-author of TLS 1.0, co-editor of TLS 1.1 and 1.2)      Independent      tim@dierks.org      Roelof DuToit      Symantec Corporation      roelof_dutoit@symantec.com      Taher Elgamal      Securify      taher@securify.com      Pasi Eronen      Nokia      pasi.eronen@nokia.com      Cedric Fournet      Microsoft      fournet@microsoft.com      Anil Gangolli      anil@busybuddha.org      David M. Garrett      dave@nulldereference.com      Illya Gerasymchuk      Independent      illya@iluxonchik.me      Alessandro Ghedini      Cloudflare Inc.      alessandro@cloudflare.com      Daniel Kahn Gillmor      ACLU      dkg@fifthhorseman.net      Matthew Green      Johns Hopkins University      mgreen@cs.jhu.edu      Jens Guballa      ETAS      jens.guballa@etas.com      Felix Guenther      TU Darmstadt      mail@felixguenther.info      Vipul Gupta      (co-author of [RFC4492])      Sun Microsystems Laboratories      vipul.gupta@sun.com      Chris Hawk      (co-author of [RFC4492])      Corriente Networks LLC      chris@corriente.net      Kipp Hickman      Alfred Hoenes      David Hopwood      Independent Consultant      david.hopwood@blueyonder.co.uk      Marko Horvat      MPI-SWS      mhorvat@mpi-sws.org      Jonathan Hoyland      Royal Holloway, University of London      jonathan.hoyland@gmail.com      Subodh Iyengar      Facebook      subodh@fb.com      Benjamin Kaduk      Akamai Technologies      kaduk@mit.edu      Hubert Kario      Red Hat Inc.      hkario@redhat.com      Phil Karlton      (co-author of SSL 3.0)      Leon Klingele      Independent      mail@leonklingele.de      Paul Kocher      (co-author of SSL 3.0)      Cryptography Research      paul@cryptography.com      Hugo Krawczyk      IBM      hugokraw@us.ibm.com      Adam Langley      (co-author of [RFC7627])      Google      agl@google.com      Olivier Levillain      ANSSI      olivier.levillain@ssi.gouv.fr      Xiaoyin Liu      University of North Carolina at Chapel Hill      xiaoyin.l@outlook.com      Ilari Liusvaara      Independent      ilariliusvaara@welho.com      Atul Luykx      K.U. Leuven      atul.luykx@kuleuven.be      Colm MacCarthaigh      Amazon Web Services      colm@allcosts.net      Carl Mehner      USAA      carl.mehner@usaa.com      Jan Mikkelsen      Transactionware      janm@transactionware.com      Bodo Moeller      (co-author of [RFC4492])      Google      bodo@acm.org      Kyle Nekritz      Facebook      knekritz@fb.com      Erik Nygren      Akamai Technologies      erik+ietf@nygren.org      Magnus Nystrom      Microsoft      mnystrom@microsoft.com      Kazuho Oku      DeNA Co., Ltd.      kazuhooku@gmail.com      Kenny Paterson      Royal Holloway, University of London      kenny.paterson@rhul.ac.uk      Christopher Patton      University of Florida      cjpatton@ufl.edu      Alfredo Pironti      (co-author of [RFC7627])      INRIA      alfredo.pironti@inria.fr      Andrei Popov      Microsoft      andrei.popov@microsoft.com      Marsh Ray      (co-author of [RFC7627])      Microsoft      maray@microsoft.com      Robert Relyea      Netscape Communications      relyea@netscape.com      Kyle Rose      Akamai Technologies      krose@krose.org      Jim Roskind      Amazon      jroskind@amazon.com      Michael Sabin      Joe Salowey      Tableau Software      joe@salowey.net      Rich Salz      Akamai      rsalz@akamai.com      David Schinazi      Apple Inc.      dschinazi@apple.com      Sam Scott      Royal Holloway, University of London      me@samjs.co.uk      Thomas Shrimpton      University of Florida      teshrim@ufl.edu      Dan Simon      Microsoft, Inc.      dansimon@microsoft.com      Brian Smith      Independent      brian@briansmith.org      Brian Sniffen      Akamai Technologies      ietf@bts.evenmere.org      Nick Sullivan      Cloudflare Inc.      nick@cloudflare.com      Bjoern Tackmann      University of California, San Diego      btackmann@eng.ucsd.edu      Tim Taubert      Mozilla      ttaubert@mozilla.com      Martin Thomson      Mozilla      mt@mozilla.com      Hannes Tschofenig      Arm Limited      Hannes.Tschofenig@arm.com      Sean Turner      sn3rd      sean@sn3rd.com      Steven Valdez      Google      svaldez@google.com      Filippo Valsorda      Cloudflare Inc.      filippo@cloudflare.com      Thyla van der Merwe      Royal Holloway, University of London      tjvdmerwe@gmail.com      Victor Vasiliev      Google      vasilvv@google.com      Hoeteck Wee      Ecole Normale Superieure, Paris      hoeteck@alum.mit.edu      Tom Weinstein      David Wong      NCC Group      david.wong@nccgroup.trust      Christopher A. Wood      Apple Inc.      cawood@apple.com      Tim Wright      Vodafone      timothy.wright@vodafone.com      Peter Wu      Independent      peter@lekensteyn.nl      Kazu Yamamoto      Internet Initiative Japan Inc.      kazu@iij.ad.jp

Author's Address

Eric Rescorla
Mozilla
Datatracker

draft-ietf-tls-rfc8446bis-03

This is an older version of an Internet-Draft whose latest revision state is "Active".

DocumentDocument type
This is an older version of an Internet-Draft whose latest revision state is "Active".
Select version
Compare versions
AuthorEric Rescorla
Replacesdraft-rescorla-tls-rfc8446-bis
RFC streamIETF LogoIETF Logo
Other formats
Additional resources Mailing list discussion
Report a datatracker bug

[8]ページ先頭

©2009-2025 Movatter.jp