createDecipher - Node documentation
function createDecipher

Usage in Deno

import { createDecipher } from "node:crypto";
Deprecated

Since v10.0.0 - Use createDecipheriv instead.

createDecipher(
algorithm: CipherCCMTypes,
password: BinaryLike,
): DecipherCCM
Deprecated

Since v10.0.0 - Use createDecipheriv instead.

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

The options argument controls stream behavior and is optional except when a cipher in CCM or OCB mode (e.g. 'aes-128-ccm') is used. In that case, theauthTagLength option is required and specifies the length of the authentication tag in bytes, see CCM mode. For chacha20-poly1305, the authTagLength option defaults to 16 bytes.

This function is semantically insecure for all supported ciphers and fatally flawed for ciphers in counter mode (such as CTR, GCM, or CCM).

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 a more modern algorithm instead of EVP_BytesToKey it is recommended that developers derive a key and IV on their own using scrypt and to use createDecipheriv to create the Decipher object.

Parameters

algorithm: CipherCCMTypes
password: BinaryLike

stream.transform options

Return Type

createDecipher(
algorithm: CipherGCMTypes,
password: BinaryLike,
options?: CipherGCMOptions,
): DecipherGCM
Deprecated

since v10.0.0 use createDecipheriv()

Parameters

algorithm: CipherGCMTypes
password: BinaryLike
optional
options: CipherGCMOptions

Return Type

createDecipher(
algorithm: string,
password: BinaryLike,
options?: stream.TransformOptions,
): Decipher
Deprecated

since v10.0.0 use createDecipheriv()

Parameters

algorithm: string
password: BinaryLike
optional
options: stream.TransformOptions

Return Type