diff options
author | Filip Skokan <panva.ip@gmail.com> | 2022-08-11 12:52:41 +0300 |
---|---|---|
committer | Juan José Arboleda <soyjuanarbol@gmail.com> | 2022-10-11 22:45:30 +0300 |
commit | e5c9975f1139b4d465e67c6a81fa5fcd1a268cf2 (patch) | |
tree | b7a8f603d19c2abdda06451a285b13e05f30f454 /lib | |
parent | 7e705d8d74c0eec410bc24f3572780342f7c7915 (diff) |
crypto: allow zero-length secret KeyObject
PR-URL: https://github.com/nodejs/node/pull/44201
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Backport-PR-URL: https://github.com/nodejs/node/pull/44872
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/crypto/keys.js | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index cdc87f4c1cb..4303dc44fe6 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -38,7 +38,6 @@ const { ERR_ILLEGAL_CONSTRUCTOR, ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE, - ERR_OUT_OF_RANGE, } } = require('internal/errors'); @@ -592,8 +591,6 @@ function prepareSecretKey(key, encoding, bufferOnly = false) { function createSecretKey(key, encoding) { key = prepareSecretKey(key, encoding, true); - if (key.byteLength === 0) - throw new ERR_OUT_OF_RANGE('key.byteLength', '> 0', key.byteLength); const handle = new KeyObjectHandle(); handle.init(kKeyTypeSecret, key); return new SecretKeyObject(handle); |