How does SSL/TLS work? Describe the connection establishment process.
sobes.tech AI
Answer from AI
SSL/TLS establishes a secure connection between the client and server through several steps:
-
Client Hello: the client sends the server a set of supported TLS versions, cipher suites, a random number, and other parameters.
-
Server Hello: the server selects parameters (version, cipher), sends its random number, a certificate with a public key, and possibly a request for a client certificate.
-
Certificate verification: the client verifies the authenticity of the server's certificate, the trust chain, and the validity period.
-
Key exchange: depending on the chosen algorithm (e.g., RSA, Diffie-Hellman), the client and server exchange data to generate a shared secret key.
-
Session key generation: both parties use the exchanged data and random numbers to compute a shared symmetric key.
-
Finished: the client and server send each other messages with integrity checks, encrypted with the new key.
After this, a secure channel is established, and data is transmitted with encryption and integrity verification.
In Go, TLS is implemented in the crypto/tls package, which automates this process.