mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
test: add coverage for invalid RSA-PSS digests
PR-URL: https://github.com/nodejs/node/pull/44271 Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
@@ -1654,6 +1654,24 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
assert.throws(() => generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
hashAlgorithm: 'sha2',
|
||||
}, common.mustNotCall()), {
|
||||
name: 'TypeError',
|
||||
code: 'ERR_CRYPTO_INVALID_DIGEST',
|
||||
message: 'md specifies an invalid digest'
|
||||
});
|
||||
|
||||
assert.throws(() => generateKeyPair('rsa-pss', {
|
||||
modulusLength: 512,
|
||||
mgf1HashAlgorithm: 'sha2',
|
||||
}, common.mustNotCall()), {
|
||||
name: 'TypeError',
|
||||
code: 'ERR_CRYPTO_INVALID_DIGEST',
|
||||
message: 'mgf1_md specifies an invalid digest'
|
||||
});
|
||||
}
|
||||
|
||||
// Passing an empty passphrase string should not cause OpenSSL's default
|
||||
|
||||
Reference in New Issue
Block a user