1

I have a question about the Key Exchange Algorithm used in TLS process. I have read that the Key Exchange algorithm is used by client and server to exchange session keys. Do the client and server exchange session keys at the end of Handshake process? If they arrive mathematically at the same results for session keys at the end of the process, why would they exchange them?

1

When you use the term, 'exchange session keys', I think what you are really referring to is the fact that the client and the server exchange ECDHE public keys.

See https://tlseminar.github.io/first-few-milliseconds/ for a write-up on how TLS 1.2 works. You'll see that in the ServerKeyExchange message, the server sends its ephemeral public key. Then, after that, in the ClientKeyExchange message, the client sends its ephemeral public key.

Once the two sides have one-another's public keys, the server calculates the pre-master secret by multiplying its private key with the client's public key. Then, the client does the same by multiplying its private key with the server's public key. This produces the same result, so the client and the server both come to the same pre-master secret. Then, finally, the master secret is derived from the pre-master secret.

  • Why does the server send its public key to the client when in fact the client can find the server's public key in the certificate that the server sends? – Alice Aug 14 '20 at 12:24
  • Good question. The server's public key in the ServerKeyExchange message is an ephemeral (short term) public key. It's not the same as the (long term) public key in the server's certificate. This is how TLS 1.2 achieves perfect forward secrecy (PFS). If an attacker records the ciphertext between client and the server, then the server's long term private key is later compromised, it cannot be used go back and decrypt the ciphertext. Note that the server's long term private key (corresponding to the public key in the server's certificate) is used to sign the ServerKeyExchange message. – mti2935 Aug 14 '20 at 14:07
  • Okay, i understand. So the keys that are exchanged between the client and the server are the short term keys? – Alice Aug 14 '20 at 15:01
  • When the client encrypts the pre-master-secret with the server's public key to identify the server, does it use the server's short term public key or the long term public key? – Alice Aug 14 '20 at 15:06
  • Yes, the keys that are exchanged between the client and the server are short term public keys. They're referred to as 'ephemeral' keys. The client does not encrypt the pre-master secret with the server's public key to identify the server. – mti2935 Aug 14 '20 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.