diff --git a/src/env.h b/src/env.h index b1ec2a1fe7f267..1fee31a9479e2a 100644 --- a/src/env.h +++ b/src/env.h @@ -243,6 +243,7 @@ struct PackageConfig { V(preference_string, "preference") \ V(priority_string, "priority") \ V(produce_cached_data_string, "produceCachedData") \ + V(pubkey_string, "pubkey") \ V(raw_string, "raw") \ V(read_host_object_string, "_readHostObject") \ V(readable_string, "readable") \ diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 1451b44a370871..f700ccd2fa5b2e 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1924,6 +1924,14 @@ static Local X509ToObject(Environment* env, X509* cert) { String::kNormalString, mem->length)).FromJust(); USE(BIO_reset(bio)); + + int size = i2d_RSA_PUBKEY(rsa, nullptr); + CHECK_GE(size, 0); + Local pubbuff = Buffer::New(env, size).ToLocalChecked(); + unsigned char* pubserialized = + reinterpret_cast(Buffer::Data(pubbuff)); + i2d_RSA_PUBKEY(rsa, &pubserialized); + info->Set(env->pubkey_string(), pubbuff); } if (pkey != nullptr) {