Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: rsa-pss generateKeyPairSync invalid option hash
  • Loading branch information
zeckson committed May 26, 2019
commit 307868e58e2d4c563958c0b8c31118fdd773b4ad
14 changes: 14 additions & 0 deletions test/parallel/test-crypto-keygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,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