crypto.getDiffieHellman()

crypto.getDiffieHellman(group_name) Creates a predefined DiffieHellman key exchange object. The supported groups are: 'modp1', 'modp2', 'modp5' (defined in RFC 2412, but see Caveats) and 'modp14', 'modp15', 'modp16', 'modp17', 'modp18' (defined in RFC 3526). The returned object mimics the interface of objects created by crypto.createDiffieHellman(), but will not allow changing the keys (with diffieHellman.setPublicKey() for example). The advantage of using this method is that the parties do not

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', ...]

crypto.getCiphers()

crypto.getCiphers() Returns an array with the names of the supported cipher algorithms. Example: const ciphers = crypto.getCiphers(); console.log(ciphers); // ['aes-128-cbc', 'aes-128-ccm', ...]

crypto.DEFAULT_ENCODING

crypto.DEFAULT_ENCODING The default encoding to use for functions that can take either strings or buffers. The default value is 'buffer', which makes methods default to Buffer objects. The crypto.DEFAULT_ENCODING mechanism is provided for backwards compatibility with legacy programs that expect 'binary' to be the default encoding. New applications should expect the default to be 'buffer'. This property may become deprecated in a future Node.js release.

crypto.createVerify()

crypto.createVerify(algorithm) Creates and returns a Verify object that uses the given algorithm. On recent OpenSSL releases, openssl list-public-key-algorithms will display the available signing algorithms. One example is 'RSA-SHA256'.

crypto.createSign()

crypto.createSign(algorithm) Creates and returns a Sign object that uses the given algorithm. On recent OpenSSL releases, openssl list-public-key-algorithms will display the available signing algorithms. One example is 'RSA-SHA256'.

crypto.createHmac()

crypto.createHmac(algorithm, key) Creates and returns an Hmac object that uses the given algorithm and key. The algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are 'sha256', 'sha512', etc. On recent releases of OpenSSL, openssl list-message-digest-algorithms will display the available digest algorithms. The key is the HMAC key used to generate the cryptographic HMAC hash. Example: generating the sha256 HMAC of a file const fil

crypto.createHash()

crypto.createHash(algorithm) Creates and returns a Hash object that can be used to generate hash digests using the given algorithm. The algorithm is dependent on the available algorithms supported by the version of OpenSSL on the platform. Examples are 'sha256', 'sha512', etc. On recent releases of OpenSSL, openssl list-message-digest-algorithms will display the available digest algorithms. Example: generating the sha256 sum of a file const filename = process.argv[2]; const crypto = require(

crypto.createECDH()

crypto.createECDH(curve_name) Creates an Elliptic Curve Diffie-Hellman (ECDH) key exchange object using a predefined curve specified by the curve_name string. Use crypto.getCurves() to obtain a list of available curve names. On recent OpenSSL releases, openssl ecparam -list_curves will also display the name and description of each available elliptic curve.

crypto.createDiffieHellman()

crypto.createDiffieHellman(prime[, prime_encoding][, generator][, generator_encoding]) Creates a DiffieHellman key exchange object using the supplied prime and an optional specific generator. The generator argument can be a number, string, or Buffer. If generator is not specified, the value 2 is used. The prime_encoding and generator_encoding arguments can be 'binary', 'hex', or 'base64'. If prime_encoding is specified, prime is expected to be a string; otherwise a Buffer is expected. If ge