object Crypto extends Object with Crypto
Crypto Singleton
- Annotations
- @native() @JSImport( "crypto" , JSImport.Namespace )
- Alphabetic
- By Inheritance
- Crypto
- Crypto
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type Cipher = crypto.Cipher
- type Decipher = crypto.Decipher
- type DiffieHellman = crypto.DiffieHellman
- type ECDH = crypto.ECDH
- type Hash = crypto.Hash
- type Hmac = crypto.Hmac
- type Sign = crypto.Sign
- type Verify = crypto.Verify
-
type
Certificate = crypto.Certificate
- Annotations
- @deprecated
- Deprecated
(Since version v0.10.0) Legacy API, not recommended to create new instance. Use Certificate object.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @HotSpotIntrinsicCandidate()
- val constants: Constants.type
-
def
createCipheriv(algorithm: String, key: |[String, BufferLike], iv: |[String, BufferLike], options: TransformOptions = js.native): crypto.Cipher
- Definition Classes
- Crypto
-
def
createDecipheriv(algorithm: String, key: KeyObject, iv: |[String, BufferLike]): crypto.Decipher
- Definition Classes
- Crypto
-
def
createDecipheriv(algorithm: String, key: KeyObject, iv: |[String, BufferLike], options: TransformOptions): crypto.Decipher
- Definition Classes
- Crypto
-
def
createDecipheriv(algorithm: String, key: |[String, BufferLike], iv: |[String, BufferLike], options: TransformOptions = js.native): crypto.Decipher
- Definition Classes
- Crypto
-
def
createDiffieHellman(primeLength: Int, generator: |[|[Int, String], BufferLike]): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createDiffieHellman(prime: BufferLike, generator: |[Int, BufferLike]): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createDiffieHellman(prime: BufferLike, generator: String, generatorEncoding: String): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createDiffieHellman(prime: String, primeEncoding: String, generator: String, generatorEncoding: String): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createDiffieHellman(prime: String, primeEncoding: String, generator: |[Int, BufferLike]): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createDiffieHellmanGroup(name: String): crypto.DiffieHellman
- Definition Classes
- Crypto
-
def
createECDH(curveName: String): crypto.ECDH
- Definition Classes
- Crypto
-
def
createHash(algorithm: String, options: CreateHashOptions = js.native): crypto.Hash
- Definition Classes
- Crypto
-
def
createHash(algorithm: String, options: TransformOptions): crypto.Hash
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')
- Definition Classes
- Crypto
-
def
createHmac(algorithm: String, key: |[String, BufferLike], options: TransformOptions = js.native): crypto.Hmac
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.
- Definition Classes
- Crypto
-
def
createSign(algorithm: String, options: WritableOptions = js.native): crypto.Sign
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')
- Definition Classes
- Crypto
-
def
createVerify(algorithm: String, options: WritableOptions = js.native): crypto.Verify
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')
- Definition Classes
- Crypto
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
generateKeyPair(type: String, options: GenerateKeyPairOptions, callback: Callback2[|[|[String, Buffer], KeyObject], |[|[String, Buffer], KeyObject]]): Unit
- Definition Classes
- Crypto
-
def
generateKeyPairSync(type: String, options: GenerateKeyPairOptions): KeyPair
- Definition Classes
- Crypto
-
def
getCiphers(): Array[String]
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', ...]
- Definition Classes
- Crypto
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
getCurves(): Array[String]
- Definition Classes
- Crypto
-
def
getDiffieHellman(groupName: String): DiffieHellmanGroup
- Definition Classes
- Crypto
-
def
getFips(): Boolean
- Definition Classes
- Crypto
-
def
getHashes(): Array[String]
- Definition Classes
- Crypto
-
def
hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
-
def
pbkdf2(password: |[String, BufferLike], salt: |[String, BufferLike], iterations: Int, keylen: Int, digest: String, callback: Callback1[Buffer]): Buffer
- Definition Classes
- Crypto
-
def
pbkdf2Sync(password: |[String, BufferLike], salt: |[String, BufferLike], iterations: Int, keylen: Int, digest: String): Buffer
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)
- Definition Classes
- Crypto
-
def
privateDecrypt(privateKey: |[String, Buffer], buffer: BufferLike): Buffer
- Definition Classes
- Crypto
-
def
privateEncrypt(privateKey: |[String, Buffer], buffer: BufferLike): Buffer
- Definition Classes
- Crypto
-
def
propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
-
def
publicDecrypt(key: |[String, Buffer], buffer: BufferLike): Buffer
- Definition Classes
- Crypto
-
def
publicEncrypt(key: |[String, Buffer], buffer: BufferLike): Buffer
- Definition Classes
- Crypto
-
def
randomBytes(size: Int, callback: Callback1[Buffer]): Unit
- Definition Classes
- Crypto
-
def
randomBytes(size: Int): Buffer
- Definition Classes
- Crypto
-
def
randomFill[T <: TypedArray[_, T]](buffer: T, offset: Int = js.native, size: Int = js.native, callback: Callback1[T]): T
- Definition Classes
- Crypto
-
def
randomFill(buffer: DataView, callback: Callback1[DataView]): DataView
- Definition Classes
- Crypto
-
def
randomFill(buffer: DataView, offset: Int, callback: Callback1[DataView]): DataView
- Definition Classes
- Crypto
-
def
randomFill(buffer: DataView, offset: Int, size: Int, callback: Callback1[DataView]): DataView
- Definition Classes
- Crypto
-
def
randomFill(buffer: Buffer, callback: Callback1[Buffer]): Buffer
- Definition Classes
- Crypto
-
def
randomFill(buffer: Buffer, offset: Int, callback: Callback1[Buffer]): Buffer
- Definition Classes
- Crypto
-
def
randomFill(buffer: Buffer, offset: Int, size: Int, callback: Callback1[Buffer]): Buffer
- Definition Classes
- Crypto
-
def
randomFillSync[T <: TypedArray[_, T]](buffer: T, offset: Int = js.native, size: Int = js.native): T
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: DataView): DataView
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: DataView, offset: Int): DataView
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: DataView, offset: Int, size: Int): DataView
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: Buffer): Buffer
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: Buffer, offset: Int): Buffer
- Definition Classes
- Crypto
-
def
randomFillSync(buffer: Buffer, offset: Int, size: Int): Buffer
- Definition Classes
- Crypto
-
def
scrypt(password: |[String, BufferLike], salt: |[String, BufferLike], keylen: Int, options: ScryptOptions = js.native, callback: Callback1[Buffer]): Unit
- Definition Classes
- Crypto
-
def
scryptSync(password: |[String, BufferLike], salt: |[String, BufferLike], keylen: Int, options: ScryptOptions = js.native): Buffer
- Definition Classes
- Crypto
-
def
setEngine(engine: String, fips: Int = js.native): Unit
- Definition Classes
- Crypto
-
def
setFips(enable: Boolean): Unit
- Definition Classes
- Crypto
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
timingSafeEqual(a: BufferLike, b: BufferLike): Boolean
- Definition Classes
- Crypto
-
def
toLocaleString(): String
- Definition Classes
- Object
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
valueOf(): Any
- Definition Classes
- Object
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
val
DEFAULT_ENCODING: String
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.
- Definition Classes
- Crypto
- Annotations
- @deprecated
- Deprecated
(Since version Node.js v10.0) New applications should expect the default to be 'buffer'.
-
def
createCipher(algorithm: String, password: |[Buffer, String]): crypto.Cipher
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.
- Definition Classes
- Crypto
- Annotations
- @deprecated
- Deprecated
(Since version Node.js v10.0) Use crypto.createCipheriv() instead.
crypto.createCipher(algorithm, password)
Example: -
def
createDecipher(algorithm: String, password: |[Buffer, String]): crypto.Decipher
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.
- Definition Classes
- Crypto
- Annotations
- @deprecated
- Deprecated
(Since version Node.js v10.0) Use crypto.createDecipheriv() instead.
crypto.createDecipher(algorithm, password)
Example: -
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated @deprecated
- Deprecated
(Since version ) see corresponding Javadoc for more information.
-
val
fips: Boolean
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.
- Definition Classes
- Crypto
- Annotations
- @deprecated
- Deprecated
(Since version Node.js v10.0) Please use crypto.setFips() and crypto.getFips() instead.