Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 67b692b

Browse filesBrowse files
Nievltargos
authored andcommitted
test: add test case for checking typeof mgf1Hash
add test case to cover uncovered test mgf1Hash param of generateKeyPair, check typeof PR-URL: #27892 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 2a509d4 commit 67b692b
Copy full SHA for 67b692b

File tree

Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+36
-0
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-crypto-keygen.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-crypto-keygen.js
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -987,3 +987,39 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
987987
});
988988
}
989989
}
990+
{
991+
// Test RSA-PSS.
992+
common.expectsError(
993+
() => {
994+
generateKeyPair('rsa-pss', {
995+
modulusLength: 512,
996+
saltLength: 16,
997+
hash: 'sha256',
998+
mgf1Hash: undefined
999+
});
1000+
},
1001+
{
1002+
type: TypeError,
1003+
code: 'ERR_INVALID_CALLBACK',
1004+
message: 'Callback must be a function. Received undefined'
1005+
}
1006+
);
1007+
1008+
for (const mgf1Hash of [null, 0, false, {}, []]) {
1009+
common.expectsError(
1010+
() => {
1011+
generateKeyPair('rsa-pss', {
1012+
modulusLength: 512,
1013+
saltLength: 16,
1014+
hash: 'sha256',
1015+
mgf1Hash
1016+
});
1017+
},
1018+
{
1019+
type: TypeError,
1020+
code: 'ERR_INVALID_OPT_VALUE',
1021+
message: `The value "${mgf1Hash}" is invalid for option "mgf1Hash"`
1022+
}
1023+
);
1024+
}
1025+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.