test: cover publicExponent validation in OpenSSL
Add a test case for public exponents that are invalid according to some internal OpenSSL validation logic, but which are accepted by node's own validation logic. PR-URL: https://github.com/nodejs/node/pull/46632 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
parent
c566a04c86
commit
f1a30b9bd4
@ -1200,6 +1200,17 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
});
|
||||
}
|
||||
|
||||
// Test invalid exponents. (caught by OpenSSL)
|
||||
for (const publicExponent of [1, 1 + 0x10001]) {
|
||||
generateKeyPair('rsa', {
|
||||
modulusLength: 4096,
|
||||
publicExponent
|
||||
}, common.mustCall((err) => {
|
||||
assert.strictEqual(err.name, 'Error');
|
||||
assert.match(err.message, common.hasOpenSSL3 ? /exponent/ : /bad e value/);
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
// Test DSA parameters.
|
||||
|
Loading…
x
Reference in New Issue
Block a user