Namespace node.crypto

Use require('crypto') to access this module. The crypto module requires OpenSSL to be available on the underlying platform. It offers a way of encapsulating secure credentials to be used as part of a secure HTTPS net or http connection. It also offers a set of wrappers for OpenSSL's hash, hmac, cipher, decipher, sign and verify methods.

Method Summary

Method Attributes Method Name and Description
static  
node.crypto.createCipher(cipher, key)
Creates and returns a cipher object, with the given algorithm and key.
static  
node.crypto.createCipheriv(cipher, key, iv)
static  
node.crypto.createCredentials(options)
Creates a credentials object, with the optional details being a dictionary with keys: * key : a string holding the PEM encoded private key * cert : a string holding the PEM encoded certificate * ca : either a string or list of strings of PEM encoded CA certificates to trust.
static  
node.crypto.createDecipher(cipher, key)
Creates and returns a decipher object, with the given algorithm and key.
static  
node.crypto.createDecipheriv(cipher, key, iv)
static  
node.crypto.createHash(hash)
Creates and returns a hash object, a cryptographic hash with the given algorithm which can be used to generate hash digests.
static  
node.crypto.createHmac(hmac, key)
Creates and returns a hmac object, a cryptographic hmac with the given algorithm and key.
static  
node.crypto.createSign(algorithm)
Creates and returns a signing object, with the given algorithm.
static  
node.crypto.createVerify(algorithm)
Creates and returns a verification object, with the given algorithm.

Method Detail

  • static node.crypto.createCipher(cipher, key)
    Creates and returns a cipher object, with the given algorithm and key. algorithm is dependent on OpenSSL, examples are 'aes192', etc. On recent releases, openssl list-cipher-algorithms will display the available cipher algorithms.
    Parameters:
    {string} cipher
    {string} key
  • static node.crypto.createCipheriv(cipher, key, iv)
    Parameters:
    {string} cipher
    {string} key
    {string} iv
  • static node.crypto.createCredentials(options)
    Creates a credentials object, with the optional details being a dictionary with keys: * key : a string holding the PEM encoded private key * cert : a string holding the PEM encoded certificate * ca : either a string or list of strings of PEM encoded CA certificates to trust. If no 'ca' details are given, then node.js will use the default publicly trusted list of CAs as given in .
    Parameters:
    {Object} options
  • static node.crypto.createDecipher(cipher, key)
    Creates and returns a decipher object, with the given algorithm and key. This is the mirror of the cipher object above.
    Parameters:
    {string} cipher
    {string} key
  • static node.crypto.createDecipheriv(cipher, key, iv)
    Parameters:
    {string} cipher
    {string} key
    {string} iv
  • static node.crypto.createHash(hash)
    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 'sha1', 'md5', 'sha256', 'sha512', etc. On recent releases, openssl list-message-digest-algorithms will display the available digest algorithms.
    Parameters:
    {string} hash
  • static node.crypto.createHmac(hmac, key)
    Creates and returns a hmac object, a cryptographic hmac with the given algorithm and key. algorithm is dependent on the available algorithms supported by OpenSSL - see createHash above. key is the hmac key to be used.
    Parameters:
    {string} hmac
    {string} key
  • static node.crypto.createSign(algorithm)
    Creates and returns a signing object, with the given algorithm. On recent OpenSSL releases, openssl list-public-key-algorithms will display the available signing algorithms. Examples are 'RSA-SHA256'.
    Parameters:
    {string} algorithm
  • static node.crypto.createVerify(algorithm)
    Creates and returns a verification object, with the given algorithm. This is the mirror of the signing object above.
    Parameters:
    {string} algorithm