Skip to content

Commit

Permalink
src: fix missing extra ca in tls.rootCertificates
Browse files Browse the repository at this point in the history
Fixes tls.rootCertificates missing certificates loaded from NODE_EXTRA_CA_CERTS.

Fixes: nodejs#32074
  • Loading branch information
ebickle committed Mar 17, 2020
1 parent c351a0e commit 55a13f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/node_crypto_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,16 @@ MaybeLocal<Value> GetPeerCert(
return result;
}

MaybeLocal<Value> X509ToPEM(Environment* env, X509* cert) {
BIOPointer bio(BIO_new(BIO_s_mem()));

if (PEM_write_bio_X509(bio.get(), cert) == 0) {
return Undefined(env->isolate());
}

return ToV8Value(env, bio);
}

MaybeLocal<Object> X509ToObject(Environment* env, X509* cert) {
EscapableHandleScope scope(env->isolate());
Local<Context> context = env->context();
Expand Down
4 changes: 4 additions & 0 deletions src/node_crypto_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ v8::MaybeLocal<v8::Object> X509ToObject(
Environment* env,
X509* cert);

v8::MaybeLocal<v8::Value> X509ToPEM(
Environment* env,
X509* cert);

} // namespace crypto
} // namespace node

Expand Down

0 comments on commit 55a13f8

Please sign in to comment.