TLS Security 5: Establishing a TLS Connection | Acunetix (2024)

The process of establishing a secure SSL/TLS connection involves several steps. SSL/TLS security protocols use a combination of asymmetric and symmetric encryption. The client and the server must negotiate the algorithms used and exchange key information.

For the purpose of explaining this complex process, we use a TLS 1.2 connection, not the most recent TLS 1.3 protocol. The process used in TLS 1.2 was almost the same for all previous versions of SSL/TLS. However, it was greatly simplified in the latest version of Transport Layer Security.

The most important part of establishing a secure connection is called the handshake. During the TLS Handshake, the server and the client exchange important information used to determine connection properties. This example is based on a web browser handshake, but the same applies to all other SSL/TLS handshakes.

Step 1: Client Hello (Client → Server)

TLS Security 5: Establishing a TLS Connection | Acunetix (1)

First, the client sends a Client Hello to the server. The Client Hello includes the following information.

Client Version

The client sends a list of all the TLS/SSL protocol versions that it supports with the preferred one being first on the list. The preferred one is usually the latest available version. For example, TLS 1.2 has a client_version 3,3. This is because TLS 1.0 is treated as a minor revision of Secure Sockets Layer (SSL 3.0), so TLS 1.0 is 3,1, TLS 1.1 is 3,2, and so on.

Client Random

This is a 32-byte random number. The client random and the server random are later used to generate the key for encryption.

In the original TLS 1.2 specification, the first 4 bytes were supposed to represent the current date and time of the client (in epoch format) and the remaining 28 bytes was supposed to be a randomly generated number. However, IETF later recommended against it.

Session ID

This is the session id to be used for the connection. If the session_id is not empty, the server searches for previously cached sessions and resumes that session if a match is found.

compression_methods

This is the method that is going to be used for compressing the SSL packets. By using compression, we can achieve lower bandwidth usage and therefore, faster transfer speeds. Later on this article we will see why using compression is risky.

Cipher Suites

Cipher suites are combinations of cryptographic algorithms. Typically, each cipher suite contains one cryptographic algorithm for each of the following tasks: key exchange, authentication, bulk (data) encryption, and message authentication. The client sends a list of all the cipher suites that it supports in order of preference. This means that the client would ideally prefer the connection to be established using the first cipher suite sent.

Cipher suites are identified by strings. A sample cipher suite string is: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256. This string contains the following information:

  • TLS is the protocol being used
  • ECDHE is the key exchange algorithm (Elliptic curve Diffie–Hellman)
  • ECDSA is the authentication algorithm (Elliptic Curve Digital Signature Algorithm)
  • AES_128_GCM is the data encryption algorithm (Advanced Encryption Standard 128 bit Galois/Counter Mode)
  • SHA256 is the Message Authentication Code (MAC) algorithm (Secure Hash Algorithm 256 bit)

Compression Methods

This is a list of method that is going to be used for compressing data (before encrypting it). If you use compression, you can lower bandwidth usage and speed up transfers. However, compression is risky and recommended against: see information on CRIME and BREACH attacks.

Extensions

The client can request additional functionality for the connection. This can be done via extensions such as supported groups for elliptic curve cryptography, point formats for elliptic curve cryptography, signature algorithms, and more. If the server cannot provide the additional functionality, the client may abort the handshake if needed.

Here’s what an actual Client Hello looks like in a Wireshark capture.

TLS Security 5: Establishing a TLS Connection | Acunetix (2)

Step 2: Server Hello (Server → Client)

TLS Security 5: Establishing a TLS Connection | Acunetix (3)

After the server receives the Client Hello, it replies with a Server Hello. A Server Hello may either contain selected options (from among those proposed during Client Hello) or it may be a handshake failure message.

Server Version

The server selects the preferred version of the SSL/TLS protocol from among those presented by the client.

Server Random

This is a 32-byte random number. The server random and the client random are later used to generate the encryption key.

In the original TLS 1.2 specification, the first 4 bytes were supposed to represent the current date and time of the client (in epoch format) and the remaining 28 bytes was supposed to be a randomly generated number (just like in the case of Client Random). However, IETF later recommended against it.

Session ID

If the client Session ID was not empty, the server searches for previously cached sessions and if a match is found, that session ID is used to resume the session. If the client Session ID was empty, a new session may be created by the server and sent in the server Session ID.

Cipher Suites

The server selects the cipher suite from among Cipher Suites sent in the Client Hello.

Compression Methods

The server selects the compression method from among Compression Methods sent in the Client Hello.

Step 3: Server Certificate (Server → Client)

The server now sends a signed TLS/SSL certificate that proves its identity to the client. It also contains the public key of the server.

Step 4: Client Certificate (Client → Server, Optional)

