Skip to content
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
wants to merge 8 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,33 @@ const bobSecret = bob.computeSecret(aliceKey);
assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
```

## 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
$ 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.
modp16
modp17
modp18
```

### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])
<!-- YAML
added: v0.5.0
Expand Down Expand Up @@ -1733,6 +1760,13 @@ 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()
joe9111 marked this conversation as resolved.
Show resolved Hide resolved
<!-- YAML
added: v0.9.3
-->

An alias for [`crypto.getDiffieHellman()`][]

### crypto.createECDH(curveName)
<!-- YAML
added: v0.11.14
Expand Down Expand Up @@ -3226,6 +3260,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
joe9111 marked this conversation as resolved.
Show resolved Hide resolved
[`crypto.getHashes()`]: #crypto_crypto_gethashes
[`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer
[`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer
Expand Down