This article explains how SSL and its successsor work.
Intro
SSL makes use of assymmetric encryption for verification and symmetric encryption for data exchanging. Common ports: 443
, sometimes 5443
. TLS is an improvement. SSL is not being used too much since itβs not very secure (exploiting it requires a lot of knowledge and effort though), however, the protocol scheme is still called SSL/TLS.
Preamble
Bob π salutes the πΊ server . This message is called Client Hello
. It contains the following things:
- SSL version that the client supports
- random data
- encryption algorithm
- session ID (*optional)
- key exchange algorithm
- compression algorithm
- MAC
The πΊ server replies with β¦ surprise-surprise Server Hello
. It contains the following things:
- SSL version
- Session ID:
12345
- serverβs certificate
The πΊ server stops the babbling with Hello done
message.
Bob π checks the certificate at the certificate authority.
Letβs assume that the certificate is ok.
If the certificate is valid, Bob π generates a secret using an algoruthm G()
and random data r
as input to get a secret
. This secret
is then encrypted with some function that both Bob π and the πΊ server have agreed on: Enc(secret)
. Then Bob π sends Client Key Exchange
message. This message is encrypted using nectar (or any other asymmetric algo like RSA) with the serverβs πΊ public key π.
Upon receiving this message, the πΊ server decrypts the secret π€«.
It then computes the hash for it π€«. Bob π does the same and sends this hash to the πΊ server in the Change Cipher Spec Finished hash
message.
If the hashes match, the πΊ server sends Finished
message.
Thatβs how the connection is established. One more thing to note, if the session is not expired, then Bob π sends his session ID in the first, Client Hello
message. If it exists, they resume from the step when Bob sends a Finished
message.
TLS improvements
TLS is basically the same, but some algorithms were deprecated. Besides, TLS supports client authentication as well (the additional steps are below). Uses DES/RSA + keyed MAC.
After Server hello
, the πΊ server sends a Server hello done
.
Bob π creates a master secret +SID. Now Bob π has to send his certificate Enc(Premaster secret)
encrypted with the πΊ server serverβs πΊ public key π. The rest is the same.
Record protocol
- Fragment and reassemble data
- optional comression and decompression
- Apply MAC
- encryption
How SSL certificates are verified?
References
https://sectigostore.com/blog/ssl-vs-tls-decoding-the-difference-between-ssl-and-tls/
π https://stackoverflow.com/questions/188266/how-are-ssl-certificates-verified