diff options
author | Ruwan Geeganage <rpgeeg@gmail.com> | 2019-04-13 12:13:08 +0200 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2019-04-16 05:27:06 +0200 |
commit | de463f1490d25868f961c678d2962d45d1ff4977 (patch) | |
tree | b66383b69cf2b2385497d17d6546fa31428ae195 /test/parallel/test-crypto-keygen.js | |
parent | 1e7823dd4ec1e0d0fc653ad7665a6496b32882df (diff) | |
download | node-new-de463f1490d25868f961c678d2962d45d1ff4977.tar.gz |
test: ec2 generateKeyPairSync invalid parameter encoding
PR-URL: https://github.com/nodejs/node/pull/27212
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'test/parallel/test-crypto-keygen.js')
-rw-r--r-- | test/parallel/test-crypto-keygen.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index 07a0a18c30..c65f25e172 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -449,6 +449,29 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher); })); } +// Test invalid parameter encoding. +{ + common.expectsError(() => generateKeyPairSync('ec', { + namedCurve: 'P-256', + paramEncoding: 'otherEncoding', + publicKeyEncoding: { + type: 'spki', + format: 'pem' + }, + privateKeyEncoding: { + type: 'pkcs8', + format: 'pem', + cipher: 'aes-128-cbc', + passphrase: 'top secret' + } + }), { + type: TypeError, + code: 'ERR_INVALID_OPT_VALUE', + message: 'The value "otherEncoding" is invalid for ' + + 'option "paramEncoding"' + }); +} + { // Test the util.promisified API with async RSA key generation. promisify(generateKeyPair)('rsa', { |