How does TLS handshake work?

Ever wondered what happens when you request a website?

Sure there are many many things happening behind the scenes and it will take forever if I wanted to explain all of that in one article, but I can take each step at a time and try to explain what …


This content originally appeared on DEV Community and was authored by Hesam Rad

Ever wondered what happens when you request a website?

Sure there are many many things happening behind the scenes and it will take forever if I wanted to explain all of that in one article, but I can take each step at a time and try to explain what happens in each step.

Ready?

In today's world, using HTTPS is no longer an option. It's a necessity and everyone should use it, but how does it work? What is this secure version of HTTP that everyone is talking about?

Ok, relax and sit back down and listen to me.

We all know that HTTPS is the 'secure' version of HTTP. Duh! The 'S' at the end of it says it all. Of course everyone knows that. But we are here to take a little peak behind the curtain and see what's happening in the dark.

TSL Handshake

There is a specific chain of events that are happening when a TLS handshake occurs:

  1. ClientHello
  2. ServerHello
  3. Authentication
  4. The Premaster Secret
  5. ClientFinish
  6. ServerFinish

Let's break them down one by one.

ClientHello

First the client sends a Hello message to the server indicating that it wants to initiate a TLS handshake.
This Hello message includes which TLS version the client supports, the cipher suites supported, and a string of random bytes known as the client random.

ServerHello

Then the server replies with a Hello message of its own indicating that it's ready to create the handshake.
This Hello message includes the server's SSL certificate, the server's chosen cipher suite, and the server random, another random string of bytes that's generated by the server.

Authentication

Now the client tries to verify the server's SSL certificate with it's issuer to make sure of its validity.

The Premaster Secret

Now that the client has successfully verified that the SSL certificate is valid, it will generate one more random string, and encrypts it with the server's public key that it obtained from the SSL certificate in step #2 and sends it to the server.

ClientFinish

The client is now ready to finish the process of handshake. It will send a Finish message encrypted with the premaster secret to the server.

ServerFinish

To finish the process, the server will send an encrypted Finish message to the client, indicating that the handshake is now complete.

After this process, the client and the server can safely exchange messages.

Link to cover image


This content originally appeared on DEV Community and was authored by Hesam Rad


Print Share Comment Cite Upload Translate Updates
APA

Hesam Rad | Sciencx (2022-02-13T04:19:50+00:00) How does TLS handshake work?. Retrieved from https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/

MLA
" » How does TLS handshake work?." Hesam Rad | Sciencx - Sunday February 13, 2022, https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/
HARVARD
Hesam Rad | Sciencx Sunday February 13, 2022 » How does TLS handshake work?., viewed ,<https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/>
VANCOUVER
Hesam Rad | Sciencx - » How does TLS handshake work?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/
CHICAGO
" » How does TLS handshake work?." Hesam Rad | Sciencx - Accessed . https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/
IEEE
" » How does TLS handshake work?." Hesam Rad | Sciencx [Online]. Available: https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/. [Accessed: ]
rf:citation
» How does TLS handshake work? | Hesam Rad | Sciencx | https://www.scien.cx/2022/02/13/how-does-tls-handshake-work/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.