data event (net.Socket)

Event: 'data' <Buffer> Emitted when data is received. The argument data will be a Buffer or String. Encoding of data is set by socket.setEncoding(). (See the Readable Stream section for more information.) Note that the data will be lost if there is no listener when a Socket emits a 'data' event.

crypto.publicDecrypt()

crypto.publicDecrypt(public_key, buffer) Decrypts buffer with public_key. public_key can be an object or a string. If public_key is a string, it is treated as the key with no passphrase and will use RSA_PKCS1_PADDING. If public_key is an object, it is interpreted as a hash object with the keys: key : {String} - PEM encoded public key passphrase : {String} - Optional passphrase for the private key padding : An optional padding value, one of the following:constants.RSA_NO_PADDING constants.R

crypto.publicEncrypt()

crypto.publicEncrypt(public_key, buffer) Encrypts buffer with public_key. public_key can be an object or a string. If public_key is a string, it is treated as the key with no passphrase and will use RSA_PKCS1_OAEP_PADDING. If public_key is an object, it is interpreted as a hash object with the keys: key : {String} - PEM encoded public key passphrase : {String} - Optional passphrase for the private key padding : An optional padding value, one of the following:constants.RSA_NO_PADDING consta

crypto.randomBytes()

crypto.randomBytes(size[, callback]) Generates cryptographically strong pseudo-random data. The size argument is a number indicating the number of bytes to generate. If a callback function is provided, the bytes are generated asynchronously and the callback function is invoked with two arguments: err and buf. If an error occurs, err will be an Error object; otherwise it is null. The buf argument is a Buffer containing the generated bytes. // Asynchronous const crypto = require('crypto'); cryp

crypto.setEngine()

crypto.setEngine(engine[, flags]) Load and set the engine for some or all OpenSSL functions (selected by flags). engine could be either an id or a path to the engine's shared library. The optional flags argument uses ENGINE_METHOD_ALL by default. The flags is a bit field taking one of or a mix of the following flags (defined in the constants module): ENGINE_METHOD_RSA ENGINE_METHOD_DSA ENGINE_METHOD_DH ENGINE_METHOD_RAND ENGINE_METHOD_ECDH ENGINE_METHOD_ECDSA ENGINE_METHOD_CIPHERS ENGINE_MET

crypto.privateEncrypt()

crypto.privateEncrypt(private_key, buffer) Encrypts buffer with private_key. private_key can be an object or a string. If private_key is a string, it is treated as the key with no passphrase and will use RSA_PKCS1_PADDING. If private_key is an object, it is interpreted as a hash object with the keys: key : {String} - PEM encoded private key passphrase : {String} - Optional passphrase for the private key padding : An optional padding value, one of the following:constants.RSA_NO_PADDING cons

crypto.privateDecrypt()

crypto.privateDecrypt(private_key, buffer) Decrypts buffer with private_key. private_key can be an object or a string. If private_key is a string, it is treated as the key with no passphrase and will use RSA_PKCS1_OAEP_PADDING. If private_key is an object, it is interpreted as a hash object with the keys: key : {String} - PEM encoded private key passphrase : {String} - Optional passphrase for the private key padding : An optional padding value, one of the following:constants.RSA_NO_PADDING

crypto.pbkdf2Sync()

crypto.pbkdf2Sync(password, salt, iterations, keylen[, digest]) Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by digest is applied to derive a key of the requested byte length (keylen) from the password, salt and iterations. If the digest algorithm is not specified, a default of 'sha1' is used. If an error occurs an Error will be thrown, otherwise the derived key will be returned as a Buffer. The iterations

crypto.pbkdf2()

crypto.pbkdf2(password, salt, iterations, keylen[, digest], callback) Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation. A selected HMAC digest algorithm specified by digest is applied to derive a key of the requested byte length (keylen) from the password, salt and iterations. If the digest algorithm is not specified, a default of 'sha1' is used. The supplied callback function is called with two arguments: err and derivedKey. If an error occurs, err wil

crypto.getCurves()

crypto.getCurves() Returns an array with the names of the supported elliptic curves. Example: const curves = crypto.getCurves(); console.log(curves); // ['secp256k1', 'secp384r1', ...]