I read a lot of Q&A here, and read a lot of articles about RSA and Diffie-Hellman, but it seems like they are all saying opposite things about the question:

When I start an HTTPS session in a website, for example, is the symmetric key that will be used in AES combined with the RSA asymmetric algorithm, or is it combined using Diffie-Hellman key exchange algorithm? Because, it seems like both of the algorithms can do the same thing: combine a symmetric key between two sides of communication.

2 Answers 2


This is another variant on "How does TLS work?".

With Diffie Hellman, the shared secret that results from the exchange (g raised to the power of a raised to the power of b mod p) is fed into the PRF (together with other values) and is used to generate AES keys (and other values). The keys from the certificate do not participate in this process. Asymmetric authentication is achieved by doing a new online digital signature on the values of the DH key exchange using the private key for the certificate, which protects from MiTM attacks.

With the obsolete RSA key exchange (which does not provide PFS and does not exist in TLS1.3), the client just generated a random value, RSA-encrypted it to the public key from the certificate and sent that. The server RSA-decrypted the value using the private key for the certificate, thus establishing a shared secret value and at the same time proving possession of the private key from the certificate. This allows retroactive decryption of network intercepts after the private key for the certificate leaks (even if the certificate is already expired). The shared secret value is fed into the PRF, yada-yada.


RSA and Diffie-Hellman both provide the same capability - two parties can encrypt information sent between them, without having to share a secret or have any foreknowledge of the other.

In TLS (and therefore HTTPS) one side generates a symmetric key and shares it with the other side encrypted by RSA or Diffie-Hellman. It's not a combination, it's simply being encrypted by.

  • This is a terrible description of Diffie Hellman. In Diffie Hellman, the shared secret is not generated by one side and sent to the other side! Neither side knows what the shared secret is going to be before they combine their part and the other side's part.
    – Z.T.
    Apr 22, 2020 at 15:09
  • @Z.T. I stand by the description. It's simple but I'm describing the capability rather than the mechanism.
    – gowenfawr
    Apr 22, 2020 at 15:14
  • You can describe the capability and not the mechanism and be correct. For example, "RSA and Diffie-Hellman both provide the same capability - two parties who have never communicated before can agree on a secret value they'll use to securely encrypt their communication, using a completely public channel".
    – Z.T.
    Apr 22, 2020 at 15:16
  • @Z.T. It's almost like you're suggesting two parties could encrypt without foreknowledge of each other. Oh, wait, that's the same as what I said.
    – gowenfawr
    Apr 22, 2020 at 15:18
  • Yes, I have rephrased what you said but without saying anything that is incorrect, to prove that it could be done just as concisely, without telling anything wrong which the reader will then have to unlearn in the future. Not telling all the details is expected, but telling things that are wrong should be heavily discouraged because people remember the first thing they have heard/read about something and have to spend energy unlearning it and learning the truth. The pedagogical "lies to children" has to be done very carefully, and only when needed.
    – Z.T.
    Apr 22, 2020 at 15:22

You must log in to answer this question.

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