| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0e9bad9 commit bf868fd
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1173,6 +1173,9 @@ certificate. | |||
| 1173 | 1173 | ||
| 1174 | 1174 | <!-- YAML | |
| 1175 | 1175 | changes: | |
| 1176 | + - version: REPLACEME | ||
| 1177 | + pr-url: https://github.com/nodejs/node/pull/44935 | ||
| 1178 | + description: Add "ca" property. | ||
| 1176 | 1179 | - version: | |
| 1177 | 1180 | - v17.2.0 | |
| 1178 | 1181 | - v16.14.0 | |
@@ -1186,6 +1189,7 @@ changes: | |||
| 1186 | 1189 | A certificate object has properties corresponding to the fields of the | |
| 1187 | 1190 | certificate. | |
| 1188 | 1191 | ||
| 1192 | + * `ca` {boolean} `true` if a Certificate Authority (CA), `false` otherwise. | ||
| 1189 | 1193 | * `raw` {Buffer} The DER encoded X.509 certificate data. | |
| 1190 | 1194 | * `subject` {Object} The certificate subject, described in terms of | |
| 1191 | 1195 | Country (`C`), StateOrProvince (`ST`), Locality (`L`), Organization (`O`), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,6 +27,7 @@ namespace node { | |||
| 27 | 27 | using v8::Array; | |
| 28 | 28 | using v8::ArrayBuffer; | |
| 29 | 29 | using v8::BackingStore; | |
| 30 | + using v8::Boolean; | ||
| 30 | 31 | using v8::Context; | |
| 31 | 32 | using v8::EscapableHandleScope; | |
| 32 | 33 | using v8::Integer; | |
@@ -1260,6 +1261,8 @@ MaybeLocal<Object> X509ToObject( | |||
| 1260 | 1261 | BIOPointer bio(BIO_new(BIO_s_mem())); | |
| 1261 | 1262 | CHECK(bio); | |
| 1262 | 1263 | ||
| 1264 | + // X509_check_ca() returns a range of values. Only 1 means "is a CA" | ||
| 1265 | + auto is_ca = Boolean::New(env->isolate(), 1 == X509_check_ca(cert)); | ||
| 1263 | 1266 | if (!Set<Value>(context, | |
| 1264 | 1267 | info, | |
| 1265 | 1268 | env->subject_string(), | |
@@ -1275,7 +1278,8 @@ MaybeLocal<Object> X509ToObject( | |||
| 1275 | 1278 | !Set<Value>(context, | |
| 1276 | 1279 | info, | |
| 1277 | 1280 | env->infoaccess_string(), | |
| 1278 | - GetInfoAccessString(env, bio, cert))) { | ||
| 1281 | + GetInfoAccessString(env, bio, cert)) || | ||
| 1282 | + !Set<Boolean>(context, info, env->ca_string(), is_ca)) { | ||
| 1279 | 1283 | return MaybeLocal<Object>(); | |
| 1280 | 1284 | } | |
| 1281 | 1285 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,6 +57,7 @@ | |||
| 57 | 57 | V(bytes_parsed_string, "bytesParsed") \ | |
| 58 | 58 | V(bytes_read_string, "bytesRead") \ | |
| 59 | 59 | V(bytes_written_string, "bytesWritten") \ | |
| 60 | + V(ca_string, "ca") \ | ||
| 60 | 61 | V(cached_data_produced_string, "cachedDataProduced") \ | |
| 61 | 62 | V(cached_data_rejected_string, "cachedDataRejected") \ | |
| 62 | 63 | V(cached_data_string, "cachedData") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -52,6 +52,8 @@ connect({ | |||
| 52 | 52 | debug('peerCert:\n', peerCert); | |
| 53 | 53 | ||
| 54 | 54 | assert.ok(peerCert.issuerCertificate); | |
| 55 | + assert.strictEqual(peerCert.ca, false); | ||
| 56 | + assert.strictEqual(peerCert.issuerCertificate.ca, true); | ||
| 55 | 57 | assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org'); | |
| 56 | 58 | assert.strictEqual(peerCert.serialNumber, '147D36C1C2F74206DE9FAB5F2226D78ADB00A426'); | |
| 57 | 59 | assert.strictEqual(peerCert.exponent, '0x10001'); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments