Skip to content

Commit de463f1

Browse files
rpgeeganagedanbev
authored andcommitted
test: ec2 generateKeyPairSync invalid parameter encoding
PR-URL: #27212 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 1e7823d commit de463f1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test/parallel/test-crypto-keygen.js

+23
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,29 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
449449
}));
450450
}
451451

452+
// Test invalid parameter encoding.
453+
{
454+
common.expectsError(() => generateKeyPairSync('ec', {
455+
namedCurve: 'P-256',
456+
paramEncoding: 'otherEncoding',
457+
publicKeyEncoding: {
458+
type: 'spki',
459+
format: 'pem'
460+
},
461+
privateKeyEncoding: {
462+
type: 'pkcs8',
463+
format: 'pem',
464+
cipher: 'aes-128-cbc',
465+
passphrase: 'top secret'
466+
}
467+
}), {
468+
type: TypeError,
469+
code: 'ERR_INVALID_OPT_VALUE',
470+
message: 'The value "otherEncoding" is invalid for ' +
471+
'option "paramEncoding"'
472+
});
473+
}
474+
452475
{
453476
// Test the util.promisified API with async RSA key generation.
454477
promisify(generateKeyPair)('rsa', {

0 commit comments

Comments
 (0)