# Diffie-Hellman in Https: How are prime numbers picked?

I am trying to understand https, as I understand https uses the Diffie–Hellman method for keys exchange and then AES for encryption.

But Diffie–Hellman needs two prime numbers, where do these come from?

• Feb 21 '20 at 17:33
• Feb 21 '20 at 17:44
• they are randomly generated, then tested for prime. Feb 21 '20 at 20:09
• Actually, DH only needs one prime number (the generator need not be prime) Feb 21 '20 at 21:05

TLS generally uses the DH groups specified in RFC7919. The RFC selects the modulii it specifies so that $$(p-1)/2$$ is also prime (and so the value $$g$$ is selects generates a large prime subgroup) - those primes have a number of other nice practical properties.