-
Notifications
You must be signed in to change notification settings - Fork 29.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update crypto.md #28585
Closed
Closed
Update crypto.md #28585
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2b12b37
doc: add documentation for createDiffieHellmanGroup
69af1e1
doc: add documentation for class DiffieHellmanGroup
f9b1600
Apply suggestions from code review
joe9111 23ee1b8
move section to correct place
f2e0def
add type for argument
a04b890
Apply suggestions from code review
joe9111 d2a0636
move text above code
e9fb832
Update doc/api/crypto.md
joe9111 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -698,6 +698,33 @@ module): | |
* `DH_UNABLE_TO_CHECK_GENERATOR` | ||
* `DH_NOT_SUITABLE_GENERATOR` | ||
|
||
## Class: DiffieHellmanGroup | ||
<!-- YAML | ||
added: v0.7.5 | ||
--> | ||
|
||
Usage: | ||
|
||
```js | ||
const name = 'modp1'; | ||
const dh = crypto.createDiffieHellmanGroup(name); | ||
``` | ||
It takes a well-known modp group as its argument but | ||
otherwise works the same as `DiffieHellman`. | ||
|
||
`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]: | ||
```bash | ||
joe9111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h | ||
modp1 # 768 bits | ||
modp2 # 1024 bits | ||
modp5 # 1536 bits | ||
modp14 # 2048 bits | ||
modp15 # etc. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would have been nice to fill this out completely but I guess anyone who needs this functionality already knows what modp group they should be using. |
||
modp16 | ||
modp17 | ||
modp18 | ||
``` | ||
|
||
## Class: ECDH | ||
<!-- YAML | ||
added: v0.11.14 | ||
|
@@ -1733,6 +1760,15 @@ Creates a `DiffieHellman` key exchange object and generates a prime of | |
`primeLength` bits using an optional specific numeric `generator`. | ||
If `generator` is not specified, the value `2` is used. | ||
|
||
### crypto.createDiffieHellmanGroup(name) | ||
<!-- YAML | ||
added: v0.9.3 | ||
--> | ||
|
||
* name {string} | ||
joe9111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
joe9111 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
An alias for [`crypto.getDiffieHellman()`][] | ||
|
||
### crypto.createECDH(curveName) | ||
<!-- YAML | ||
added: v0.11.14 | ||
|
@@ -3226,6 +3262,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL. | |
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm_options | ||
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options | ||
[`crypto.getCurves()`]: #crypto_crypto_getcurves | ||
[`crypto.getDiffieHellman()`]: #crypto_crypto_getdiffiehellman_groupname | ||
[`crypto.getHashes()`]: #crypto_crypto_gethashes | ||
[`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer | ||
[`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we're getting really close. Thanks for your patience with this. This doesn't follow the format of similar entries in the documentation. Put the text describing the class first, and the sample code after it. No need for lines like this one that say "Usage:" or "Example:".