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

Commit acc52ef

Browse filesBrowse files
kovanclaude
authored andcommitted
doc: clarify diffieHellman.generateKeys recomputes same key
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>
1 parent 43bf39c commit acc52ef
Copy full SHA for acc52ef

1 file changed

+5-2Lines changed: 5 additions & 2 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/crypto.md‎

Copy file name to clipboardExpand all lines: doc/api/crypto.md
+5-2Lines changed: 5 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1389,8 +1389,10 @@ If `encoding` is provided a string is returned; otherwise a
13891389
[`Buffer`][] is returned.
13901390

13911391
This function is a thin wrapper around [`DH_generate_key()`][]. In particular,
1392-
once a private key has been generated or set, calling this function only updates
1393-
the public key but does not generate a new private key.
1392+
once a private key has been generated or set, calling this function only
1393+
recomputes the public key from the existing private key. Since the public key is
1394+
determined by the private key, the result will be the same unless the private key
1395+
has been changed via [`diffieHellman.setPrivateKey()`][].
13941396

13951397
### `diffieHellman.getGenerator([encoding])`
13961398

@@ -6936,6 +6938,7 @@ See the [list of SSL OP Flags][] for details.
69366938
[`decipher.final()`]: #decipherfinaloutputencoding
69376939
[`decipher.update()`]: #decipherupdatedata-inputencoding-outputencoding
69386940
[`diffieHellman.generateKeys()`]: #diffiehellmangeneratekeysencoding
6941+
[`diffieHellman.setPrivateKey()`]: #diffiehellmansetprivatekeyprivatekey-encoding
69396942
[`diffieHellman.setPublicKey()`]: #diffiehellmansetpublickeypublickey-encoding
69406943
[`ecdh.generateKeys()`]: #ecdhgeneratekeysencoding-format
69416944
[`ecdh.setPrivateKey()`]: #ecdhsetprivatekeyprivatekey-encoding

0 commit comments

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