Skip to content

Commit 5614e08

Browse files
Ojasvi Mongatargos
Ojasvi Monga
authored andcommitted
doc: add documentation for createDiffieHellmanGroup
PR-URL: #28585 Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent 00b2200 commit 5614e08

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

doc/api/crypto.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,32 @@ module):
698698
* `DH_UNABLE_TO_CHECK_GENERATOR`
699699
* `DH_NOT_SUITABLE_GENERATOR`
700700

701+
## Class: DiffieHellmanGroup
702+
<!-- YAML
703+
added: v0.7.5
704+
-->
705+
706+
The `DiffieHellmanGroup` class takes a well-known modp group as its argument but
707+
otherwise works the same as `DiffieHellman`.
708+
709+
```js
710+
const name = 'modp1';
711+
const dh = crypto.createDiffieHellmanGroup(name);
712+
```
713+
714+
`name` is taken from [RFC 2412][] (modp1 and 2) and [RFC 3526][]:
715+
```console
716+
$ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h
717+
modp1 # 768 bits
718+
modp2 # 1024 bits
719+
modp5 # 1536 bits
720+
modp14 # 2048 bits
721+
modp15 # etc.
722+
modp16
723+
modp17
724+
modp18
725+
```
726+
701727
## Class: ECDH
702728
<!-- YAML
703729
added: v0.11.14
@@ -1733,6 +1759,16 @@ Creates a `DiffieHellman` key exchange object and generates a prime of
17331759
`primeLength` bits using an optional specific numeric `generator`.
17341760
If `generator` is not specified, the value `2` is used.
17351761

1762+
### crypto.createDiffieHellmanGroup(name)
1763+
<!-- YAML
1764+
added: v0.9.3
1765+
-->
1766+
1767+
* `name` {string}
1768+
* Returns: {DiffieHellman}
1769+
1770+
An alias for [`crypto.getDiffieHellman()`][]
1771+
17361772
### crypto.createECDH(curveName)
17371773
<!-- YAML
17381774
added: v0.11.14
@@ -3226,6 +3262,7 @@ the `crypto`, `tls`, and `https` modules and are generally specific to OpenSSL.
32263262
[`crypto.createSign()`]: #crypto_crypto_createsign_algorithm_options
32273263
[`crypto.createVerify()`]: #crypto_crypto_createverify_algorithm_options
32283264
[`crypto.getCurves()`]: #crypto_crypto_getcurves
3265+
[`crypto.getDiffieHellman()`]: #crypto_crypto_getdiffiehellman_groupname
32293266
[`crypto.getHashes()`]: #crypto_crypto_gethashes
32303267
[`crypto.privateDecrypt()`]: #crypto_crypto_privatedecrypt_privatekey_buffer
32313268
[`crypto.privateEncrypt()`]: #crypto_crypto_privateencrypt_privatekey_buffer

0 commit comments

Comments
 (0)