In rare cases, the server may require the client to be authenticated with a client certificate. If so, the client provides its signed certificate to the server.

Step 5: Server Key Exchange (Server → Client)

The server key exchange message is sent only if the certificate provided by the server is not sufficient for the client to exchange a pre-master secret. (This is true for DHE_DSS, DHE_RSA, and DH_anon).

Step 6: Server Hello Done (Server → Client)

The server sends this to the client to confirm that the Server Hello message is finished.

This is what a Server Hello looks like in a Wireshark capture.

TLS Security 5: Establishing a TLS Connection | Acunetix (4)

TLS Security 5: Establishing a TLS Connection | Acunetix (5)

Step 7: Client Key Exchange (Server → Client)

TLS Security 5: Establishing a TLS Connection | Acunetix (6)

The Client Key Exchange message is sent right after the Server Hello Done is received from the server. If the server requests a Client Certificate, the Client Key Exchange is sent after that. During this stage, the client creates a pre-master key.

Pre-Master Secret

The pre-master secret is created by the client (the method of creation depends on the cipher suite) and then shared with the server.

Before sending the pre-master secret to the server, the client encrypts it using the server public key extracted from the certificate provided by the server. This means that only the server can decrypt the message since asymmetric encryption (key pair) is used for the pre-master secret exchange.

This is what the key exchange looks like in a Wireshark capture (using Diffie–Hellman).

TLS Security 5: Establishing a TLS Connection | Acunetix (7)

Master Secret

After the server receives the pre-master secret key, it uses its private key to decrypt it. Now, the client and the server compute the master secret key based on random values exchanged earlier (Client Random and Server Random) using a pseudorandom function (PRF). A PRF is a function used to generate arbitrary amounts of pseudorandom data.

master_secret = PRF(pre_master_secret, "master secret", ClientHello.random + ServerHello.random) [0..47];

The master secret key, which is 48 bytes in length, will then be used by both client and server to symmetrically encrypt the data for the rest of the communication.

The client and the server create a set of 3 keys:

  • client_write_MAC_key: Authentication and Integrity check
  • server_write_MAC_key: Authentication and Integrity check
  • client_write_key: Message encryption using symmetric key
  • server_write_key: Message encryption using symmetric key
  • client_write_IV: Initialization Vector used by some AHEAD ciphers
  • server_write_IV: Initialization Vector used by some AHEAD ciphers

Both Client and Server will use the master secret to generate the sessions keys which will be to encrypt/decrypt data.

Step 8: Client Change Cipher Spec (Client → Server)

At this point, the client is ready to switch to a secure, encrypted environment. The Change Cipher Spec protocol is used to change the encryption. Any data sent by the client from now on will be encrypted using the symmetric shared key.

This is what Change Cipher Spec looks like in a Wireshark capture.

TLS Security 5: Establishing a TLS Connection | Acunetix (8)

Step 9: Client Handshake Finished (Client → Server)

The last message of the handshake process from the client signifies that the handshake is finished. This is also the first encrypted message of the secure connection.

TLS Security 5: Establishing a TLS Connection | Acunetix (9)

Step 10: Server Change Cipher Spec (Server → Client)

The server is also ready to switch to an encrypted environment. Any data sent by the server from now on will be encrypted using the symmetric shared key.

Step 11: Server Handshake Finished (Server → Client)

The last message of the handshake process from the server (sent encrypted) signifies that the handshake is finished.

TLS Security 5: Establishing a TLS Connection | Acunetix (10)

To recap, the following illustrates a typical handshake.

TLS Security 5: Establishing a TLS Connection | Acunetix (11)

The TLS Handshake in TLS 1.3

In TLS 1.2 and earlier, the TLS handshake needed two round trips to be completed. The first round trip was the exchange of hellos and the second one was the key exchange and changing the cipher spec. In TLS 1.3, this process is streamlined and only one round trip is needed. TLS 1.3 also no longer supports TLS compression.

TLS Security 5: Establishing a TLS Connection | Acunetix (12)

In TLS 1.3, when the client sends its hello, it immediately guesses the key agreement protocol that the server will most likely select. At the same time, it shares its key using the guessed protocol. The server’s hello message also contains the shared key, the certificate, and the server finished message. There is no need for cipher change because after the exchange of hellos both parties already have all that they need to encrypt communication.

TLS Security 1

Learn about what SSL/TLS is, where is it used, and why was it introduced.

TLS Security 2

Learn about the history of SSL/TLS and protocol versions: SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1, and TLS 1.2.

TLS Security 3

Learn about SSL/TLS terminology and basics, for example, encryption algorithms, cipher suites, message authentication, and more.

TLS Security 4

