diff options
author | Tobias Nießen <tniessen@tnie.de> | 2019-09-08 04:41:04 +0200 |
---|---|---|
committer | Tobias Nießen <tniessen@tnie.de> | 2019-09-13 16:58:41 +0200 |
commit | b64446648b61085715908b2769bbdfee7b2c84e4 (patch) | |
tree | 26ec47a23bb197aeb926a18cde73bf15ff23d0d0 /lib | |
parent | dff22dd176d584f3c050a659fa514f079ab5f208 (diff) | |
download | android-node-v8-b64446648b61085715908b2769bbdfee7b2c84e4.tar.gz android-node-v8-b64446648b61085715908b2769bbdfee7b2c84e4.tar.bz2 android-node-v8-b64446648b61085715908b2769bbdfee7b2c84e4.zip |
crypto: add oaepLabel option
The label acts as the "L" input to the RSA-OAEP algorithm.
PR-URL: https://github.com/nodejs/node/pull/29489
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/crypto/cipher.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/internal/crypto/cipher.js b/lib/internal/crypto/cipher.js index 20ca1454c8..48c5ba23c7 100644 --- a/lib/internal/crypto/cipher.js +++ b/lib/internal/crypto/cipher.js @@ -50,10 +50,16 @@ function rsaFunctionFor(method, defaultPadding, keyType) { preparePrivateKey(options) : preparePublicOrPrivateKey(options); const padding = options.padding || defaultPadding; - const { oaepHash } = options; + const { oaepHash, oaepLabel } = options; if (oaepHash !== undefined && typeof oaepHash !== 'string') throw new ERR_INVALID_ARG_TYPE('options.oaepHash', 'string', oaepHash); - return method(data, format, type, passphrase, buffer, padding, oaepHash); + if (oaepLabel !== undefined && !isArrayBufferView(oaepLabel)) { + throw new ERR_INVALID_ARG_TYPE('options.oaepLabel', + ['Buffer', 'TypedArray', 'DataView'], + oaepLabel); + } + return method(data, format, type, passphrase, buffer, padding, oaepHash, + oaepLabel); }; } |