crypto: add cert.pubkey containing the raw pubkey of certificate
PR-URL: https://github.com/nodejs/node/pull/17690 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
parent
7876aeb0fe
commit
5a6beb7741
@ -242,6 +242,7 @@ struct PackageConfig {
|
||||
V(priority_string, "priority") \
|
||||
V(produce_cached_data_string, "produceCachedData") \
|
||||
V(promise_string, "promise") \
|
||||
V(pubkey_string, "pubkey") \
|
||||
V(raw_string, "raw") \
|
||||
V(read_host_object_string, "_readHostObject") \
|
||||
V(readable_string, "readable") \
|
||||
|
@ -1898,6 +1898,14 @@ static Local<Object> 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<Object> pubbuff = Buffer::New(env, size).ToLocalChecked();
|
||||
unsigned char* pubserialized =
|
||||
reinterpret_cast<unsigned char*>(Buffer::Data(pubbuff));
|
||||
i2d_RSA_PUBKEY(rsa, &pubserialized);
|
||||
info->Set(env->pubkey_string(), pubbuff);
|
||||
}
|
||||
|
||||
if (pkey != nullptr) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user