Skip to content

Commit

Permalink
doc: add documentation for createDiffieHellmanGroup
Browse files Browse the repository at this point in the history
PR-URL: #28585
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
Ojasvi Monga authored and targos committed Jul 20, 2019
1 parent 00b2200 commit 5614e08
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions doc/api/crypto.md
Expand Up @@ -698,6 +698,32 @@ module):
* `DH_UNABLE_TO_CHECK_GENERATOR`
* `DH_NOT_SUITABLE_GENERATOR`

## Class: DiffieHellmanGroup
<!-- YAML
added: v0.7.5
-->

The `DiffieHellmanGroup` class takes a well-known modp group as its argument but
otherwise works the same as `DiffieHellman`.

```js
const name = 'modp1';
const dh = crypto.createDiffieHellmanGroup(name);
```

`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]:
```console
$ 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
```

## Class: ECDH
<!-- YAML
added: v0.11.14
Expand Down Expand Up @@ -1733,6 +1759,16 @@ 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}
* Returns: {DiffieHellman}

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

### crypto.createECDH(curveName)
<!-- YAML
added: v0.11.14
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5614e08

Please sign in to comment.