Skip to content

Commit

Permalink
test: ec2 generateKeyPairSync invalid parameter encoding
Browse files Browse the repository at this point in the history
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 16, 2019
1 parent 1e7823d commit de463f1
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/parallel/test-crypto-keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down

0 comments on commit de463f1

Please sign in to comment.