CryptoStream

Class: CryptoStream Stability: 0 - Deprecated: Use tls.TLSSocket instead. This is an encrypted stream.

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.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.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.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.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.getHashes()

crypto.getHashes() Returns an array with the names of the supported hash algorithms. Example: const hashes = crypto.getHashes(); console.log(hashes); // ['sha', 'sha1', 'sha1WithRSAEncryption', ...]