The Secure Sockets Layer (SSL) protocol uses a combination of public-key and symmetric-key encryption.
Symmetric-key encryption is much faster than public-key encryption; however, public-key encryption provides better authentication techniques.
An SSL session always begins with an exchange of messages called the SSL handshake.
The handshake allows the server to authenticate itself to the client by using public-key techniques, and then allows the client and the server to cooperate in the creation of symmetric keys used for rapid encryption, decryption, and tamper detection during the session that follows.
Optionally, the handshake also allows the client to authenticate itself to the server.
The steps involved in the SSL handshake are as follows:
The server responds with a server "hello" message that contains the cryptographic method (cipher suite) and the data compression method selected by the server, the session ID, and another random number.
| The client and the server must support at least one common cipher suite, or else the handshake fails. The server generally chooses the strongest common cipher suite. |
The client sends a "client key exchange" message. This message contains the pre-master secret, a 46-byte random number used in the generation of the symmetric encryption keys and the message authentication code (MAC) keys, encrypted with the public key of the server.
If the client sent a digital certificate to the server, the client sends a "digital certificate verify" message signed with the client's private key. By verifying the signature of this message, the server can explicitly verify the ownership of the client digital certificate.
| An additional process to verify the server digital certificate is not necessary. If the server does not have the private key that belongs to the digital certificate, it cannot decrypt the pre-master secret and create the correct keys for the symmetric encryption algorithm, and the handshake fails. |