The DH parameters created by &quot;dhparam&quot; don&#x27;t contain any secrets; they&#x27;re entirely public.<p>The secrets used in Diffie-Hellman are chosen by the participants in the key exchange <i>at the moment that it&#x27;s used</i>.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Diffie%E2%80%93Hellman_key_exchange" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Diffie%E2%80%93Hellman_key_exc...</a><p>Here, the dhparam command is creating g and p (well, you&#x27;re supplying g as a command-line argument, and the command is choosing p); those are the public parameters which can be published anywhere, can be given to anyone, and can be re-used by multiple sites and services (although the last case makes life easier for attackers <i>if the p value is too small</i>, as the researchers indicate it is for some popular Internet standards and software configurations).<p>When a Diffie-Hellman key exchange happens, the two sites agree (not necessarily in a secret way, indeed normally not in a secret way) on what g and p to use, and then one site secretly chooses a, the other side secretly chooses b, and they do the math that results in both sides knowing the same combined secret without other parties being able to determine it. Only a, b, and the resulting combined secret g^ab mod p are confidential; g and p aren&#x27;t.<p>Diffie-Hellman can also provide forward secrecy because you can deliberately forget what values of a and b you used on a particular occasion, and then you can&#x27;t reconstruct them (unless you can compute discrete logarithms, which is supposed to be difficult). That&#x27;s not true for key exchange using RSA for confidentiality, where, if you still have the private key, you can still read your messages that were sent to you in the past using that private key.<p>Ciphersuites in TLS that use Diffie-Hellman in an ephemeral way (&quot;DHE&quot;) will still use RSA, but for identifying the server (and optionally the client) and confirming that no man-in-the-middle attack has happened. So, they only use RSA for <i>signatures</i>, not for confidentiality, and they still get forward secrecy if they forget the DH private values associated with individual sessions. (Some servers use the same b value for multiple incoming connections, which reduces the degree of forward secrecy they get: if someone hacked them or seized their server while it still contained a particular b value, that person could decrypt previously recorded TLS sessions with that server that used the same b value.)