Learn about SSL/TLS certificates, certificate authorities, and how to generate certificates.

TLS Security 6

Learn about TLS vulnerabilities and attacks such as POODLE, BEAST, CRIME, BREACH, and Heartbleed.

Frequently asked questions

In a TLS connection, the client and the server first agree upon the version of TLS that they are going to use, which is the highest that both support. Then, they agree upon cipher suites that they are going to use. Finally, they establish a common key for encryption and the data transfer can begin.

See an illustrated guide that explains how a TLS connection is established.

TLS uses a mixture of symmetric and asymmetric encryption. First, it uses asymmetric encryption to establish a key, which is then used for symmetric encryption. TLS does not use asymmetric encryption for the entire process because symmetric encryption is much more efficient and once a secure key is established, the process is completely safe.

Understand the differences between symmetric and asymmetric encryption.

Cipher suites are sets of encryption algorithms. TLS can use many different encryption algorithms for different purposes. When a connection is established, the client and the server must exchange information about the algorithms that they support and select the best ones. A cipher suite always includes four different algorithms for four purposes: the key exchange algorithm, the authentication algorithm, the data encryption algorithm, and the Message Authentication Code (MAC) algorithm.

Learn how to configure your server to select the safest cipher suites.

In TLS 1.3, the connection has been greatly simplified to make the process more efficient. It requires less time and data to establish, which can improve web server efficiency. TLS 1.3 also does not support TLS compression, which has been supported by TLS 1.2.

See an illustrated guide to establishing a TLS 1.3 connection.

Get the latest content on web security
in your inbox each week.

THE AUTHOR

TLS Security 5: Establishing a TLS Connection | Acunetix (13)

Agathoklis Prodromou
Web Systems Administrator/Developer

Akis has worked in the IT sphere for more than 13 years, developing his skills from a defensive perspective as a System Administrator and Web Developer but also from an offensive perspective as a penetration tester. He holds various professional certifications related to ethical hacking, digital forensics and incident response.

Related Posts:

TLS Security 5: Establishing a TLS Connection | Acunetix (2024)

FAQs

How to fix SSL TLS error? ›

These issues can be fixed by changing the configuration or the code of the web server or by contacting the web service provider. Some of the common causes of the error are: The web server does not support the SSL/TLS protocol version that your application is using.

How to solve could not establish trust relationship for the SSL/TLS secure channel? ›

Update or install a trusted certificate
  1. If the issue is due to a self-signed certificate, consider replacing it with one issued by a recognized CA. This ensures browser trust and secures your data transfer.
  2. Renew the certificate before its expiration date to avoid trust issues.
Mar 12, 2024

How to check TLS version in Chrome? ›

For Google Chrome & Microsoft Edge browser: o In the Windows menu search box, type 'Internet options'. o In the Internet Properties window, on the 'Advanced' tab, scroll down to the 'Security' section. o Make sure the 'User TLS 1.2' checkbox is checked.

How do I reset my TLS security settings? ›

Resetting all TLS settings to platform defaults
  1. From the System Utilities screen, select System Configuration > BIOS/Platform Configuration (RBSU) > Server Security > TLS (HTTPS) Options > Reset all settings to platform defaults.
  2. Click OK.

How do I fix TLS settings? ›

Google Chrome
  1. Open Google Chrome.
  2. Click Alt F and select Settings.
  3. Scroll down and select Show advanced settings...
  4. Scroll down to the Network section and click on Change proxy settings...
  5. Select the Advanced tab.
  6. Scroll down to Security category, manually check the option box for Use TLS 1.1 and Use TLS 1.2.
  7. Click OK.
Nov 1, 2023

How do I check my TLS security settings? ›

For Chrome
  1. Open the Developer Tools (Ctrl+Shift+I)
  2. Select the Security tab.
  3. Navigate to the WebAdmin or Cloud Client portal.
  4. Under Security, check the results for the section Connection to check which TLS protocol is used.
Jul 5, 2024

How to fix SSL connection error? ›

To fix the problem, try the following troubleshooting steps:
  1. Make sure you are using a valid SSL certificate.
  2. Update your browser to the latest version.
  3. Disable unknown or unnecessary add-ons in the Firefox settings.
  4. Ensure that HTTPS is set up correctly.
  5. If the error persists after these steps, restart your browser.

How to troubleshoot TLS errors? ›

How to troubleshoot TLS handshake issues
  1. Method #1: Update your system's date and time.
  2. Method #2: Fix your Browser's configuration to match the Latest TLS Protocol Support.
  3. Method #3: Check and Change TLS Protocols [in Windows]
  4. Method #4: Verify Your Server Configuration [to Support SNI]
Oct 27, 2020

How do I enable TLS security? ›

