DH Parameters (dhparam, Diffie-Hellman group parameters)
Definition
DH parameters are the prime modulus and generator that define a finite-field Diffie-Hellman group, which a TLS server needs in order to offer DHE cipher suites.
DH parameters define the group used for finite-field Diffie-Hellman: a large prime modulus p and a generator g. In TLS 1.2 the server chooses the group and sends p and g in its ServerKeyExchange message, so the parameters are part of server configuration, often loaded from a PEM file produced by openssl dhparam. TLS 1.3 removed arbitrary groups: finite-field DH is limited to the named groups ffdhe2048 through ffdhe8192 from RFC 7919.
Why it matters
The Logjam attack in 2015 showed that 512-bit export-grade groups could be broken in real time and that 1024-bit groups shared by many servers were a realistic precomputation target; 2048 bits became the baseline. DH parameters matter only for DHE suites. They have no effect on ECDHE, which uses named curves, and many current configurations do not enable DHE at all. In nginx, DHE suites are not used unless ssl_dhparam is set.
Example
Generate 2048-bit parameters and load them in nginx:
openssl dhparam -out /etc/nginx/dhparam.pem 2048
ssl_dhparam /etc/nginx/dhparam.pem;
Generation can take a while because the tool searches for a safe prime.
Common misconceptions
- "Every HTTPS server needs a dhparam file." Only servers that offer DHE suites do. ECDHE-only and TLS 1.3 connections ignore it.
- "Self-generated parameters are safer than standard groups." The vetted RFC 7919 groups such as ffdhe2048 are fine; the Logjam lesson was about small group sizes.
- "4096-bit parameters are always better." Larger groups make every DHE handshake noticeably slower for little practical gain over 2048 bits.