You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Multiple diffieHellman.generateKeys calls don't update the public key #56990
This function is a thin wrapper around DH_generate_key(). In particular, once a private key has been generated or set, calling this function only updates the public key but does not generate a new private key.
I have not been able to observe in any way that calling generateKeys multiple times results in different public keys.
NodeJS docs state that it is a thin wrapper around OpenSSL's DH_generate_key. The OpenSSL page on DH_generate_key states that as follows in their docs:
Not a bug but maybe a case of unclear documentation. See commit 4a82c8f for why that paragraph was added.
Public key generation is a deterministic process. You don't change any parameters so of course the public key stays the same. If you called dh.setPublicKey(some_other_pubkey) and then call generateKeys again, you get the old public key again.
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
Activity
bnoordhuis commentedon Feb 11, 2025
Not a bug but maybe a case of unclear documentation. See commit 4a82c8f for why that paragraph was added.
Public key generation is a deterministic process. You don't change any parameters so of course the public key stays the same. If you called
dh.setPublicKey(some_other_pubkey)and then call generateKeys again, you get the old public key again.doc: clarify diffieHellman.generateKeys recomputes same key
github-actions commentedon Apr 21, 2026
This issue has been marked as stale due to 210 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.
doc: clarify diffieHellman.generateKeys recomputes same key
doc: clarify diffieHellman.generateKeys recomputes same key
doc: clarify diffieHellman.generateKeys recomputes same key
doc: clarify diffieHellman.generateKeys recomputes same key