Google Chrome
  1. From the Start Menu > Open 'Internet Options' Options > Advanced tab.
  2. Scroll down to the Security category, manually check the option box for Use TLS 1.2 and un-check the option box for Use TLS 1.1 and Use TLS 1.0.
  3. Click OK.
  4. Close your browser and restart Google Chrome.
Oct 21, 2023

How do I fix my TLS certificate? ›

How to Solve the Invalid SSL /TLS Certificate Error
  1. Check the date on your computer. First of all you should check if the date and time on your computer is correct. ...
  2. Check for configuration errors. ...
  3. Check for domain mismatch. ...
  4. Get your certificate from a reliable CA. ...
  5. Check the certificate structure. ...
  6. Check for revocation.
Apr 21, 2024

How to configure SSL TLS in server? ›

On the Server UI General screen, select Enable Server UI SSL/TLS. Enabling this option changes the URL in the Base Address and Web API Address fields to HTTPS. If you enable SSL and your certificate is set to a port other than the default 443, specify the port in the Base Address and Web API Address fields.

Can you change TLS settings in Chrome? ›

Configure SSL/TLS settings for Chrome browser from [Settings] -> [Show Advanced Settings] -> [Change Proxy Settings] -> [Advanced]. Scroll down to the Security settings. Click To See Full Image. Best Practice: Compare browser settings of a working computer with the conflicting one and perform the necessary changes.

What is the difference between SSL and TLS? ›

SSL is technology your applications or browsers may have used to create a secure, encrypted communication channel over any network. However, SSL is an older technology that contains some security flaws. Transport Layer Security (TLS) is the upgraded version of SSL that fixes existing SSL vulnerabilities.

How do I update my TLS version? ›

Under TLS Versions, you will see the TLS protocol version(s) currently selected. To update the protocol, simply click edit. Next, choose your desired protocol based on your requirements and hit Save Changes. Please note that you can not disable TLS v1.

How do I fix TLS certificate error? ›

How to Solve the Invalid SSL /TLS Certificate Error
  1. Check the date on your computer. First of all you should check if the date and time on your computer is correct. ...
  2. Check for configuration errors. ...
  3. Check for domain mismatch. ...
  4. Get your certificate from a reliable CA. ...
  5. Check the certificate structure. ...
  6. Check for revocation.
Apr 21, 2024

How do I correct an SSL error? ›

How to Fix SSL Certificate Error
  1. Diagnose the problem with an online tool.
  2. Install an intermediate certificate on my web server.
  3. Generate a new Certificate Signing Request.
  4. Upgrade to a dedicated IP address.
  5. Get a wildcard SSL certificate.
  6. Change all URLS to HTTPS.
  7. Renew my SSL certificate.
Jul 19, 2024

How do I get rid of SSL error? ›

How to Fix SSL Errors
  1. Make sure you have SSL installed. ...
  2. Reinstall the SSL. ...
  3. Diagnose the problem with a web SSL checker. ...
  4. Renew your SSL certificate. ...
  5. Change all URLs to HTTPS. ...
  6. Update your browser or OS version. ...
  7. Install an intermediate certificate. ...
  8. Generate a new Certificate Signing Request.

How do I fix SSL protocol in Chrome? ›

Let's explore critical techniques to squash ERR_SSL_PROTOCOL_ERROR in your browser:
  1. Set The Correct Date & Time. ...
  2. Clear Browser Cache & Cookies. ...
  3. Update Your Web Browser. ...
  4. Adjust Firewall And Antivirus Settings. ...
  5. Check SSL Certificate Issues. ...
  6. Reset Browser Settings. ...
  7. Disable Browser Extensions. ...
  8. Use A VPN Service.
Feb 23, 2024

Top Articles
CEFR B2 French, fluent French level
Five Tips on How to Avoid Burnout as a Therapist
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Energy Healing Conference Utah
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Pearson Correlation Coefficient
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Movies - EPIC Theatres
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Mia Malkova Bio, Net Worth, Age & More - Magzica
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Nfsd Web Portal
Selly Medaline
Latest Posts
Article information

Author: Terence Hammes MD

Last Updated:

Views: 5949

Rating: 4.9 / 5 (69 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Terence Hammes MD

Birthday: 1992-04-11

Address: Suite 408 9446 Mercy Mews, West Roxie, CT 04904

Phone: +50312511349175

Job: Product Consulting Liaison

Hobby: Jogging, Motor sports, Nordic skating, Jigsaw puzzles, Bird watching, Nordic skating, Sculpting

Introduction: My name is Terence Hammes MD, I am a inexpensive, energetic, jolly, faithful, cheerful, proud, rich person who loves writing and wants to share my knowledge and understanding with you.