test: rsa-pss generateKeyPairSync invalid option hash
PR-URL: https://github.com/nodejs/node/pull/27883 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
This commit is contained in:
parent
1dbf2765bc
commit
1279d513b8
@ -999,6 +999,20 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Invalid hash value.
|
||||||
|
for (const hashValue of [123, true, {}, []]) {
|
||||||
|
common.expectsError(() => {
|
||||||
|
generateKeyPairSync('rsa-pss', {
|
||||||
|
modulusLength: 4096,
|
||||||
|
hash: hashValue
|
||||||
|
});
|
||||||
|
}, {
|
||||||
|
type: TypeError,
|
||||||
|
code: 'ERR_INVALID_OPT_VALUE',
|
||||||
|
message: `The value "${hashValue}" is invalid for option "hash"`
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Invalid private key type.
|
// Invalid private key type.
|
||||||
for (const type of ['foo', 'spki']) {
|
for (const type of ['foo', 'spki']) {
|
||||||
common.expectsError(() => {
|
common.expectsError(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user