Im studing about the tls handshake and I have some doubts.
After the client validate the digital certificate presented by the server the next step is the key exchange agreement using for example RSA to encrpyt and decrypt data exchanged during the tls session. In this RSA process the client generates a random number and uses the public key of the server to encrypt this generated random number and send this encrypted number to the server.
This random number is the pre-master secret. The server uses its private key to decrypt the pre master secret. From this pre-master secret the client and the server can generate the master secret that contanins the symetric key to use in the message encryption. This pre master secret, since it was encrypted using the public key of the server can only be decrpyed by the server with its private key. Doubt: Thus, because of this the security in the key exchange depends on the private key of the server right?
So, if the pre master secret is encrpyeed with the public key of the server, if an ataccker can get the private key its possible that the attacker can decrypt the information transmitted in the handshake and thus get access to the master key to decrypt data transmitted durring a session, wether it is data from an older or new session. Doubt: To fix this issue there is the concept of perfect forward secrecy right? If there is a guarantee that all information ecnrypted before the private key is compromise continues secure.
Doubt: And to use this perfect forward secrecy the ephemeral dh algorithm should be use right? To generate a new set of paramters dh for each session. My doubt about this is, in case of a site that uses https how do we know if it uses dh or ephemeral dh? And when to use dh or ephemeral dh in a https site?