TLS overview
2024-07-12

An brief overview of a TLS in simple language. https://www.rfc-editor.org/rfc/rfc8446

Table of Contents

## TLS guarantees

### The TLS protocol provides 3 properties

### How are these properties enforced

## Sub protocols

The TLS protocol is divided into two sub protocols: Handshake and Record.

### Handshake protocol

The Handshake protocol is responsible for performing a key exchange with the peer. The secret material generated from the key exchange is then used in the Record protocol to encrypt data. https://tls13.xargs.org/ provides an interactive diagram of the TLS 1.3 handshake.

    Client                                               Server

Handshake protocol:
    ClientHello               -------->
                                                    ServerHello
                                          [generate secret key]
                              <--------              {Finished}

    [generate secret key]
    {Finished}                -------->

The TLS protocol is extensible via the use of extesions. The peers can negotiate extensions in order to enable certain features. Some of these extensions are optional, while others are required for normal operation. A few of them include:

Difference between signature_algorithms and signature_algorithms_cert

### Record protocol

Once the Handshake protocol is complete, the peers now share the same secret key which they can use to encrypt/decrypt message. At this point it is possible for the peers to send encrypted data to each another.

     Client                                               Server

Handshake protocol:

     [generate secret key]                 [generate secret key]
                                  ....

Record protocol:
     [Application Data]        <------->      [Application Data]

## Handshake Types

A connection might perform a full handshake (perform a ECDHE key exchange). Or it might have done so previously and already posesses a PSK (Pre-Shared Key), which is can use for sending encrypted data.

### A full TLS handshake

     Client                                               Server

Initial Handshake:
     ClientHello
     + key_share               -------->
                                                     ServerHello
                                                     + key_share
                                           {EncryptedExtensions}
                                           {CertificateRequest*}
                                                  {Certificate*}
                                            {CertificateVerify*}
                                                      {Finished}
                               <--------     [Application Data*]

     {Certificate*}
     {CertificateVerify*}
     {Finished}                -------->

                               <--------      [NewSessionTicket]

     [Application Data]        <------->      [Application Data]

### A PSK TLS handshake

Subsequent Handshake:
       ClientHello
       + key_share*
       + pre_shared_key          -------->

                                                       ServerHello
                                                  + pre_shared_key
                                                      + key_share*
                                             {EncryptedExtensions}
                                                        {Finished}
                                 <--------     [Application Data*]

       {Finished}                -------->

       [Application Data]        <------->      [Application Data]