filmov
tv
The TLS Handshake Explained with Example (the Math)

Показать описание
Transport Layer Security is the protocol used to encrypt the Internet.
The goal of TLS is to agree on the same key between parties that will be used to encrypt the traffic. In this video I will explain how the TLS handshake happens.
The client starts the handshake by generating 3 numbers, g and n which are public and x which is private.
The client sends g, n and parameter g raised to the power x modulo n. It is very difficult for anyone sniffing to extract x from this parameter.
The server receives the client hello and generates a private number y.
The server then raises the client’s parameter to the power of y and does a modulo of n and with basic math this is equal to g to the power x multiplied by y module n, this now becomes the key.
The server sends its hello with g raised to the power of y modulo n, again very hard to extract y from this. Server also sends many other information here such as certificates.
the client raises server parameter to the power of x which equates to g to the power x multiplied by y module n.
Both the client and server has the same key, this key exchange algorithm is called diffie hellman
Let us go through an example to explain this. client generates g is 10, n is 7 and x which is the private number as 2, the client calculates its parameter by raising 10 to the power of 2 module 7 resulting in 2.
The client sends its parameter 2, along side g and n
The server receives the parameters, calculates its private number y as 3. Server raises client parameter 2 to the power of 3 module 7 which results in the 1 that is the key.
Server sends its parameter which is g to the power of y module n which results in 6
Client raises server parameter 6 to the power of 2 module 7 which results in the 1 . It is very important to have n as large number in classical diffie hellman key exchange but this is not case with eliptic curve diffie hellman key exchange
The client and server hellos have lots of other information as well, such as the type of cipher algorithm to use which is fed the number they just agreed upon, certificates, TLS extensions and more! We demonstrated TLS 1.3 in this video TLS 1.2 has an extra round trip.
If you are interested in more details check out the playlist in the card where I made many videos on TLS. Let me know if you like those short engineering videos by hitting Like & Subscribe, I also make long form content so make sure to check out the other content of the channel! thank you (L)
🎙️Listen to the Backend Engineering Podcast
🏭 Backend Engineering Videos
💾 Database Engineering Videos
🏰 Load Balancing and Proxies Videos
🏛️ Software Archtiecture Videos
📩 Messaging Systems
Become a Member
Support me on PayPal
Join our Thriving Backend Community on Discord
Stay Awesome,
Hussein
The goal of TLS is to agree on the same key between parties that will be used to encrypt the traffic. In this video I will explain how the TLS handshake happens.
The client starts the handshake by generating 3 numbers, g and n which are public and x which is private.
The client sends g, n and parameter g raised to the power x modulo n. It is very difficult for anyone sniffing to extract x from this parameter.
The server receives the client hello and generates a private number y.
The server then raises the client’s parameter to the power of y and does a modulo of n and with basic math this is equal to g to the power x multiplied by y module n, this now becomes the key.
The server sends its hello with g raised to the power of y modulo n, again very hard to extract y from this. Server also sends many other information here such as certificates.
the client raises server parameter to the power of x which equates to g to the power x multiplied by y module n.
Both the client and server has the same key, this key exchange algorithm is called diffie hellman
Let us go through an example to explain this. client generates g is 10, n is 7 and x which is the private number as 2, the client calculates its parameter by raising 10 to the power of 2 module 7 resulting in 2.
The client sends its parameter 2, along side g and n
The server receives the parameters, calculates its private number y as 3. Server raises client parameter 2 to the power of 3 module 7 which results in the 1 that is the key.
Server sends its parameter which is g to the power of y module n which results in 6
Client raises server parameter 6 to the power of 2 module 7 which results in the 1 . It is very important to have n as large number in classical diffie hellman key exchange but this is not case with eliptic curve diffie hellman key exchange
The client and server hellos have lots of other information as well, such as the type of cipher algorithm to use which is fed the number they just agreed upon, certificates, TLS extensions and more! We demonstrated TLS 1.3 in this video TLS 1.2 has an extra round trip.
If you are interested in more details check out the playlist in the card where I made many videos on TLS. Let me know if you like those short engineering videos by hitting Like & Subscribe, I also make long form content so make sure to check out the other content of the channel! thank you (L)
🎙️Listen to the Backend Engineering Podcast
🏭 Backend Engineering Videos
💾 Database Engineering Videos
🏰 Load Balancing and Proxies Videos
🏛️ Software Archtiecture Videos
📩 Messaging Systems
Become a Member
Support me on PayPal
Join our Thriving Backend Community on Discord
Stay Awesome,
Hussein
Комментарии