diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index 1127217d6b9dee..c713bbdb0882e1 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -299,8 +299,7 @@ function isStringOrBuffer(val) { } function parseKeyEncoding(enc, keyType, isPublic, objName) { - if (enc === null || typeof enc !== 'object') - throw new ERR_INVALID_ARG_TYPE('options', 'object', enc); + validateObject(env, 'options'); const isInput = keyType === undefined;