Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
  • Loading branch information
tniessen committed Jun 23, 2026
commit 0018a489fd64229e1eaba5534c47f4693a3b9433
6 changes: 3 additions & 3 deletions src/crypto/crypto_x509.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading