Skip to content
Permalink
Browse files

test: ec2 generateKeyPairSync invalid parameter encoding

PR-URL: #27212
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information...
rpgeeganage authored and danbev committed Apr 13, 2019
1 parent 1e7823d commit de463f1490d25868f961c678d2962d45d1ff4977
Showing with 23 additions and 0 deletions.
  1. +23 −0 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', {

0 comments on commit de463f1

Please sign in to comment.
You can’t perform that action at this time.