# How is Pre Master Secret related to Client.random or Server.random if DH KEX is RSA

For TLS 1.2 cipher Suite AES256-GCM-SHA384, RSA is KEX(key exchagne algorithm). As per standards of RSA Diffie Hellman KEX, after 'ServerHello' message client gets server certificate and it generates a 48 byte random number which is 'pre master secret' and sends it to server. This ensures both have setup pre master secret.

Are client.random and server.random anyway related(mathemetically) to pre master secret?

As per my understanding (after researching on web), server.random prevents handshake replay attack in ECDH. How is RSAKEX preventing handshake replay attack?

Are they only significant after master secret generation and succeeding steps, but not in preventing handshake replay attack?

• The pre-master secret and the random fields are unrelated but both are used to compute the master secret (it should be the same for ECDH). – SEJPM Nov 29 '19 at 12:36
• Thanks for confirming. Since that's the case replay attack is mitigated by encrypting pre master secret with server certificate. By sending encrypted packet attacker could never establish connection(client like) with server as it can't derive master secret and subsequent keys. – Genie Nov 29 '19 at 13:43
• That ciphersuite (using the nonstandard OpenSSL name) uses RSA keyexchange, period. There is no 'RSA Diffie Hellman' kexexchange. In earlier protocols there were DH_RSA and DH_DSS -- static Diffie-Hellman with RSA or DSA CA -- but in TLS1.2 those are combined, see the paragraph after the table on page 49 of RFC5246, and similarly for ECDH_{RSA,ECDSA}, see A.7 on page 78. In general for all questions about details of TLS1.2 protocol see RFC5246 (and for extensions other than sigalgs the relevant other RFC). – dave_thompson_085 Nov 30 '19 at 4:10