I read briefly over the TSL/SSL key exchange protocol. I have to wonder about the whole pre-master-key procedure. Wouldn't it be sufficient if the client or server encrypted a generated session key with the other sides public key? Why the extra work?


1 Answer 1


The nonces prevent replay attacks. If the server didn't include a value into the handshake that's different for each connection, an attacker can record a connection and replay it. Mixing a server determined nonce into the key is an easy way to prevent such attacks.

  • $\begingroup$ Okay, good point. So when the client generates the session key, one could easily repeat the exact same conversation later. One doesn't know what effects that will have, but they're potentially not desired. But when the server generates the session key - shouldn't that be fine? Is there some technical reason why the server doesn't just generate the full session key and sends it to the client? $\endgroup$
    – cooky451
    Dec 2, 2012 at 15:00
  • $\begingroup$ How would that work? You can't encrypt the session key with the client's public key, because it usually doesn't have one. There are different ways to avoid replay problems, using a nonce on both sides that's mixed into the session key is just one easy solution. $\endgroup$ Dec 2, 2012 at 15:04
  • $\begingroup$ The client usually doesn't have a public key? Why not? Is it that hard to generate one? $\endgroup$
    – cooky451
    Dec 2, 2012 at 15:35
  • $\begingroup$ Generating one is easy in principle, but apart from client authentication(rarely used) and ephemeral key-change(for forward privacy) it's not that useful. IMO one should always use ECDHE where neither side creates the session key, and instead it's the result of a key-exchange operation. $\endgroup$ Dec 2, 2012 at 16:07
  • 1
    $\begingroup$ "Assuming the messages can be read by a third party, but not manipulated." We generally avoid that assumption, since usually being in a position to read messages allows you to manipulate them as well. $\endgroup$ Dec 2, 2012 at 18:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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