Session keys are generated during TLS handshake and are transferred from clients to server through asymmetric encryption FOR ONCE.

However, I have heard that session keys are single-use, which mean a new set of session keys are going to be re-generated after the end of a session, thus here comes my question: How are session keys transferred between a client and a server? If they are exchanged through asymmetric encryption, wouldn't it waste time everytime a session has started again and again? If they are exchanged through symmetric encryption, are they secure against man-in-the-middle? All kinds of useful answers are appreciated. In case that I am misunderstanding some concepts, you could explain the detail and true processes of a Record Protocol where two sides both use one single key (the session key) to encrypt and decrypt a file.

  • Session keys or better the pre-master secret is not transferred it is generated on both sides by a key agreement protocol like Diffie Hellman.
    – Robert
    Commented Mar 10, 2022 at 21:23
  • but through DH algorithm, the two sides need to exchange some algorithm parameters such as the prime numbers for calculating the session key, (1) how are these parameters transferred? (2) how do they use these parameters to calculate a same session key with different random numbers?
    – Gaai Chia
    Commented Mar 11, 2022 at 3:25
  • Please just read the documentation of TLS1.3. It contains the description how to establish a secure connection between two parties.
    – Robert
    Commented Mar 11, 2022 at 8:31
  • Thank you for your reminders, I have now known the answer of these two questions!
    – Gaai Chia
    Commented Mar 11, 2022 at 15:59

1 Answer 1


TLS encryption relies on the Diffie-Hellman algorithm to securely exchange the shared secret used to encrypt the session.

The Diffie-Hellman algorithm provides the capability for two communicating parties to agree upon a shared secret between them. Its an agreement scheme because both parties add material used to derive the key (as opposed to transport, where one party selects the key). The shared secret can then be used as the basis for some encryption key to be used for further communication.

See https://wiki.openssl.org/index.php/Diffie_Hellman

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .