Skip to content

Commit

Permalink
test: add coverage for invalid RSA-PSS digests
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
tniessen authored and juanarbol committed Oct 11, 2022
1 parent 5978eb1 commit 73cd9dd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/parallel/test-crypto-keygen.js
Expand Up @@ -1542,6 +1542,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
Expand Down

0 comments on commit 73cd9dd

Please sign in to comment.