Certificate Implementation: How TLS Client and Servers Negotiate

Public and private key pairs are used to negotiate algorithms between the TLS client and the TLS enabled server. Here are a few key points.
  • TLS needs public and private key pairs. The server sends its public key to the client. The client can then send its public key to the server. However, the private key is never sent anywhere.
  • Public keys are stored in files commonly called certificates and private keys are stored in files commonly called keys. TLS uses certificates to describe the public and private key pairs to use. TLS uses certificates defined by the X.509 standard. These certificates contain information that includes the subject (usually the host name) and the Public Key Signature signed by a Certificate Authority (CA).
    Certificates come in PEM, DER, and PKCS12 file formats. For more details, see Certificate File Formats.
  • To send a certificate, the sender indicates which public certificate to send and has access to its private key associated with that public certificate. If the private key uses a password, the sender must know that password to use the private key.
  • Secure servers always send their certificates to the client.
  • Clients are required to send their certificates to the server only if they are asked.
  • The receiver verifies the certificates in the following ways:
    • making sure the certificate has not expired.
    • making sure the certificate authority (CA) listed in the certificate is known and is valid. If the CA in a certificate is signed by another CA certificate, it is known as an intermediate CA. The signer CA’s certificate must also be verified. This creates a CA certificate chain.
    • making sure that the certificate’s “Subject” common name (CN) is for the host that the certificate was sent from. Wildcards such as “*.mydomain.com” can be used in the certificate.
    • making sure the certificate has not been revoked.