diff --git a/lib/internal/crypto/cipher.js b/lib/internal/crypto/cipher.js index e2b863cdc5749a..3f8de4b793a413 100644 --- a/lib/internal/crypto/cipher.js +++ b/lib/internal/crypto/cipher.js @@ -112,21 +112,21 @@ function getUIntOption(options, key) { return -1; } -function createCipherBase(cipher, credential, options, decipher, iv) { +function createCipherBase(cipher, credential, options, isEncrypt, iv) { const authTagLength = getUIntOption(options, 'authTagLength'); - this[kHandle] = new CipherBase(decipher); + this[kHandle] = new CipherBase(isEncrypt); this[kHandle].initiv(cipher, credential, iv, authTagLength); this._decoder = null; ReflectApply(LazyTransform, this, [options]); } -function createCipherWithIV(cipher, key, options, decipher, iv) { +function createCipherWithIV(cipher, key, options, isEncrypt, iv) { validateString(cipher, 'cipher'); const encoding = getStringOption(options, 'encoding'); key = prepareSecretKey(key, encoding); iv = iv === null ? null : getArrayBufferOrView(iv, 'iv'); - ReflectApply(createCipherBase, this, [cipher, key, options, decipher, iv]); + ReflectApply(createCipherBase, this, [cipher, key, options, isEncrypt, iv]); } // The Cipher class is part of the legacy Node.js crypto API. It exposes