

To generate the session keys used for the secure connection, the client either:.The client confirms the validity of the certificate before proceeding.The certificate contains the server name, the trusted certificate authority (CA) that vouches for the authenticity of the certificate, and the server's public encryption key. The server usually then provides identification in the form of a digital certificate.From this list, the server picks a cipher and hash function that it also supports and notifies the client of the decision.

The handshake begins when a client connects to a TLS-enabled server requesting a secure connection and the client presents a list of supported cipher suites ( ciphers and hash functions).During this handshake, the client and server agree on various parameters used to establish the connection's security: The protocols use a handshake with an asymmetric cipher to establish not only cipher settings but also a session-specific shared key with which further communication is encrypted using a symmetric cipher.

Once the client and server have agreed to use TLS, they negotiate a stateful connection by using a handshaking procedure (see § TLS handshake). Another mechanism is to make a protocol-specific STARTTLS request to the server to switch the connection to TLS – for example, when using the mail and news protocols. Port 80 is typically used for unencrypted HTTP traffic while port 443 is the common port used for encrypted HTTPS traffic. One of the main ways of achieving this is to use a different port number for TLS connections. Since applications can communicate either with or without TLS (or SSL), it is necessary for the client to request that the server set up a TLS connection.
