chunk_id large_stringlengths 36 36 | doc_type large_stringclasses 2
values | category large_stringclasses 17
values | document large_stringclasses 50
values | version_raw large_stringclasses 590
values | chunk_index int64 0 262 | text large_stringlengths 11 5.69k | file_path large_stringclasses 882
values |
|---|---|---|---|---|---|---|---|
eab4a809-8235-5fbc-9c7a-9532b04ff0dd | docs | nodejs | nodejs_async_hooks | 9x | 23 | Installing async hooks via `async_hooks.createHook` enables promise execution
tracking. Example:
```None
const ah = require('async_hooks');
ah.createHook({ init() {} }).enable(); // forces PromiseHooks to be enabled.
Promise.resolve(1729).then(() => {
console.log(`eid ${ah.executionAsyncId()} tid ${ah.triggerAsyncId... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
43f2cdb5-1bfd-5ccc-b3b9-9085c43b355e | docs | nodejs | nodejs_async_hooks | 9x | 24 | not have the `before` and `after` callbacks fired on them. For more details see
the details of the V8 [PromiseHooks](https://docs.google.com/document/d/1rda3yKGHimKIhg5YeoAmCOtyURgsbTH_qaYR79FELlk) API.
## JavaScript Embedder API[#](#async_hooks_javascript_embedder_api)
Library developers that handle their own asynch... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
45a5b408-e24b-51e3-9efb-79214b43cb40 | docs | nodejs | nodejs_async_hooks | 9x | 25 | // new AsyncResource() also triggers init. If triggerAsyncId is omitted then
// async_hook.executionAsyncId() is used.
const asyncResource = new AsyncResource(
type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
);
// Run a function in the execution context of the resource. This will
// * estab... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
06eee291-009d-57f4-9340-dfc6b2955ae0 | docs | nodejs | nodejs_async_hooks | 9x | 26 | // Deprecated: Use asyncResource.runInAsyncScope instead.
asyncResource.emitAfter();
```
#### `AsyncResource(type[, options])`[#](#async_hooks_asyncresource_type_options)
* `type` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The type of async event.
* `options` [<Obj... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
c9e35c66-b51c-5e84-8fec-e2d8765978e1 | docs | nodejs | nodejs_async_hooks | 9x | 27 | **Default:** `false`
Example usage:
```None
class DBQuery extends AsyncResource {
constructor(db) {
super('DBQuery');
this.db = db;
}
getInfo(query, callback) {
this.db.get(query, (err, data) => {
this.runInAsyncScope(callback, null, err, data);
});
}
close() {
this.db = null... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
97d537bb-120a-5ed2-bce2-1c58b6d9484b | docs | nodejs | nodejs_async_hooks | 9x | 28 | before callbacks, call the function, trigger the AsyncHooks after callbacks, and
then restore the original execution context.
#### `asyncResource.emitBefore()`[#](#async_hooks_asyncresource_emitbefore)
Deprecated since: v9.6.0
[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`async... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
d3bf2d01-3abc-59f3-a69b-c9ab7b0c700c | docs | nodejs | nodejs_async_hooks | 9x | 29 | #### `asyncResource.emitAfter()`[#](#async_hooks_asyncresource_emitafter)
Deprecated since: v9.6.0
[Stability: 0](documentation.html#documentation_stability_index) - Deprecated: Use [`asyncResource.runInAsyncScope()`](#async_hooks_asyncresource_runinasyncscope_fn_thisarg_args) instead.
Call all `after` callbacks. If... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
205446e2-aa0a-53c4-aca7-d7a70191645d | docs | nodejs | nodejs_async_hooks | 9x | 30 | #### `asyncResource.emitDestroy()`[#](#async_hooks_asyncresource_emitdestroy)
Call all `destroy` hooks. This should only ever be called once. An error will
be thrown if it is called more than once. This **must** be manually called. If
the resource is left to be collected by the GC then the `destroy` hooks will
never b... | large_dataset/raw/docs/nodejs/async_hooks/async_hooks_9x.md |
d76027a5-4e3d-5eb4-bf0e-3e95943f1e6f | docs | nodejs | nodejs_crypto | 010x | 0 | # Crypto#
Source: https://nodejs.org/docs/latest-v0.10.x/api/crypto.html
Version: 0.10.x
```None
Stability: 2 - Unstable; API changes are being discussed for
future versions. Breaking changes will be minimized. See below.
```
Use `require('crypto')` to access this module.
The crypto module offers a way of encapsu... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
2f1e7985-ab21-554c-b4c0-9b821fefda78 | docs | nodejs | nodejs_crypto | 010x | 1 | ## crypto.createCredentials(details)[#](#crypto_crypto_createcredentials_details)
Creates a credentials object, with the optional details being a
dictionary with keys:
* `pfx` : A string or buffer holding the PFX or PKCS12 encoded private
key, certificate and CA certificates
* `key` : A string holding the PEM encod... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
53994179-0f60-5e4f-aa86-4b92f861c8d9 | docs | nodejs | nodejs_crypto | 010x | 2 | ## crypto.createHash(algorithm)[#](#crypto_crypto_createhash_algorithm)
Creates and returns a hash object, a cryptographic hash with the given
algorithm which can be used to generate hash digests.
`algorithm` is dependent on the available algorithms supported by the
version of OpenSSL on the platform. Examples are `'... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
dcc93f78-69bd-552c-9930-c489bdccb6bb | docs | nodejs | nodejs_crypto | 010x | 3 | ## Class: Hash[#](#crypto_class_hash)
The class for creating hash digests of data.
It is a [stream](stream.html) that is both readable and writable. The
written data is used to compute the hash. Once the writable side of
the stream is ended, use the `read()` method to get the computed hash
digest. The legacy `update`... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
a86585fb-b25a-59b8-8c70-c2b539774776 | docs | nodejs | nodejs_crypto | 010x | 4 | ### hash.digest([encoding])[#](#crypto_hash_digest_encoding)
Calculates the digest of all of the passed data to be hashed. The
`encoding` can be `'hex'`, `'binary'` or `'base64'`. If no encoding
is provided, then a buffer is returned.
Note: `hash` object can not be used after `digest()` method has been
called.
## cr... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
e197299a-97a1-5d28-ad48-26e8c547cef1 | docs | nodejs | nodejs_crypto | 010x | 5 | ## Class: Hmac[#](#crypto_class_hmac)
Class for creating cryptographic hmac content.
Returned by `crypto.createHmac`.
### hmac.update(data)[#](#crypto_hmac_update_data)
Update the hmac content with the given `data`. This can be called
many times with new data as it is streamed.
### hmac.digest([encoding])[#](#cryp... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
1c32f609-bea1-57e2-9c2a-38c92212d880 | docs | nodejs | nodejs_crypto | 010x | 6 | which must be a `'binary'` encoded string or a [buffer](buffer.html).
It is a [stream](stream.html) that is both readable and writable. The
written data is used to compute the hash. Once the writable side of
the stream is ended, use the `read()` method to get the enciphered
contents. The legacy `update` and `final` me... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
290c195e-009d-5164-9990-2b982148e54a | docs | nodejs | nodejs_crypto | 010x | 7 | then use [createCipheriv()](#crypto_crypto_createcipheriv_algorithm_key_iv) to create the cipher stream.
## crypto.createCipheriv(algorithm, key, iv)[#](#crypto_crypto_createcipheriv_algorithm_key_iv)
Creates and returns a cipher object, with the given algorithm, key and
iv.
`algorithm` is the same as the argument t... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
ba57b61f-8634-54b2-befd-2b494ba4519f | docs | nodejs | nodejs_crypto | 010x | 8 | ### cipher.update(data, [input\_encoding], [output\_encoding])[#](#crypto_cipher_update_data_input_encoding_output_encoding)
Updates the cipher with `data`, the encoding of which is given in
`input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`. If no
encoding is provided, then a buffer is expected.
If `data` ... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
0d39302e-b5f3-5bed-b4f4-b320bd2edfb3 | docs | nodejs | nodejs_crypto | 010x | 9 | ### cipher.setAutoPadding(auto\_padding=true)[#](#crypto_cipher_setautopadding_auto_padding_true)
You can disable automatic padding of the input data to block size. If
`auto_padding` is false, the length of the entire input data must be a
multiple of the cipher's block size or `final` will fail. Useful for
non-standar... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
32a7481b-f3ea-5f75-a264-1d24390fc8bf | docs | nodejs | nodejs_crypto | 010x | 10 | ## Class: Decipher[#](#crypto_class_decipher)
Class for decrypting data.
Returned by `crypto.createDecipher` and `crypto.createDecipheriv`.
Decipher objects are [streams](stream.html) that are both readable and
writable. The written enciphered data is used to produce the
plain-text data on the the readable side. The... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
797f540d-ab0d-55d6-ae9b-ef18facd8974 | docs | nodejs | nodejs_crypto | 010x | 11 | ### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding)
Returns any remaining plaintext which is deciphered, with
`output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`. If
no encoding is provided, then a buffer is returned.
Note: `decipher` object can not be used after `final()` ... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
c54ef3ed-9365-55f9-ac96-2a6643c736af | docs | nodejs | nodejs_crypto | 010x | 12 | ## Class: Sign[#](#crypto_class_sign)
Class for generating signatures.
Returned by `crypto.createSign`.
Sign objects are writable [streams](stream.html). The written data is
used to generate the signature. Once all of the data has been
written, the `sign` method will return the signature. The legacy
`update` method ... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
f25c302a-a745-5112-82f1-f08c54b243fe | docs | nodejs | nodejs_crypto | 010x | 13 | ## crypto.createVerify(algorithm)[#](#crypto_crypto_createverify_algorithm)
Creates and returns a verification object, with the given algorithm.
This is the mirror of the signing object above.
## Class: Verify[#](#crypto_class_verify)
Class for verifying signatures.
Returned by `crypto.createVerify`.
Verify object... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
235ebda1-ab29-5c1c-a97a-ebab4acbc6e1 | docs | nodejs | nodejs_crypto | 010x | 14 | one of RSA public key, DSA public key, or X.509 certificate.
`signature` is the previously calculated signature for the data, in
the `signature_format` which can be `'binary'`, `'hex'` or `'base64'`.
If no encoding is specified, then a buffer is expected.
Returns true or false depending on the validity of the signatur... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
79aa1637-9fdc-5547-834e-bc85eae22d3c | docs | nodejs | nodejs_crypto | 010x | 15 | ## Class: DiffieHellman[#](#crypto_class_diffiehellman)
The class for creating Diffie-Hellman key exchanges.
Returned by `crypto.createDiffieHellman`.
### diffieHellman.generateKeys([encoding])[#](#crypto_diffiehellman_generatekeys_encoding)
Generates private and public Diffie-Hellman key values, and returns
the pu... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
e359adc0-a6ab-5516-9d7b-8701341f4aaf | docs | nodejs | nodejs_crypto | 010x | 16 | provided, then a buffer is expected.
If no output encoding is given, then a buffer is returned.
### diffieHellman.getPrime([encoding])[#](#crypto_diffiehellman_getprime_encoding)
Returns the Diffie-Hellman prime in the specified encoding, which can
be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided,
t... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
cb5de0df-18e7-55ec-9469-feb23cc6c2ab | docs | nodejs | nodejs_crypto | 010x | 17 | ### diffieHellman.getPrivateKey([encoding])[#](#crypto_diffiehellman_getprivatekey_encoding)
Returns the Diffie-Hellman private key in the specified encoding,
which can be `'binary'`, `'hex'`, or `'base64'`. If no encoding is
provided, then a buffer is returned.
### diffieHellman.setPublicKey(public\_key, [encoding])... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
e161077c-4e0a-504a-93df-b4bdeb9eb6d3 | docs | nodejs | nodejs_crypto | 010x | 18 | 2412](http://www.rfc-editor.org/rfc/rfc2412.txt)) and `'modp14'`, `'modp15'`, `'modp16'`, `'modp17'`,
`'modp18'` (defined in [RFC 3526](http://www.rfc-editor.org/rfc/rfc3526.txt)). The returned object mimics the
interface of objects created by [crypto.createDiffieHellman()](#crypto_crypto_creatediffiehellman_prime_enco... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
8269b1a8-4b56-5a00-96c8-1eb13857bfab | docs | nodejs | nodejs_crypto | 010x | 19 | /* alice_secret and bob_secret should be the same */
console.log(alice_secret == bob_secret);
```
## crypto.pbkdf2(password, salt, iterations, keylen, callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_callback)
Asynchronous PBKDF2 applies pseudorandom function HMAC-SHA1 to derive
a key of given lengt... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
c54d097e-c0bf-5644-9db3-7267090c6255 | docs | nodejs | nodejs_crypto | 010x | 20 | console.log('Have %d bytes of random data: %s', buf.length, buf);
} catch (ex) {
// handle error
// most likely, entropy sources are drained
}
```
NOTE: Will throw error or invoke callback with error, if there is not enough
accumulated entropy to generate cryptographically strong data. In other words,
`crypto.ra... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
35f56317-b69a-561d-9086-b19ab78c1dc6 | docs | nodejs | nodejs_crypto | 010x | 21 | ## crypto.DEFAULT\_ENCODING[#](#crypto_crypto_default_encoding)
The default encoding to use for functions that can take either strings
or buffers. The default value is `'buffer'`, which makes it default
to using Buffer objects. This is here to make the crypto module more
easily compatible with legacy programs that exp... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
665320d5-94e7-5308-90f0-fe4b253f88fa | docs | nodejs | nodejs_crypto | 010x | 22 | For example, if you currently use the default arguments to the Sign
class, and then pass the results to the Verify class, without ever
inspecting the data, then it will continue to work as before. Where
you once got a binary string and then presented the binary string to
the Verify object, you'll now get a Buffer, and ... | large_dataset/raw/docs/nodejs/crypto/crypto_010x.md |
0338f7ec-14fc-521c-82a2-e25b7feb7235 | docs | nodejs | nodejs_crypto | 012x | 0 | # Crypto#
Source: https://nodejs.org/docs/latest-v0.12.x/api/crypto.html
Version: 0.12.x
```None
Stability: 2 - Unstable; API changes are being discussed for
future versions. Breaking changes will be minimized. See below.
```
Use `require('crypto')` to access this module.
The crypto module offers a way of encapsu... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
57ea7557-c0b7-58f1-9d23-927758ebe7b3 | docs | nodejs | nodejs_crypto | 012x | 1 | * `ENGINE_METHOD_ECDSA`
* `ENGINE_METHOD_CIPHERS`
* `ENGINE_METHOD_DIGESTS`
* `ENGINE_METHOD_STORE`
* `ENGINE_METHOD_PKEY_METH`
* `ENGINE_METHOD_PKEY_ASN1_METH`
* `ENGINE_METHOD_ALL`
* `ENGINE_METHOD_NONE`
## crypto.getCiphers()[#](#crypto_crypto_getciphers)
Returns an array with the names of the supported ciphers.
... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
7a59754a-ebe1-5a79-94f3-21a77db0deac | docs | nodejs | nodejs_crypto | 012x | 2 | key, certificate and CA certificates
* `key` : A string holding the PEM encoded private key
* `passphrase` : A string of passphrase for the private key or pfx
* `cert` : A string holding the PEM encoded certificate
* `ca` : Either a string or list of strings of PEM encoded CA
certificates to trust.
* `crl` : Either... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
8dae886c-af7e-5c26-85ba-e07b8158ad2e | docs | nodejs | nodejs_crypto | 012x | 3 | `algorithm` is dependent on the available algorithms supported by the
version of OpenSSL on the platform. Examples are `'sha1'`, `'md5'`,
`'sha256'`, `'sha512'`, etc. On recent releases, `openssl
list-message-digest-algorithms` will display the available digest
algorithms.
Example: this program that takes the sha1 sum... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
e2ee19a7-ef9e-517d-bc4d-92ee7082af95 | docs | nodejs | nodejs_crypto | 012x | 4 | Returned by `crypto.createHash`.
### hash.update(data[, input\_encoding])[#](#crypto_hash_update_data_input_encoding)
Updates the hash content with the given `data`, the encoding of which
is given in `input_encoding` and can be `'utf8'`, `'ascii'` or
`'binary'`. If no encoding is provided and the input is a string an... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
5fa66e9f-3241-5275-92f7-2ecd1386747d | docs | nodejs | nodejs_crypto | 012x | 5 | It is a [stream](stream.html) that is both readable and writable. The
written data is used to compute the hmac. Once the writable side of
the stream is ended, use the `read()` method to get the computed
digest. The legacy `update` and `digest` methods are also supported.
`algorithm` is dependent on the available algor... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
11923572-bb63-5608-8b42-bdb174b5f2f6 | docs | nodejs | nodejs_crypto | 012x | 6 | ## crypto.createCipher(algorithm, password)[#](#crypto_crypto_createcipher_algorithm_password)
Creates and returns a cipher object, with the given algorithm and
password.
`algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
recent releases, `openssl list-cipher-algorithms` will display the
available ... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
cf4cfd20-f040-5b09-82cc-b04200ee81ef | docs | nodejs | nodejs_crypto | 012x | 7 | The low iteration count and non-cryptographically secure hash algorithm allow
passwords to be tested very rapidly.
In line with OpenSSL's recommendation to use pbkdf2 instead of EVP\_BytesToKey it
is recommended you derive a key and iv yourself with [crypto.pbkdf2](#crypto_crypto_pbkdf2_password_salt_iterations_keylen... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
9b60d95f-c254-54b0-8062-83a7b1d16171 | docs | nodejs | nodejs_crypto | 012x | 8 | ## Class: Cipher[#](#crypto_class_cipher)
Class for encrypting data.
Returned by `crypto.createCipher` and `crypto.createCipheriv`.
Cipher objects are [streams](stream.html) that are both readable and
writable. The written plain text data is used to produce the
encrypted data on the readable side. The legacy `update... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
600d26ff-2d2b-558c-b396-3ba2a5a3f4d0 | docs | nodejs | nodejs_crypto | 012x | 9 | ### cipher.final([output\_encoding])[#](#crypto_cipher_final_output_encoding)
Returns any remaining enciphered contents, with `output_encoding`
being one of: `'binary'`, `'base64'` or `'hex'`. If no encoding is
provided, then a buffer is returned.
Note: `cipher` object can not be used after `final()` method has been
... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
b2b2c1d3-c65b-5b75-8cc4-0a169b27b4c5 | docs | nodejs | nodejs_crypto | 012x | 10 | encryption has been completed using the `final` method!
### cipher.setAAD(buffer)[#](#crypto_cipher_setaad_buffer)
For authenticated encryption modes (currently supported: GCM), this
method sets the value used for the additional authenticated data (AAD) input
parameter.
## crypto.createDecipher(algorithm, password)[... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
73155521-8e76-5173-b5ed-b58afd258c1e | docs | nodejs | nodejs_crypto | 012x | 11 | ## Class: Decipher[#](#crypto_class_decipher)
Class for decrypting data.
Returned by `crypto.createDecipher` and `crypto.createDecipheriv`.
Decipher objects are [streams](stream.html) that are both readable and
writable. The written enciphered data is used to produce the
plain-text data on the the readable side. The... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
eeb5af7c-afdd-5adb-9d63-0d528fe6f83e | docs | nodejs | nodejs_crypto | 012x | 12 | ### decipher.final([output\_encoding])[#](#crypto_decipher_final_output_encoding)
Returns any remaining plaintext which is deciphered, with
`output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`. If
no encoding is provided, then a buffer is returned.
Note: `decipher` object can not be used after `final()` ... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
5643ecda-f95d-5bf3-83a7-4eef98319cd5 | docs | nodejs | nodejs_crypto | 012x | 13 | `final` will throw, thus indicating that the ciphertext should
be discarded due to failed authentication.
### decipher.setAAD(buffer)[#](#crypto_decipher_setaad_buffer)
For authenticated encryption modes (currently supported: GCM), this
method sets the value used for the additional authenticated data (AAD) input
para... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
e24ad7d7-6992-50c3-899b-9f1b08b6fb52 | docs | nodejs | nodejs_crypto | 012x | 14 | ### sign.update(data)[#](#crypto_sign_update_data)
Updates the sign object with data. This can be called many times
with new data as it is streamed.
### sign.sign(private\_key[, output\_format])[#](#crypto_sign_sign_private_key_output_format)
Calculates the signature on all the updated data passed through the
sign.
... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
1bcf5e58-355e-5f23-b7cd-1cc950c5fd6b | docs | nodejs | nodejs_crypto | 012x | 15 | ## Class: Verify[#](#crypto_class_verify)
Class for verifying signatures.
Returned by `crypto.createVerify`.
Verify objects are writable [streams](stream.html). The written data
is used to validate against the supplied signature. Once all of the
data has been written, the `verify` method will return true if the
supp... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
7d7771ea-7bfb-5697-a0af-24704ede1ccb | docs | nodejs | nodejs_crypto | 012x | 16 | If no encoding is specified, then a buffer is expected.
Returns true or false depending on the validity of the signature for
the data and public key.
Note: `verifier` object can not be used after `verify()` method has been
called.
## crypto.createDiffieHellman(prime\_length[, generator])[#](#crypto_crypto_creatediff... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
0bdfbad5-25e6-515a-8805-68112a3a9c22 | docs | nodejs | nodejs_crypto | 012x | 17 | If no `prime_encoding` is specified, then a Buffer is expected for `prime`.
If no `generator_encoding` is specified, then a Buffer is expected for `generator`.
## Class: DiffieHellman[#](#crypto_class_diffiehellman)
The class for creating Diffie-Hellman key exchanges.
Returned by `crypto.createDiffieHellman`.
### d... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
0ad8431f-a579-5682-b5a0-64aeb24e6e7d | docs | nodejs | nodejs_crypto | 012x | 18 | or `'base64'`. If no encoding is provided, then a buffer is returned.
### diffieHellman.computeSecret(other\_public\_key[, input\_encoding][, output\_encoding])[#](#crypto_diffiehellman_computesecret_other_public_key_input_encoding_output_encoding)
Computes the shared secret using `other_public_key` as the other
part... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
af779331-bb4b-5159-9033-a55a169b0d2d | docs | nodejs | nodejs_crypto | 012x | 19 | ### diffieHellman.getGenerator([encoding])[#](#crypto_diffiehellman_getgenerator_encoding)
Returns the Diffie-Hellman generator in the specified encoding, which can
be `'binary'`, `'hex'`, or `'base64'`. If no encoding is provided,
then a buffer is returned.
### diffieHellman.getPublicKey([encoding])[#](#crypto_diffi... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
473cefc8-4cbb-51b5-b959-f97e2e155f0e | docs | nodejs | nodejs_crypto | 012x | 20 | `'hex'` or `'base64'`. If no encoding is provided, then a buffer is
expected.
### diffieHellman.setPrivateKey(private\_key[, encoding])[#](#crypto_diffiehellman_setprivatekey_private_key_encoding)
Sets the Diffie-Hellman private key. Key encoding can be `'binary'`,
`'hex'` or `'base64'`. If no encoding is provided, t... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
18416e0b-bee0-5690-9a23-264a63954550 | docs | nodejs | nodejs_crypto | 012x | 21 | [diffieHellman.setPublicKey()](#crypto_diffiehellman_setpublickey_public_key_encoding) for example). The advantage of using
this routine is that the parties don't have to generate nor exchange
group modulus beforehand, saving both processor and communication
time.
Example (obtaining a shared secret):
```None
var cryp... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
44b747e6-39cd-5736-94f0-ebca0016c1a5 | docs | nodejs | nodejs_crypto | 012x | 22 | ## Class: ECDH[#](#crypto_class_ecdh)
The class for creating EC Diffie-Hellman key exchanges.
Returned by `crypto.createECDH`.
### ECDH.generateKeys([encoding[, format]])[#](#crypto_ecdh_generatekeys_encoding_format)
Generates private and public EC Diffie-Hellman key values, and returns
the public key in the specif... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
a3df3766-b644-5add-924b-460823d2708d | docs | nodejs | nodejs_crypto | 012x | 23 | key is interpreted using specified `input_encoding`, and secret is
encoded using specified `output_encoding`. Encodings can be
`'binary'`, `'hex'`, or `'base64'`. If the input encoding is not
provided, then a buffer is expected.
If no output encoding is given, then a buffer is returned.
### ECDH.getPublicKey([encodin... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
1ecc61d1-0cc3-5d33-be14-1b9a367d853d | docs | nodejs | nodejs_crypto | 012x | 24 | ### ECDH.setPublicKey(public\_key[, encoding])[#](#crypto_ecdh_setpublickey_public_key_encoding)
Sets the EC Diffie-Hellman public key. Key encoding can be `'binary'`,
`'hex'` or `'base64'`. If no encoding is provided, then a buffer is
expected.
### ECDH.setPrivateKey(private\_key[, encoding])[#](#crypto_ecdh_setpriv... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
90e0a5e3-bf18-55d4-a0bb-b0dd9be80976 | docs | nodejs | nodejs_crypto | 012x | 25 | ## crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback)[#](#crypto_crypto_pbkdf2_password_salt_iterations_keylen_digest_callback)
Asynchronous PBKDF2 function. Applies the selected HMAC digest function
(default: SHA1) to derive a key of the requested length from the password,
salt and number of iterat... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
7153315c-e7f6-58ad-a5a1-db69e3bcc0d5 | docs | nodejs | nodejs_crypto | 012x | 26 | ## crypto.randomBytes(size[, callback])[#](#crypto_crypto_randombytes_size_callback)
Generates cryptographically strong pseudo-random data. Usage:
```None
// async
crypto.randomBytes(256, function(ex, buf) {
if (ex) throw ex;
console.log('Have %d bytes of random data: %s', buf.length, buf);
});
// sync
try {
v... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
470adda0-1c98-5869-ab3f-680b13fdf54c | docs | nodejs | nodejs_crypto | 012x | 27 | necessarily unpredictable. For this reason, the output of this
function should never be used where unpredictability is important,
such as in the generation of encryption keys.
Usage is otherwise identical to `crypto.randomBytes`.
## Class: Certificate[#](#crypto_class_certificate)
The class used for working with sig... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
750a0cb3-f7ba-529c-abf5-ac9cf468fbc3 | docs | nodejs | nodejs_crypto | 012x | 28 | ### Certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac)
Exports the encoded challenge associated with the SPKAC.
## crypto.publicEncrypt(public\_key, buffer)[#](#crypto_crypto_publicencrypt_public_key_buffer)
Encrypts `buffer` with `public_key`. Only RSA is currently supported.
`public_... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
911a2546-0707-584c-9389-cb8cc4957fbb | docs | nodejs | nodejs_crypto | 012x | 29 | treated as the key with no passphrase and will use `RSA_PKCS1_OAEP_PADDING`.
`private_key`:
* `key` : A string holding the PEM encoded private key
* `passphrase` : An optional string of passphrase for the private key
* `padding` : An optional padding value, one of the following:
+ `constants.RSA_NO_PADDING`
+ `co... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
c2f2bb24-686b-5cf8-942d-d07c7bc548c5 | docs | nodejs | nodejs_crypto | 012x | 30 | ## Recent API Changes[#](#crypto_recent_api_changes)
The Crypto module was added to Node before there was the concept of a
unified Stream API, and before there were Buffer objects for handling
binary data.
As such, the streaming classes don't have the typical methods found on
other Node classes, and many methods acce... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
c856e16e-98a0-53c6-8f1e-27e77f14e18f | docs | nodejs | nodejs_crypto | 012x | 31 | databases, etc.), or you are passing binary strings to the crypto
functions without an encoding argument, then you will need to start
providing encoding arguments to specify which encoding you'd like to
use. To switch to the previous style of using binary strings by
default, set the `crypto.DEFAULT_ENCODING` field to '... | large_dataset/raw/docs/nodejs/crypto/crypto_012x.md |
712ef1f2-d8f2-5d84-ae63-d1a241908fd4 | docs | nodejs | nodejs_crypto | 10x | 0 | # Crypto#
Source: https://nodejs.org/docs/latest-v10.x/api/crypto.html
Version: 10.x
[Stability: 2](documentation.html#documentation_stability_index) - Stable
The `crypto` module provides cryptographic functionality that includes a set of
wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify function... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
a508a41b-a9de-5284-a169-81da9d909d83 | docs | nodejs | nodejs_crypto | 10x | 1 | } catch (err) {
console.log('crypto support is disabled!');
}
```
## Class: Certificate[#](#crypto_class_certificate)
Added in: v0.11.8
SPKAC is a Certificate Signing Request mechanism originally implemented by
Netscape and was specified formally as part of [HTML5's `keygen` element](https://developer.mozilla.org/... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
d0ee029e-1cff-5aec-ae4a-dfcfe4aa6ba2 | docs | nodejs | nodejs_crypto | 10x | 2 | ### Certificate.exportChallenge(spkac)[#](#crypto_certificate_exportchallenge_spkac)
Added in: v9.0.0
* `spkac` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/Ja... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
0b481039-9f41-5c48-9753-5daa1f03df0d | docs | nodejs | nodejs_crypto | 10x | 3 | ### Certificate.exportPublicKey(spkac[, encoding])[#](#crypto_certificate_exportpublickey_spkac_encoding)
Added in: v9.0.0
* `spkac` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
644b1664-83c3-52ec-964b-73a48593aa12 | docs | nodejs | nodejs_crypto | 10x | 4 | // Prints: the public key as <Buffer ...>
```
### Certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac)
Added in: v9.0.0
* `spkac` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
8055c646-2464-5710-a0bf-4d614f74ca43 | docs | nodejs | nodejs_crypto | 10x | 5 | #### new crypto.Certificate()[#](#crypto_new_crypto_certificate)
Instances of the `Certificate` class can be created using the `new` keyword
or by calling `crypto.Certificate()` as a function:
```None
const crypto = require('crypto');
const cert1 = new crypto.Certificate();
const cert2 = crypto.Certificate();
```
#... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
372ccd08-8042-522e-bbf5-94843f18f687 | docs | nodejs | nodejs_crypto | 10x | 6 | const spkac = getSpkacSomehow();
const challenge = cert.exportChallenge(spkac);
console.log(challenge.toString('utf8'));
// Prints: the challenge as a UTF8 string
```
#### certificate.exportPublicKey(spkac)[#](#crypto_certificate_exportpublickey_spkac)
Added in: v0.11.8
* `spkac` [<string>](https://developer.mozilla... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
2576775b-0a4e-54c4-b4b7-47227bab23fb | docs | nodejs | nodejs_crypto | 10x | 7 | #### certificate.verifySpkac(spkac)[#](#crypto_certificate_verifyspkac_spkac_1)
Added in: v0.11.8
* `spkac` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
dd4dabf0-7175-50c5-a087-245d036f7ad9 | docs | nodejs | nodejs_crypto | 10x | 8 | data is written to produce encrypted data on the readable side, or
* Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods to produce
the encrypted data.
The [`crypto.createCipher()`](#crypto_crypto_createcipher_al... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
e0116a0d-4aed-5ddb-9940-83740d334dc1 | docs | nodejs | nodejs_crypto | 10x | 9 | const iv = Buffer.alloc(16, 0); // Initialization vector.
const cipher = crypto.createCipheriv(algorithm, key, iv);
let encrypted = '';
cipher.on('readable', () => {
let chunk;
while (null !== (chunk = cipher.read())) {
encrypted += chunk.toString('hex');
}
});
cipher.on('end', () => {
console.log(encrypt... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
327d1dff-048c-5390-a3c5-ea7e7af7e705 | docs | nodejs | nodejs_crypto | 10x | 10 | const output = fs.createWriteStream('test.enc');
input.pipe(cipher).pipe(output);
```
Example: Using the [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding) and [`cipher.final()`](#crypto_cipher_final_outputencoding) methods:
```None
const crypto = require('crypto');
const algorithm = 'aes-... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
f1bbc54c-d933-5653-a15d-1678f17ce20c | docs | nodejs | nodejs_crypto | 10x | 11 | ### cipher.final([outputEncoding])[#](#crypto_cipher_final_outputencoding)
Added in: v0.1.94
* `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value.
* Returns: [<Buffer>](... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
de1d10b9-ea5e-50a4-a9b4-ad5bcbdfc578 | docs | nodejs | nodejs_crypto | 10x | 12 | ### cipher.setAAD(buffer[, options])[#](#crypto_cipher_setaad_buffer_options)
Added in: v1.0.0
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer)
* `options` [<Object>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object) [`stream.transform` options](stream.html#stream_new_stre... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
b523bf62-1ad8-5c3e-b1b9-5d93173035c8 | docs | nodejs | nodejs_crypto | 10x | 13 | The `cipher.setAAD()` method must be called before [`cipher.update()`](#crypto_cipher_update_data_inputencoding_outputencoding).
### cipher.getAuthTag()[#](#crypto_cipher_getauthtag)
Added in: v1.0.0
* Returns: [<Buffer>](buffer.html#buffer_class_buffer) When using an authenticated encryption mode (`GCM`, `CCM`
an... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
e43f0aad-82d8-5afc-ab90-41ea7b894d59 | docs | nodejs | nodejs_crypto | 10x | 14 | When using block encryption algorithms, the `Cipher` class will automatically
add padding to the input data to the appropriate block size. To disable the
default padding call `cipher.setAutoPadding(false)`.
When `autoPadding` is `false`, the length of the entire input data must be a
multiple of the cipher's block size... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
1a05b6ab-5a91-50bd-8af5-389f9a09ddfa | docs | nodejs | nodejs_crypto | 10x | 15 | * `data` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/docs/Web... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
075fcd57-4a77-5aed-ad9c-18b96bca142b | docs | nodejs | nodejs_crypto | 10x | 16 | argument is a string using the specified encoding. If the `inputEncoding`
argument is not given, `data` must be a [`Buffer`](buffer.html), `TypedArray`, or
`DataView`. If `data` is a [`Buffer`](buffer.html), `TypedArray`, or `DataView`, then
`inputEncoding` is ignored.
The `outputEncoding` specifies the output format ... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
37809de8-f6ed-5f43-87e5-11c067a2cf4e | docs | nodejs | nodejs_crypto | 10x | 17 | * As a [stream](stream.html) that is both readable and writable, where plain encrypted
data is written to produce unencrypted data on the readable side, or
* Using the [`decipher.update()`](#crypto_decipher_update_data_inputencoding_outputencoding) and [`decipher.final()`](#crypto_decipher_final_outputencoding) metho... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
06cb84a3-43b2-5568-8c6a-d8b79ce43169 | docs | nodejs | nodejs_crypto | 10x | 18 | const key = crypto.scryptSync(password, 'salt', 24);
// The IV is usually passed along with the ciphertext.
const iv = Buffer.alloc(16, 0); // Initialization vector.
const decipher = crypto.createDecipheriv(algorithm, key, iv);
let decrypted = '';
decipher.on('readable', () => {
while (null !== (chunk = decipher.re... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
541e2320-95da-5c37-b32d-328c21fc8cb8 | docs | nodejs | nodejs_crypto | 10x | 19 | const iv = Buffer.alloc(16, 0); // Initialization vector.
const decipher = crypto.createDecipheriv(algorithm, key, iv);
const input = fs.createReadStream('test.enc');
const output = fs.createWriteStream('test.js');
input.pipe(decipher).pipe(output);
```
Example: Using the [`decipher.update()`](#crypto_decipher_upda... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
e91f17bf-ad9d-5521-9680-bbb1277f14ea | docs | nodejs | nodejs_crypto | 10x | 20 | let decrypted = decipher.update(encrypted, 'hex', 'utf8');
decrypted += decipher.final('utf8');
console.log(decrypted);
// Prints: some clear text data
```
### decipher.final([outputEncoding])[#](#crypto_decipher_final_outputencoding)
Added in: v0.1.94
* `outputEncoding` [<string>](https://developer.mozilla.org/en-U... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
241e0969-3ebe-5b20-933a-79996e70b8ea | docs | nodejs | nodejs_crypto | 10x | 21 | ### decipher.setAAD(buffer[, options])[#](#crypto_decipher_setaad_buffer_options)
History
| Version | Changes |
| --- | --- |
| v7.2.0 | This method now returns a reference to `decipher`. |
| v1.0.0 | Added in: v1.0.0 |
* `buffer` [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
69bb45c5-36e6-5f8c-ac9d-8947a50619cb | docs | nodejs | nodejs_crypto | 10x | 22 | currently supported), the `decipher.setAAD()` method sets the value used for the
*additional authenticated data* (AAD) input parameter.
The `options` argument is optional for `GCM`. When using `CCM`, the
`plaintextLength` option must be specified and its value must match the length
of the plaintext in bytes. See [CCM ... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
2671155a-80ac-5b63-95cb-16fc1786ca1e | docs | nodejs | nodejs_crypto | 10x | 23 | * Returns: [<Decipher>](crypto.html#crypto_class_decipher) for method chaining.
When using an authenticated encryption mode (`GCM`, `CCM` and `OCB` are
currently supported), the `decipher.setAuthTag()` method is used to pass in the
received *authentication tag*. If no tag is provided, or if the cipher text
has been ta... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
8cf67fe7-2076-5bd7-8605-e591c5ccc757 | docs | nodejs | nodejs_crypto | 10x | 24 | authentication tags of that length, see [NIST SP 800-38D](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf).
The `decipher.setAuthTag()` method must be called before
[`decipher.final()`](#crypto_decipher_final_outputencoding).
### decipher.setAutoPadding([autoPadding])[#](#crypto_decipher... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
f5eb1720-993e-58e4-bd9d-f0841d871468 | docs | nodejs | nodejs_crypto | 10x | 25 | [`decipher.final()`](#crypto_decipher_final_outputencoding).
### decipher.update(data[, inputEncoding][, outputencoding])[#](#crypto_decipher_update_data_inputencoding_outputencoding)
History
| Version | Changes |
| --- | --- |
| v6.0.0 | The default `inputEncoding` changed from `binary` to `utf8`. |
| v0.1.94 | Add... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
753c193e-5faf-50a1-bdcb-31b16d37b829 | docs | nodejs | nodejs_crypto | 10x | 26 | * `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value.
* Returns: [<Buffer>](buffer.html#buffer_class_buffer) | [<string>](https://developer.mozilla.org/en-US/docs/Web/Java... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
ba461c19-36d6-57bd-964a-a13e96cb42fb | docs | nodejs | nodejs_crypto | 10x | 27 | [`decipher.final()`](#crypto_decipher_final_outputencoding) is called. Calling `decipher.update()` after
[`decipher.final()`](#crypto_decipher_final_outputencoding) will result in an error being thrown.
## Class: DiffieHellman[#](#crypto_class_diffiehellman)
Added in: v0.5.0
The `DiffieHellman` class is a utility fo... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
5ecadf77-01a9-5f45-9de9-10ab3df873cf | docs | nodejs | nodejs_crypto | 10x | 28 | // OK
assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
```
### diffieHellman.computeSecret(otherPublicKey[, inputEncoding][, outputencoding])[#](#crypto_diffiehellman_computesecret_otherpublickey_inputencoding_outputencoding)
Added in: v0.5.0
* `otherPublicKey` [<string>](https://developer... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
ce258676-b28b-5941-b7e8-f923c51b5b00 | docs | nodejs | nodejs_crypto | 10x | 29 | * `outputEncoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value.
* Returns: [<Buffer>](buffer.html#buffer_class_buffer) | [<string>](https://developer.mozilla.org/en-US/docs/Web/Java... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
386f5fa6-e455-5fa2-bda5-b01958add33d | docs | nodejs | nodejs_crypto | 10x | 30 | ### diffieHellman.generateKeys([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_generatekeys_encoding)
Added in: v0.5.0
* `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_cha... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
5932563d-2067-5a93-9ec5-b817b0244bc7 | docs | nodejs | nodejs_crypto | 10x | 31 | * `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_character_encodings) of the return value.
* Returns: [<Buffer>](buffer.html#buffer_class_buffer) | [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
8c5940e8-e925-566a-9c04-06002326d222 | docs | nodejs | nodejs_crypto | 10x | 32 | Returns the Diffie-Hellman prime in the specified `encoding`.
If `encoding` is provided a string is
returned; otherwise a [`Buffer`](buffer.html) is returned.
### diffieHellman.getPrivateKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getprivatekey_encoding)
Added in: v0.5... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
5f0fd412-e32c-509c-95c8-a32d55308791 | docs | nodejs | nodejs_crypto | 10x | 33 | ### diffieHellman.getPublicKey([encoding](buffer.html#buffer_buffers_and_character_encodings))[#](#crypto_diffiehellman_getpublickey_encoding)
Added in: v0.5.0
* `encoding` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) The [encoding](buffer.html#buffer_buffers_and_cha... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
de8c02b0-1e3f-511e-9e87-51331491e8b6 | docs | nodejs | nodejs_crypto | 10x | 34 | * `privateKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) | [<DataView>](https://developer.mozilla.org/en-US/do... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
d058d1d4-9bb4-520f-aaab-e6020df525d3 | docs | nodejs | nodejs_crypto | 10x | 35 | ### diffieHellman.setPublicKey(publicKey[, encoding])[#](#crypto_diffiehellman_setpublickey_publickey_encoding)
Added in: v0.5.0
* `publicKey` [<string>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Buffer>](buffer.html#buffer_class_buffer) | [<TypedArray>](https://develope... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
db6c8ff1-aa48-526a-b5b5-611284bde4de | docs | nodejs | nodejs_crypto | 10x | 36 | ### diffieHellman.verifyError[#](#crypto_diffiehellman_verifyerror)
Added in: v0.11.12
A bit field containing any warnings and/or errors resulting from a check
performed during initialization of the `DiffieHellman` object.
The following values are valid for this property (as defined in `constants`
module):
* `DH_CH... | large_dataset/raw/docs/nodejs/crypto/crypto_10x.md |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.