Skip to content

Commit 73cd9dd

Browse files
tniessenjuanarbol
authored andcommitted
test: add coverage for invalid RSA-PSS digests
PR-URL: #44271 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
1 parent 5978eb1 commit 73cd9dd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/parallel/test-crypto-keygen.js

+18
Original file line numberDiff line numberDiff line change
@@ -1542,6 +1542,24 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
15421542
}
15431543
);
15441544
}
1545+
1546+
assert.throws(() => generateKeyPair('rsa-pss', {
1547+
modulusLength: 512,
1548+
hashAlgorithm: 'sha2',
1549+
}, common.mustNotCall()), {
1550+
name: 'TypeError',
1551+
code: 'ERR_CRYPTO_INVALID_DIGEST',
1552+
message: 'md specifies an invalid digest'
1553+
});
1554+
1555+
assert.throws(() => generateKeyPair('rsa-pss', {
1556+
modulusLength: 512,
1557+
mgf1HashAlgorithm: 'sha2',
1558+
}, common.mustNotCall()), {
1559+
name: 'TypeError',
1560+
code: 'ERR_CRYPTO_INVALID_DIGEST',
1561+
message: 'mgf1_md specifies an invalid digest'
1562+
});
15451563
}
15461564

15471565
// Passing an empty passphrase string should not cause OpenSSL's default

0 commit comments

Comments
 (0)