Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2019-12-31 04:12:36 +0300
committerTobias Nießen <tniessen@tnie.de>2020-01-21 17:49:14 +0300
commitc6f8ea8d6578fd1f167bc943272eca5806224d2f (patch)
tree0fda0be88a33ddbea65ef366014270912716eee4 /doc/api/crypto.md
parent493fc429776a2dc705a2b66e4abc00149f620fc3 (diff)
crypto: add DH support to generateKeyPair
This allows using the generateKeyPair API for DH instead of the old stateful DH APIs. PR-URL: https://github.com/nodejs/node/pull/31178 Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'doc/api/crypto.md')
-rw-r--r--doc/api/crypto.md29
1 files changed, 23 insertions, 6 deletions
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index aa89e3b3a22..71b83a47db0 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -2093,6 +2093,9 @@ algorithm names.
<!-- YAML
added: v10.12.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/31178
+ description: Add support for Diffie-Hellman.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26774
description: Add ability to generate X25519 and X448 key pairs.
@@ -2106,12 +2109,17 @@ changes:
-->
* `type`: {string} Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`,
- `'x25519'`, or `'x448'`.
+ `'x25519'`, `'x448'`, or `'dh'`.
* `options`: {Object}
* `modulusLength`: {number} Key size in bits (RSA, DSA).
* `publicExponent`: {number} Public exponent (RSA). **Default:** `0x10001`.
* `divisorLength`: {number} Size of `q` in bits (DSA).
* `namedCurve`: {string} Name of the curve to use (EC).
+ * `prime`: {Buffer} The prime parameter (DH).
+ * `primeLength`: {number} Prime length in bits (DH).
+ * `generator`: {number} Custom generator (DH). **Default:** `2`.
+ * `groupName`: {string} Diffie-Hellman group name (DH). See
+ [`crypto.getDiffieHellman()`][].
* `publicKeyEncoding`: {Object} See [`keyObject.export()`][].
* `privateKeyEncoding`: {Object} See [`keyObject.export()`][].
* `callback`: {Function}
@@ -2119,8 +2127,8 @@ changes:
* `publicKey`: {string | Buffer | KeyObject}
* `privateKey`: {string | Buffer | KeyObject}
-Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519
-and Ed448 are currently supported.
+Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
+Ed448, X25519, X448, and DH are currently supported.
If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
behaves as if [`keyObject.export()`][] had been called on its result. Otherwise,
@@ -2158,6 +2166,9 @@ a `Promise` for an `Object` with `publicKey` and `privateKey` properties.
<!-- YAML
added: v10.12.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/31178
+ description: Add support for Diffie-Hellman.
- version: v12.0.0
pr-url: https://github.com/nodejs/node/pull/26554
description: Add ability to generate Ed25519 and Ed448 key pairs.
@@ -2167,20 +2178,26 @@ changes:
produce key objects if no encoding was specified.
-->
-* `type`: {string} Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, or `'ed448'`.
+* `type`: {string} Must be `'rsa'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`,
+ `'x25519'`, `'x448'`, or `'dh'`.
* `options`: {Object}
* `modulusLength`: {number} Key size in bits (RSA, DSA).
* `publicExponent`: {number} Public exponent (RSA). **Default:** `0x10001`.
* `divisorLength`: {number} Size of `q` in bits (DSA).
* `namedCurve`: {string} Name of the curve to use (EC).
+ * `prime`: {Buffer} The prime parameter (DH).
+ * `primeLength`: {number} Prime length in bits (DH).
+ * `generator`: {number} Custom generator (DH). **Default:** `2`.
+ * `groupName`: {string} Diffie-Hellman group name (DH). See
+ [`crypto.getDiffieHellman()`][].
* `publicKeyEncoding`: {Object} See [`keyObject.export()`][].
* `privateKeyEncoding`: {Object} See [`keyObject.export()`][].
* Returns: {Object}
* `publicKey`: {string | Buffer | KeyObject}
* `privateKey`: {string | Buffer | KeyObject}
-Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519
-and Ed448 are currently supported.
+Generates a new asymmetric key pair of the given `type`. RSA, DSA, EC, Ed25519,
+Ed448, X25519, X448, and DH are currently supported.
If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function
behaves as if [`keyObject.export()`][] had been called on its result. Otherwise,