Skip to content

Commit 0e1ce20

Browse files
zecksontargos
authored andcommitted
test: rsa-pss generateKeyPairSync invalid option hash
PR-URL: #27883 Reviewed-By: Ujjwal Sharma <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Tobias Nießen <[email protected]>
1 parent d406785 commit 0e1ce20

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/parallel/test-crypto-keygen.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,20 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
999999
});
10001000
}
10011001

1002+
// Invalid hash value.
1003+
for (const hashValue of [123, true, {}, []]) {
1004+
common.expectsError(() => {
1005+
generateKeyPairSync('rsa-pss', {
1006+
modulusLength: 4096,
1007+
hash: hashValue
1008+
});
1009+
}, {
1010+
type: TypeError,
1011+
code: 'ERR_INVALID_OPT_VALUE',
1012+
message: `The value "${hashValue}" is invalid for option "hash"`
1013+
});
1014+
}
1015+
10021016
// Invalid private key type.
10031017
for (const type of ['foo', 'spki']) {
10041018
common.expectsError(() => {

0 commit comments

Comments
 (0)