Trait/Object

io.scalajs.nodejs.crypto

Crypto

Related Docs: object Crypto | package crypto

Permalink

trait Crypto extends Object

The crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign and verify functions.

Annotations
@RawJSType() @native()
See also

https://nodejs.org/dist/latest-v7.x/docs/api/crypto.html#crypto_crypto

Linear Supertypes
Object, Any, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Crypto
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def Certificate: Function0[Dynamic]

    Permalink
  5. def Cipher: Function0[Cipher]

    Permalink
  6. val DEFAULT_ENCODING: String

    Permalink

    The default encoding to use for functions that can take either strings or buffers.

    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.

  7. def Decipher: Function0[Decipher]

    Permalink
  8. def DiffieHellman: Function0[Dynamic]

    Permalink
  9. def ECDH: Function0[Dynamic]

    Permalink
  10. def Hash: Function0[Hash]

    Permalink
  11. def Hmac: Function0[Hmac]

    Permalink
  12. def Sign: Function0[Sign]

    Permalink
  13. def Verify: Function0[Verify]

    Permalink
  14. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  15. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  16. def createCipher(algorithm: String, password: |[Buffer, String]): Cipher

    Permalink

    Creates and returns a Cipher object that uses the given algorithm and password.

    Creates and returns a Cipher object that uses the given algorithm and password.

    algorithm

    The algorithm is dependent on OpenSSL, examples are 'aes192', etc. On recent OpenSSL releases, openssl list-cipher-algorithms will display the available cipher algorithms.

    password

    The password is used to derive the cipher key and initialization vector (IV). The value must be either a 'binary' encoded string or a Buffer.

    Example:
    1. crypto.createCipher(algorithm, password)

  17. def createDecipher(algorithm: String, password: |[Buffer, String]): Decipher

    Permalink

    Creates and returns a Decipher object that uses the given algorithm and password (key).

    Creates and returns a Decipher object that uses the given algorithm and password (key). The implementation of crypto.createDecipher() derives keys using the OpenSSL function EVP_BytesToKey with the digest algorithm set to MD5, one iteration, and no salt. The lack of salt allows dictionary attacks as the same password always creates the same key. 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 that developers derive a key and IV on their own using crypto.pbkdf2() and to use crypto.createDecipheriv() to create the Decipher object.

    Example:
    1. crypto.createDecipher(algorithm, password)

  18. def createHash(algorithm: String): Hash

    Permalink

    Creates and returns a Hash object that can be used to generate hash digests using the given 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.

    algorithm

    the given algorithm (e.g. 'sha256', 'sha512')

  19. def createHmac(algorithm: String, key: String): Hmac

    Permalink

    Creates and returns an Hmac object that uses the given algorithm and 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.

    algorithm

    the given algorithm (e.g. 'sha256', 'sha512')

    key

    The key is the HMAC key used to generate the cryptographic HMAC hash.

  20. def createSign(algorithm: String): Sign

    Permalink

    Creates and returns a Sign object that uses the given 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'.

    algorithm

    the given algorithm (e.g. 'RSA-SHA256')

  21. def createVerify(algorithm: String): Verify

    Permalink

    Creates and returns a Verify object that uses the given 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'.

    algorithm

    the given algorithm (e.g. 'RSA-SHA256')

  22. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  24. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  25. var fips: Boolean

    Permalink

    Property for checking and controlling whether a FIPS compliant crypto provider is currently in use.

    Property for checking and controlling whether a FIPS compliant crypto provider is currently in use. Setting to true requires a FIPS build of Node.js.

  26. def getCiphers(): Array[String]

    Permalink

    Returns an array with the names of the supported cipher algorithms.

    Returns an array with the names of the supported cipher algorithms.

    returns

    the names of the supported cipher algorithms. // ['aes-128-cbc', 'aes-128-ccm', ...]

  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hasOwnProperty(v: String): Boolean

    Permalink
    Definition Classes
    Object
  29. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  30. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  31. def isPrototypeOf(v: Object): Boolean

    Permalink
    Definition Classes
    Object
  32. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  33. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  34. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  35. def pbkdf2Sync(password: String, salt: String, iterations: Int, keylen: Int, digest: String): Buffer

    Permalink

    Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) implementation.

    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 an error occurs an Error will be thrown, otherwise the derived key will be returned as a Buffer.

    The iterations argument must be a number set as high as possible. The higher the number of iterations, the more secure the derived key will be, but will take a longer amount of time to complete.

    The salt should also be as unique as possible. It is recommended that the salts are random and their lengths are greater than 16 bytes. See NIST SP 800-132 for details.

    (Doc source: https://nodejs.org/api/crypto.html#crypto_crypto_pbkdf2sync_password_salt_iterations_keylen_digest)

  36. def propertyIsEnumerable(v: String): Boolean

    Permalink
    Definition Classes
    Object
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  38. def toLocaleString(): String

    Permalink
    Definition Classes
    Object
  39. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  40. def valueOf(): Any

    Permalink
    Definition Classes
    Object
  41. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped