summaryrefslogtreecommitdiff
path: root/src/node_crypto.cc
diff options
context:
space:
mode:
authorSam Roberts <vieuxtech@gmail.com>2018-11-15 10:11:29 -0800
committerSam Roberts <vieuxtech@gmail.com>2018-11-20 13:21:08 -0800
commit0512d68e42b6100011ac37339070e6e154bfadca (patch)
tree882b2c1f965fcc590dc9f1508ca287c17eb5e104 /src/node_crypto.cc
parentfe303b9b2dd8224e368ed69d6b797bc34dd94d07 (diff)
downloadandroid-node-v8-0512d68e42b6100011ac37339070e6e154bfadca.tar.gz
android-node-v8-0512d68e42b6100011ac37339070e6e154bfadca.tar.bz2
android-node-v8-0512d68e42b6100011ac37339070e6e154bfadca.zip
tls: include RSA bit size in X.509 public key info
For symmetricality with the EC public key info, and because its useful. PR-URL: https://github.com/nodejs/node/pull/24358 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_crypto.cc')
-rw-r--r--src/node_crypto.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 91583c18d9..7e168c6fa4 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -1685,6 +1685,10 @@ static Local<Object> X509ToObject(Environment* env, X509* cert) {
mem->length).ToLocalChecked()).FromJust();
USE(BIO_reset(bio.get()));
+ int bits = BN_num_bits(n);
+ info->Set(context, env->bits_string(),
+ Integer::New(env->isolate(), bits)).FromJust();
+
uint64_t exponent_word = static_cast<uint64_t>(BN_get_word(e));
uint32_t lo = static_cast<uint32_t>(exponent_word);
uint32_t hi = static_cast<uint32_t>(exponent_word >> 32);