Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

doc: clarify diffieHellman.generateKeys recomputes same key#62205

Merged
nodejs-github-bot merged 1 commit into
nodejs:mainnodejs/node:mainfrom
kovan:doc-dh-generatekeys-wordingkovan/node:doc-dh-generatekeys-wordingCopy head branch name to clipboard
Apr 21, 2026
Merged

doc: clarify diffieHellman.generateKeys recomputes same key#62205
nodejs-github-bot merged 1 commit into
nodejs:mainnodejs/node:mainfrom
kovan:doc-dh-generatekeys-wordingkovan/node:doc-dh-generatekeys-wordingCopy head branch name to clipboard

Conversation

@kovan

@kovan kovan commented Mar 11, 2026

Copy link
Copy Markdown
Contributor

Clarify that calling generateKeys() after a private key has been
set recomputes the same public key deterministically. The current
wording ("only updates the public key") implies the public key
changes, but since it is fully determined by the private key, the
result is identical unless the private key was changed via
setPrivateKey().

Verified against lib/internal/crypto/diffiehellman.js
dhGenerateKeys() calls this[kHandle].generateKeys() which wraps
OpenSSL's DH_generate_key(), which deterministically computes
the public key from the private key.

Fixes: #56990

Clarify that calling generateKeys() after a private key has been
set recomputes the same public key deterministically, rather than
implying the public key changes. The public key is fully determined
by the private key, so the result is identical unless the private
key was changed via setPrivateKey().

Fixes: nodejs#56990

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations. labels Mar 11, 2026

@gurgunday gurgunday left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@panva panva added the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 21, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Apr 21, 2026
@nodejs-github-bot nodejs-github-bot merged commit eb54e70 into nodejs:main Apr 21, 2026
28 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in eb54e70

aduh95 pushed a commit that referenced this pull request May 5, 2026
Clarify that calling generateKeys() after a private key has been
set recomputes the same public key deterministically, rather than
implying the public key changes. The public key is fully determined
by the private key, so the result is identical unless the private
key was changed via setPrivateKey().

Fixes: #56990

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR-URL: #62205
Fixes: #56990
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
aduh95 pushed a commit that referenced this pull request May 7, 2026
Clarify that calling generateKeys() after a private key has been
set recomputes the same public key deterministically, rather than
implying the public key changes. The public key is fully determined
by the private key, so the result is identical unless the private
key was changed via setPrivateKey().

Fixes: #56990

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR-URL: #62205
Fixes: #56990
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
araujogui pushed a commit to araujogui/node that referenced this pull request May 26, 2026
Clarify that calling generateKeys() after a private key has been
set recomputes the same public key deterministically, rather than
implying the public key changes. The public key is fully determined
by the private key, so the result is identical unless the private
key was changed via setPrivateKey().

Fixes: nodejs#56990

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PR-URL: nodejs#62205
Fixes: nodejs#56990
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

crypto Issues and PRs related to the crypto subsystem. doc Issues and PRs related to the documentations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multiple diffieHellman.generateKeys calls don't update the public key

5 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.