diff options
author | Rich Trott <rtrott@gmail.com> | 2019-12-24 03:58:10 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2020-01-03 18:21:50 +0300 |
commit | df5ec4e7b13a47f5a39899f8b2df409a4478bef7 (patch) | |
tree | 1fca60714f0058748f7df228af66a104531d7041 /doc/api | |
parent | f8a6edaac6e1d409d692a730821d432b9926e8aa (diff) |
doc,crypto: use code markup/markdown in headers
PR-URL: https://github.com/nodejs/node/pull/31086
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'doc/api')
-rw-r--r-- | doc/api/crypto.md | 196 |
1 files changed, 98 insertions, 98 deletions
diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 5de68740aa3..ae6e51ef13a 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -36,7 +36,7 @@ try { } ``` -## Class: Certificate +## Class: `Certificate` <!-- YAML added: v0.11.8 --> @@ -51,7 +51,7 @@ The `crypto` module provides the `Certificate` class for working with SPKAC data. The most common usage is handling output generated by the HTML5 `<keygen>` element. Node.js uses [OpenSSL's SPKAC implementation][] internally. -### Certificate.exportChallenge(spkac) +### `Certificate.exportChallenge(spkac)` <!-- YAML added: v9.0.0 --> @@ -68,7 +68,7 @@ console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` -### Certificate.exportPublicKey(spkac\[, encoding\]) +### `Certificate.exportPublicKey(spkac[, encoding])` <!-- YAML added: v9.0.0 --> @@ -86,7 +86,7 @@ console.log(publicKey); // Prints: the public key as <Buffer ...> ``` -### Certificate.verifySpkac(spkac) +### `Certificate.verifySpkac(spkac)` <!-- YAML added: v9.0.0 --> @@ -108,7 +108,7 @@ As a still supported legacy interface, it is possible (but not recommended) to create new instances of the `crypto.Certificate` class as illustrated in the examples below. -#### new crypto.Certificate() +#### `new crypto.Certificate()` Instances of the `Certificate` class can be created using the `new` keyword or by calling `crypto.Certificate()` as a function: @@ -120,7 +120,7 @@ const cert1 = new crypto.Certificate(); const cert2 = crypto.Certificate(); ``` -#### certificate.exportChallenge(spkac) +#### `certificate.exportChallenge(spkac)` <!-- YAML added: v0.11.8 --> @@ -137,7 +137,7 @@ console.log(challenge.toString('utf8')); // Prints: the challenge as a UTF8 string ``` -#### certificate.exportPublicKey(spkac) +#### `certificate.exportPublicKey(spkac)` <!-- YAML added: v0.11.8 --> @@ -154,7 +154,7 @@ console.log(publicKey); // Prints: the public key as <Buffer ...> ``` -#### certificate.verifySpkac(spkac) +#### `certificate.verifySpkac(spkac)` <!-- YAML added: v0.11.8 --> @@ -170,7 +170,7 @@ console.log(cert.verifySpkac(Buffer.from(spkac))); // Prints: true or false ``` -## Class: Cipher +## Class: `Cipher` <!-- YAML added: v0.1.94 --> @@ -265,7 +265,7 @@ console.log(encrypted); // Prints: e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa ``` -### cipher.final(\[outputEncoding\]) +### `cipher.final([outputEncoding])` <!-- YAML added: v0.1.94 --> @@ -279,7 +279,7 @@ Once the `cipher.final()` method has been called, the `Cipher` object can no longer be used to encrypt data. Attempts to call `cipher.final()` more than once will result in an error being thrown. -### cipher.setAAD(buffer\[, options\]) +### `cipher.setAAD(buffer[, options])` <!-- YAML added: v1.0.0 --> @@ -299,7 +299,7 @@ of the plaintext in bytes. See [CCM mode][]. The `cipher.setAAD()` method must be called before [`cipher.update()`][]. -### cipher.getAuthTag() +### `cipher.getAuthTag()` <!-- YAML added: v1.0.0 --> @@ -312,7 +312,7 @@ added: v1.0.0 The `cipher.getAuthTag()` method should only be called after encryption has been completed using the [`cipher.final()`][] method. -### cipher.setAutoPadding(\[autoPadding\]) +### `cipher.setAutoPadding([autoPadding])` <!-- YAML added: v0.7.1 --> @@ -332,7 +332,7 @@ using `0x0` instead of PKCS padding. The `cipher.setAutoPadding()` method must be called before [`cipher.final()`][]. -### cipher.update(data\[, inputEncoding\]\[, outputEncoding\]) +### `cipher.update(data[, inputEncoding][, outputEncoding])` <!-- YAML added: v0.1.94 changes: @@ -362,7 +362,7 @@ The `cipher.update()` method can be called multiple times with new data until [`cipher.final()`][] is called. Calling `cipher.update()` after [`cipher.final()`][] will result in an error being thrown. -## Class: Decipher +## Class: `Decipher` <!-- YAML added: v0.1.94 --> @@ -459,7 +459,7 @@ console.log(decrypted); // Prints: some clear text data ``` -### decipher.final(\[outputEncoding\]) +### `decipher.final([outputEncoding])` <!-- YAML added: v0.1.94 --> @@ -473,7 +473,7 @@ Once the `decipher.final()` method has been called, the `Decipher` object can no longer be used to decrypt data. Attempts to call `decipher.final()` more than once will result in an error being thrown. -### decipher.setAAD(buffer\[, options\]) +### `decipher.setAAD(buffer[, options])` <!-- YAML added: v1.0.0 changes: @@ -497,7 +497,7 @@ of the plaintext in bytes. See [CCM mode][]. The `decipher.setAAD()` method must be called before [`decipher.update()`][]. -### decipher.setAuthTag(buffer) +### `decipher.setAuthTag(buffer)` <!-- YAML added: v1.0.0 changes: @@ -523,7 +523,7 @@ is invalid according to [NIST SP 800-38D][] or does not match the value of the The `decipher.setAuthTag()` method must be called before [`decipher.final()`][] and can only be called once. -### decipher.setAutoPadding(\[autoPadding\]) +### `decipher.setAutoPadding([autoPadding])` <!-- YAML added: v0.7.1 --> @@ -541,7 +541,7 @@ multiple of the ciphers block size. The `decipher.setAutoPadding()` method must be called before [`decipher.final()`][]. -### decipher.update(data\[, inputEncoding\]\[, outputEncoding\]) +### `decipher.update(data[, inputEncoding][, outputEncoding])` <!-- YAML added: v0.1.94 changes: @@ -570,7 +570,7 @@ The `decipher.update()` method can be called multiple times with new data until [`decipher.final()`][] is called. Calling `decipher.update()` after [`decipher.final()`][] will result in an error being thrown. -## Class: DiffieHellman +## Class: `DiffieHellman` <!-- YAML added: v0.5.0 --> @@ -601,7 +601,7 @@ const bobSecret = bob.computeSecret(aliceKey); assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); ``` -### diffieHellman.computeSecret(otherPublicKey\[, inputEncoding\]\[, outputEncoding\]) +### `diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])` <!-- YAML added: v0.5.0 --> @@ -622,7 +622,7 @@ provided, `otherPublicKey` is expected to be a [`Buffer`][], If `outputEncoding` is given a string is returned; otherwise, a [`Buffer`][] is returned. -### diffieHellman.generateKeys(\[encoding\]) +### `diffieHellman.generateKeys([encoding])` <!-- YAML added: v0.5.0 --> @@ -636,7 +636,7 @@ transferred to the other party. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### diffieHellman.getGenerator(\[encoding\]) +### `diffieHellman.getGenerator([encoding])` <!-- YAML added: v0.5.0 --> @@ -648,7 +648,7 @@ Returns the Diffie-Hellman generator in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### diffieHellman.getPrime(\[encoding\]) +### `diffieHellman.getPrime([encoding])` <!-- YAML added: v0.5.0 --> @@ -660,7 +660,7 @@ Returns the Diffie-Hellman prime in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### diffieHellman.getPrivateKey(\[encoding\]) +### `diffieHellman.getPrivateKey([encoding])` <!-- YAML added: v0.5.0 --> @@ -672,7 +672,7 @@ Returns the Diffie-Hellman private key in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### diffieHellman.getPublicKey(\[encoding\]) +### `diffieHellman.getPublicKey([encoding])` <!-- YAML added: v0.5.0 --> @@ -684,7 +684,7 @@ Returns the Diffie-Hellman public key in the specified `encoding`. If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### diffieHellman.setPrivateKey(privateKey\[, encoding\]) +### `diffieHellman.setPrivateKey(privateKey[, encoding])` <!-- YAML added: v0.5.0 --> @@ -697,7 +697,7 @@ Sets the Diffie-Hellman private key. If the `encoding` argument is provided, to be a string. If no `encoding` is provided, `privateKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. -### diffieHellman.setPublicKey(publicKey\[, encoding\]) +### `diffieHellman.setPublicKey(publicKey[, encoding])` <!-- YAML added: v0.5.0 --> @@ -710,7 +710,7 @@ Sets the Diffie-Hellman public key. If the `encoding` argument is provided, to be a string. If no `encoding` is provided, `publicKey` is expected to be a [`Buffer`][], `TypedArray`, or `DataView`. -### diffieHellman.verifyError +### `diffieHellman.verifyError` <!-- YAML added: v0.11.12 --> @@ -726,7 +726,7 @@ module): * `DH_UNABLE_TO_CHECK_GENERATOR` * `DH_NOT_SUITABLE_GENERATOR` -## Class: DiffieHellmanGroup +## Class: `DiffieHellmanGroup` <!-- YAML added: v0.7.5 --> @@ -753,7 +753,7 @@ modp17 modp18 ``` -## Class: ECDH +## Class: `ECDH` <!-- YAML added: v0.11.14 --> @@ -784,7 +784,7 @@ assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); // OK ``` -### Class Method: ECDH.convertKey(key, curve\[, inputEncoding\[, outputEncoding\[, format\]\]\]) +### Class Method: `ECDH.convertKey(key, curve[, inputEncoding[, outputEncoding[, format]]])` <!-- YAML added: v10.0.0 --> @@ -832,7 +832,7 @@ const uncompressedKey = ECDH.convertKey(compressedKey, console.log(uncompressedKey === ecdh.getPublicKey('hex')); ``` -### ecdh.computeSecret(otherPublicKey\[, inputEncoding\]\[, outputEncoding\]) +### `ecdh.computeSecret(otherPublicKey[, inputEncoding][, outputEncoding])` <!-- YAML added: v0.11.14 changes: @@ -867,7 +867,7 @@ lies outside of the elliptic curve. Since `otherPublicKey` is usually supplied from a remote user over an insecure network, its recommended for developers to handle this exception accordingly. -### ecdh.generateKeys(\[encoding\[, format\]\]) +### `ecdh.generateKeys([encoding[, format]])` <!-- YAML added: v0.11.14 --> @@ -887,7 +887,7 @@ The `format` argument specifies point encoding and can be `'compressed'` or If `encoding` is provided a string is returned; otherwise a [`Buffer`][] is returned. -### ecdh.getPrivateKey(\[encoding\]) +### `ecdh.getPrivateKey([encoding])` <!-- YAML added: v0.11.14 --> @@ -898,7 +898,7 @@ added: v0.11.14 If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is returned. -### ecdh.getPublicKey(\[encoding\]\[, format\]) +### `ecdh.getPublicKey([encoding][, format])` <!-- YAML added: v0.11.14 --> @@ -915,7 +915,7 @@ The `format` argument specifies point encoding and can be `'compressed'` or If `encoding` is specified, a string is returned; otherwise a [`Buffer`][] is returned. -### ecdh.setPrivateKey(privateKey\[, encoding\]) +### `ecdh.setPrivateKey(privateKey[, encoding])` <!-- YAML added: v0.11.14 --> @@ -932,7 +932,7 @@ If `privateKey` is not valid for the curve specified when the `ECDH` object was created, an error is thrown. Upon setting the private key, the associated public point (key) is also generated and set in the `ECDH` object. -### ecdh.setPublicKey(publicKey\[, encoding\]) +### `ecdh.setPublicKey(publicKey[, encoding])` <!-- YAML added: v0.11.14 deprecated: v5.2.0 @@ -979,7 +979,7 @@ const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); console.log(aliceSecret === bobSecret); ``` -## Class: Hash +## Class: `Hash` <!-- YAML added: v0.1.92 --> @@ -1041,7 +1041,7 @@ console.log(hash.digest('hex')); // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 ``` -### hash.copy(\[options\]) +### `hash.copy([options])` <!-- YAML added: v13.1.0 --> @@ -1076,7 +1076,7 @@ console.log(hash.copy().digest('hex')); // Etc. ``` -### hash.digest(\[encoding\]) +### `hash.digest([encoding])` <!-- YAML added: v0.1.92 --> @@ -1092,7 +1092,7 @@ a [`Buffer`][] is returned. The `Hash` object can not be used again after `hash.digest()` method has been called. Multiple calls will cause an error to be thrown. -### hash.update(data\[, inputEncoding\]) +### `hash.update(data[, inputEncoding])` <!-- YAML added: v0.1.92 changes: @@ -1112,7 +1112,7 @@ encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or This can be called many times with new data as it is streamed. -## Class: Hmac +## Class: `Hmac` <!-- YAML added: v0.1.94 --> @@ -1174,7 +1174,7 @@ console.log(hmac.digest('hex')); // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e ``` -### hmac.digest(\[encoding\]) +### `hmac.digest([encoding])` <!-- YAML added: v0.1.94 --> @@ -1189,7 +1189,7 @@ provided a string is returned; otherwise a [`Buffer`][] is returned; The `Hmac` object can not be used again after `hmac.digest()` has been called. Multiple calls to `hmac.digest()` will result in an error being thrown. -### hmac.update(data\[, inputEncoding\]) +### `hmac.update(data[, inputEncoding])` <!-- YAML added: v0.1.94 changes: @@ -1209,7 +1209,7 @@ encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or This can be called many times with new data as it is streamed. -## Class: KeyObject +## Class: `KeyObject` <!-- YAML added: v11.6.0 changes: @@ -1228,7 +1228,7 @@ keyword. Most applications should consider using the new `KeyObject` API instead of passing keys as strings or `Buffer`s due to improved security features. -### keyObject.asymmetricKeyType +### `keyObject.asymmetricKeyType` <!-- YAML added: v11.6.0 changes: @@ -1264,7 +1264,7 @@ types are: This property is `undefined` for unrecognized `KeyObject` types and symmetric keys. -### keyObject.export(\[options\]) +### `keyObject.export([options])` <!-- YAML added: v11.6.0 --> @@ -1307,7 +1307,7 @@ encryption mechanism, PEM-level encryption is not supported when encrypting a PKCS#8 key. See [RFC 5208][] for PKCS#8 encryption and [RFC 1421][] for PKCS#1 and SEC1 encryption. -### keyObject.symmetricKeySize +### `keyObject.symmetricKeySize` <!-- YAML added: v11.6.0 --> @@ -1317,7 +1317,7 @@ added: v11.6.0 For secret keys, this property represents the size of the key in bytes. This property is `undefined` for asymmetric keys. -### keyObject.type +### `keyObject.type` <!-- YAML added: v11.6.0 --> @@ -1328,7 +1328,7 @@ Depending on the type of this `KeyObject`, this property is either `'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys or `'private'` for private (asymmetric) keys. -## Class: Sign +## Class: `Sign` <!-- YAML added: v0.1.92 --> @@ -1389,7 +1389,7 @@ console.log(verify.verify(publicKey, signature)); // Prints: true ``` -### sign.sign(privateKey\[, outputEncoding\]) +### `sign.sign(privateKey[, outputEncoding])` <!-- YAML added: v0.1.92 changes: @@ -1442,7 +1442,7 @@ is returned. The `Sign` object can not be again used after `sign.sign()` method has been called. Multiple calls to `sign.sign()` will result in an error being thrown. -### sign.update(data\[, inputEncoding\]) +### `sign.update(data[, inputEncoding])` <!-- YAML added: v0.1.92 changes: @@ -1462,7 +1462,7 @@ encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or This can be called many times with new data as it is streamed. -## Class: Verify +## Class: `Verify` <!-- YAML added: v0.1.92 --> @@ -1482,7 +1482,7 @@ The [`crypto.createVerify()`][] method is used to create `Verify` instances. See [`Sign`][] for examples. -### verify.update(data\[, inputEncoding\]) +### `verify.update(data[, inputEncoding])` <!-- YAML added: v0.1.92 changes: @@ -1502,7 +1502,7 @@ encoding of `'utf8'` is enforced. If `data` is a [`Buffer`][], `TypedArray`, or This can be called many times with new data as it is streamed. -### verify.verify(object, signature\[, signatureEncoding\]) +### `verify.verify(object, signature[, signatureEncoding])` <!-- YAML added: v0.1.92 changes: @@ -1565,7 +1565,7 @@ be passed instead of a public key. ## `crypto` module methods and properties -### crypto.constants +### `crypto.constants` <!-- YAML added: v6.3.0 --> @@ -1574,7 +1574,7 @@ added: v6.3.0 security related operations. The specific constants currently defined are described in [Crypto Constants][]. -### crypto.DEFAULT_ENCODING +### `crypto.DEFAULT_ENCODING` <!-- YAML added: v0.9.3 deprecated: v10.0.0 @@ -1593,7 +1593,7 @@ New applications should expect the default to be `'buffer'`. This property is deprecated. -### crypto.fips +### `crypto.fips` <!-- YAML added: v6.0.0 deprecated: v10.0.0 @@ -1607,7 +1607,7 @@ is currently in use. Setting to true requires a FIPS build of Node.js. This property is deprecated. Please use `crypto.setFips()` and `crypto.getFips()` instead. -### crypto.createCipher(algorithm, password\[, options\]) +### `crypto.createCipher(algorithm, password[, options])` <!-- YAML added: v0.1.94 deprecated: v10.0.0 @@ -1663,7 +1663,7 @@ they are used in order to avoid the risk of IV reuse that causes vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries][] for details. -### crypto.createCipheriv(algorithm, key, iv\[, options\]) +### `crypto.createCipheriv(algorithm, key, iv[, options])` <!-- YAML added: v0.1.94 changes: @@ -1720,7 +1720,7 @@ something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be. -### crypto.createDecipher(algorithm, password\[, options\]) +### `crypto.createDecipher(algorithm, password[, options])` <!-- YAML added: v0.1.94 deprecated: v10.0.0 @@ -1757,7 +1757,7 @@ In line with OpenSSL's recommendation to use a more modern algorithm instead of their own using [`crypto.scrypt()`][] and to use [`crypto.createDecipheriv()`][] to create the `Decipher` object. -### crypto.createDecipheriv(algorithm, key, iv\[, options\]) +### `crypto.createDecipheriv(algorithm, key, iv[, options])` <!-- YAML added: v0.1.94 changes: @@ -1814,7 +1814,7 @@ something has to be unpredictable and unique, but does not have to be secret; remember that an attacker must not be able to predict ahead of time what a given IV will be. -### crypto.createDiffieHellman(prime\[, primeEncoding\]\[, generator\]\[, generatorEncoding\]) +### `crypto.createDiffieHellman(prime[, primeEncoding][, generator][, generatorEncoding])` <!-- YAML added: v0.11.12 changes: @@ -1849,7 +1849,7 @@ a [`Buffer`][], `TypedArray`, or `DataView` is expected. If `generatorEncoding` is specified, `generator` is expected to be a string; otherwise a number, [`Buffer`][], `TypedArray`, or `DataView` is expected. -### crypto.createDiffieHellman(primeLength\[, generator\]) +### `crypto.createDiffieHellman(primeLength[, generator])` <!-- YAML added: v0.5.0 --> @@ -1863,7 +1863,7 @@ 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) +### `crypto.createDiffieHellmanGroup(name)` <!-- YAML added: v0.9.3 --> @@ -1873,7 +1873,7 @@ added: v0.9.3 An alias for [`crypto.getDiffieHellman()`][] -### crypto.createECDH(curveName) +### `crypto.createECDH(curveName)` <!-- YAML added: v0.11.14 --> @@ -1887,7 +1887,7 @@ predefined curve specified by the `curveName` string. Use OpenSSL releases, `openssl ecparam -list_curves` will also display the name and description of each available elliptic curve. -### crypto.createHash(algorithm\[, options\]) +### `crypto.createHash(algorithm[, options])` <!-- YAML added: v0.1.92 changes: @@ -1933,7 +1933,7 @@ input.on('readable', () => { }); ``` -### crypto.createHmac(algorithm, key\[, options\]) +### `crypto.createHmac(algorithm, key[, options])` <!-- YAML added: v0.1.94 changes: @@ -1981,7 +1981,7 @@ input.on('readable', () => { }); ``` -### crypto.createPrivateKey(key) +### `crypto.createPrivateKey(key)` <!-- YAML added: v11.6.0 --> @@ -2001,7 +2001,7 @@ must be an object with the properties described above. If the private key is encrypted, a `passphrase` must be specified. The length of the passphrase is limited to 1024 bytes. -### crypto.createPublicKey(key) +### `crypto.createPublicKey(key)` <!-- YAML added: v11.6.0 changes: @@ -2036,7 +2036,7 @@ extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type `'private'` is given, a new `KeyObject` with type `'public'` will be returned and it will be impossible to extract the private key from the returned object. -### crypto.createSecretKey(key) +### `crypto.createSecretKey(key)` <!-- YAML added: v11.6.0 --> @@ -2047,7 +2047,7 @@ added: v11.6.0 Creates and returns a new key object containing a secret key for symmetric encryption or `Hmac`. -### crypto.createSign(algorithm\[, options\]) +### `crypto.createSign(algorithm[, options])` <!-- YAML added: v0.1.92 --> @@ -2066,7 +2066,7 @@ the corresponding digest algorithm. This does not work for all signature algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest algorithm names. -### crypto.createVerify(algorithm\[, options\]) +### `crypto.createVerify(algorithm[, options])` <!-- YAML added: v0.1.92 --> @@ -2086,7 +2086,7 @@ the corresponding digest algorithm. This does not work for all signature algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest algorithm names. -### crypto.generateKeyPair(type, options, callback) +### `crypto.generateKeyPair(type, options, callback)` <!-- YAML added: v10.12.0 changes: @@ -2151,7 +2151,7 @@ On completion, `callback` will be called with `err` set to `undefined` and If this method is invoked as its [`util.promisify()`][]ed version, it returns a `Promise` for an `Object` with `publicKey` and `privateKey` properties. -### crypto.generateKeyPairSync(type, options) +### `crypto.generateKeyPairSync(type, options)` <!-- YAML added: v10.12.0 changes: @@ -2208,7 +2208,7 @@ The return value `{ publicKey, privateKey }` represents the generated key pair. When PEM encoding was selected, the respective key will be a string, otherwise it will be a buffer containing the data encoded as DER. -### crypto.getCiphers() +### `crypto.getCiphers()` <!-- YAML added: v0.9.3 --> @@ -2221,7 +2221,7 @@ const ciphers = crypto.getCiphers(); console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...] ``` -### crypto.getCurves() +### `crypto.getCurves()` <!-- YAML added: v2.3.0 --> @@ -2233,7 +2233,7 @@ const curves = crypto.getCurves(); console.log(curves); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] ``` -### crypto.getDiffieHellman(groupName) +### `crypto.getDiffieHellman(groupName)` <!-- YAML added: v0.7.5 --> @@ -2269,7 +2269,7 @@ const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); console.log(aliceSecret === bobSecret); ``` -### crypto.getFips() +### `crypto.getFips()` <!-- YAML added: v10.0.0 --> @@ -2277,7 +2277,7 @@ added: v10.0.0 * Returns: {boolean} `true` if and only if a FIPS compliant crypto provider is currently in use. -### crypto.getHashes() +### `crypto.getHashes()` <!-- YAML added: v0.9.3 --> @@ -2290,7 +2290,7 @@ const hashes = crypto.getHashes(); console.log(hashes); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] ``` -### crypto.pbkdf2(password, salt, iterations, keylen, digest, callback) +### `crypto.pbkdf2(password, salt, iterations, keylen, digest, callback)` <!-- YAML added: v0.5.5 changes: @@ -2365,7 +2365,7 @@ This API uses libuv's threadpool, which can have surprising and negative performance implications for some applications; see the [`UV_THREADPOOL_SIZE`][] documentation for more information. -### crypto.pbkdf2Sync(password, salt, iterations, keylen, digest) +### `crypto.pbkdf2Sync(password, salt, iterations, keylen, digest)` <!-- YAML added: v0.9.3 changes: @@ -2424,7 +2424,7 @@ console.log(key); // '3745e48...aa39b34' An array of supported digest functions can be retrieved using [`crypto.getHashes()`][]. -### crypto.privateDecrypt(privateKey, buffer) +### `crypto.privateDecrypt(privateKey, buffer)` <!-- YAML added: v0.11.14 changes: @@ -2457,7 +2457,7 @@ If `privateKey` is not a [`KeyObject`][], this function behaves as if object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`. -### crypto.privateEncrypt(privateKey, buffer) +### `crypto.privateEncrypt(privateKey, buffer)` <!-- YAML added: v1.1.0 changes: @@ -2483,7 +2483,7 @@ If `privateKey` is not a [`KeyObject`][], this function behaves as if object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`. -### crypto.publicDecrypt(key, buffer) +### `crypto.publicDecrypt(key, buffer)` <!-- YAML added: v1.1.0 changes: @@ -2511,7 +2511,7 @@ object, the `padding` property can be passed. Otherwise, this function uses Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key. -### crypto.publicEncrypt(key, buffer) +### `crypto.publicEncrypt(key, buffer)` <!-- YAML added: v0.11.14 changes: @@ -2550,7 +2550,7 @@ object, the `padding` property can be passed. Otherwise, this function uses Because RSA public keys can be derived from private keys, a private key may be passed instead of a public key. -### crypto.randomBytes(size\[, callback\]) +### `crypto.randomBytes(size[, callback])` <!-- YAML added: v0.5.8 changes: @@ -2609,7 +2609,7 @@ threadpool request. To minimize threadpool task length variation, partition large `randomBytes` requests when doing so as part of fulfilling a client request. -### crypto.randomFillSync(buffer\[, offset\]\[, size\]) +### `crypto.randomFillSync(buffer[, offset][, size])` <!-- YAML added: - v7.10.0 @@ -2655,7 +2655,7 @@ console.log(Buffer.from(crypto.randomFillSync(c).buffer, c.byteOffset, c.byteLength).toString('hex')); ``` -### crypto.randomFill(buffer\[, offset\]\[, size\], callback) +### `crypto.randomFill(buffer[, offset][, size], callback)` <!-- YAML added: - v7.10.0 @@ -2730,7 +2730,7 @@ threadpool request. To minimize threadpool task length variation, partition large `randomFill` requests when doing so as part of fulfilling a client request. -### crypto.scrypt(password, salt, keylen\[, options\], callback) +### `crypto.scrypt(password, salt, keylen[, options], callback)` <!-- YAML added: v10.5.0 changes: @@ -2788,7 +2788,7 @@ crypto.scrypt('secret', 'salt', 64, { N: 1024 }, (err, derivedKey) => { }); ``` -### crypto.scryptSync(password, salt, keylen\[, options\]) +### `crypto.scryptSync(password, salt, keylen[, options])` <!-- YAML added: v10.5.0 changes: @@ -2839,7 +2839,7 @@ const key2 = crypto.scryptSync('secret', 'salt', 64, { N: 1024 }); console.log(key2.toString('hex')); // '3745e48...aa39b34' ``` -### crypto.setEngine(engine\[, flags\]) +### `crypto.setEngine(engine[, flags])` <!-- YAML added: v0.11.11 --> @@ -2873,7 +2873,7 @@ The flags below are deprecated in OpenSSL-1.1.0. * `crypto.constants.ENGINE_METHOD_ECDSA` * `crypto.constants.ENGINE_METHOD_STORE` -### crypto.setFips(bool) +### `crypto.setFips(bool)` <!-- YAML added: v10.0.0 --> @@ -2883,7 +2883,7 @@ added: v10.0.0 Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available. -### crypto.sign(algorithm, data, key) +### `crypto.sign(algorithm, data, key)` <!-- YAML added: v12.0.0 --> @@ -2917,7 +2917,7 @@ additional properties can be passed: size, `crypto.constants.RSA_PSS_SALTLEN_MAX_SIGN` (default) sets it to the maximum permissible value. -### crypto.timingSafeEqual(a, b) +### `crypto.timingSafeEqual(a, b)` <!-- YAML added: v6.6.0 --> @@ -2939,7 +2939,7 @@ Use of `crypto.timingSafeEqual` does not guarantee that the *surrounding* code is timing-safe. Care should be taken to ensure that the surrounding code does not introduce timing vulnerabilities. -### crypto.verify(algorithm, data, key, signature) +### `crypto.verify(algorithm, data, key, signature)` <!-- YAML added: v12.0.0 --> |