Skip to content
Permalink
Browse files

test: rsa-pss generateKeyPairSync invalid option hash

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 Trott committed May 26, 2019
1 parent 1dbf276 commit 1279d513b8fa074b10eac8c2ec3de13ea11a37e4
Showing with 14 additions and 0 deletions.
  1. +14 −0 test/parallel/test-crypto-keygen.js
@@ -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(() => {

0 comments on commit 1279d51

Please sign in to comment.
You can’t perform that action at this time.