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 b5d2a21

Browse filesBrowse files
tniessenMylesBorins
authored andcommitted
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: #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>
1 parent c3897bf commit b5d2a21
Copy full SHA for b5d2a21

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+11
-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
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,6 +1200,17 @@ const sec1EncExp = (cipher) => getRegExpForPEM('EC PRIVATE KEY', cipher);
12001200
code: 'ERR_OUT_OF_RANGE',
12011201
});
12021202
}
1203+
1204+
// Test invalid exponents. (caught by OpenSSL)
1205+
for (const publicExponent of [1, 1 + 0x10001]) {
1206+
generateKeyPair('rsa', {
1207+
modulusLength: 4096,
1208+
publicExponent
1209+
}, common.mustCall((err) => {
1210+
assert.strictEqual(err.name, 'Error');
1211+
assert.match(err.message, common.hasOpenSSL3 ? /exponent/ : /bad e value/);
1212+
}));
1213+
}
12031214
}
12041215

12051216
// Test DSA parameters.

0 commit comments

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