Skip to content

Commit

Permalink
test: rsa-pss generateKeyPairSync invalid option hash
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
zeckson authored and targos committed May 31, 2019
1 parent d406785 commit 0e1ce20
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/parallel/test-crypto-keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
for (const type of ['foo', 'spki']) {
common.expectsError(() => {
Expand Down

0 comments on commit 0e1ce20

Please sign in to comment.