mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
tls: handle large RSA exponents in X.509 cert
If the exponent does not fit into a single word, previous versions of Node.js would report an incorrect value or, recently, return `null`. Change `GetExponentString()` to handle arbitrarily large RSA public exponents properly. Signed-off-by: Tobias Nießen <tniessen@tnie.de> PR-URL: https://github.com/nodejs/node/pull/64093 Refs: https://github.com/nodejs/node/pull/63895 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
1 parent
e392e1f791
commit
a653e9bb57
1 file changed
+3
-3
@@ -689,12 +689,12 @@ MaybeLocal<Value> GetModulusString(Environment* env, const BIGNUM* n) {
|
||||
}
|
||||
|
||||
MaybeLocal<Value> GetExponentString(Environment* env, const BIGNUM* e) {
|
||||
auto exponent_word = BignumPointer::GetWord(e);
|
||||
if (!exponent_word) return Null(env->isolate());
|
||||
if (e == nullptr) return Null(env->isolate());
|
||||
auto bio = BIOPointer::NewMem();
|
||||
if (!bio) [[unlikely]]
|
||||
return {};
|
||||
BIO_printf(bio.get(), "0x%" PRIx64, static_cast<uint64_t>(*exponent_word));
|
||||
BIO_puts(bio.get(), "0x");
|
||||
BN_print(bio.get(), e);
|
||||
return ToV8Value(env->context(), bio);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user