| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 924d29e commit 0de2850
9 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2564,6 +2564,15 @@ added: v15.6.0 | |||
| 2564 | 2564 | ||
| 2565 | 2565 | The SHA-256 fingerprint of this certificate. | |
| 2566 | 2566 | ||
| 2567 | + ### `x509.fingerprint512` | ||
| 2568 | + <!-- YAML | ||
| 2569 | + added: REPLACEME | ||
| 2570 | + --> | ||
| 2571 | + | ||
| 2572 | + * Type: {string} | ||
| 2573 | + | ||
| 2574 | + The SHA-512 fingerprint of this certificate. | ||
| 2575 | + | ||
| 2567 | 2576 | ### `x509.infoAccess` | |
| 2568 | 2577 | ||
| 2569 | 2578 | <!-- YAML | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1133,6 +1133,9 @@ certificate. | |||
| 1133 | 1133 | ||
| 1134 | 1134 | <!-- YAML | |
| 1135 | 1135 | changes: | |
| 1136 | + - version: REPLACEME | ||
| 1137 | + pr-url: https://github.com/nodejs/node/pull/39809 | ||
| 1138 | + description: Add fingerprint512. | ||
| 1136 | 1139 | - version: v11.4.0 | |
| 1137 | 1140 | pr-url: https://github.com/nodejs/node/pull/24358 | |
| 1138 | 1141 | description: Support Elliptic Curve public key info. | |
@@ -1158,6 +1161,9 @@ certificate. | |||
| 1158 | 1161 | * `fingerprint256` {string} The SHA-256 digest of the DER encoded certificate. | |
| 1159 | 1162 | It is returned as a `:` separated hexadecimal string. Example: | |
| 1160 | 1163 | `'2A:7A:C2:DD:...'`. | |
| 1164 | + * `fingerprint512` {string} The SHA-512 digest of the DER encoded certificate. | ||
| 1165 | + It is returned as a `:` separated hexadecimal string. Example: | ||
| 1166 | + `'2A:7A:C2:DD:...'`. | ||
| 1161 | 1167 | * `ext_key_usage` {Array} (Optional) The extended key usage, a set of OIDs. | |
| 1162 | 1168 | * `subjectaltname` {string} (Optional) A string containing concatenated names | |
| 1163 | 1169 | for the subject, an alternative to the `subject` names. | |
@@ -1216,6 +1222,7 @@ Example certificate: | |||
| 1216 | 1222 | valid_to: 'Nov 20 23:59:59 2019 GMT', | |
| 1217 | 1223 | fingerprint: '01:02:59:D9:C3:D2:0D:08:F7:82:4E:44:A4:B4:53:C5:E2:3A:87:4D', | |
| 1218 | 1224 | fingerprint256: '69:AE:1A:6A:D4:3D:C6:C1:1B:EA:C6:23:DE:BA:2A:14:62:62:93:5C:7A:EA:06:41:9B:0B:BC:87:CE:48:4E:02', | |
| 1225 | + fingerprint512: '19:2B:3E:C3:B3:5B:32:E8:AE:BB:78:97:27:E4:BA:6C:39:C9:92:79:4F:31:46:39:E2:70:E5:5F:89:42:17:C9:E8:64:CA:FF:BB:72:56:73:6E:28:8A:92:7E:A3:2A:15:8B:C2:E0:45:CA:C3:BC:EA:40:52:EC:CA:A2:68:CB:32', | ||
| 1219 | 1226 | ext_key_usage: [ '1.3.6.1.5.5.7.3.1', '1.3.6.1.5.5.7.3.2' ], | |
| 1220 | 1227 | serialNumber: '66593D57F20CBC573E433381B5FEC280', | |
| 1221 | 1228 | raw: <Buffer ... > } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -133,6 +133,7 @@ class X509Certificate extends JSTransferable { | |||
| 133 | 133 | validTo: this.validTo, | |
| 134 | 134 | fingerprint: this.fingerprint, | |
| 135 | 135 | fingerprint256: this.fingerprint256, | |
| 136 | + fingerprint512: this.fingerprint512, | ||
| 136 | 137 | keyUsage: this.keyUsage, | |
| 137 | 138 | serialNumber: this.serialNumber, | |
| 138 | 139 | }, opts)}`; | |
@@ -233,6 +234,15 @@ class X509Certificate extends JSTransferable { | |||
| 233 | 234 | return value; | |
| 234 | 235 | } | |
| 235 | 236 | ||
| 237 | + get fingerprint512() { | ||
| 238 | + let value = this[kInternalState].get('fingerprint512'); | ||
| 239 | + if (value === undefined) { | ||
| 240 | + value = this[kHandle].fingerprint512(); | ||
| 241 | + this[kInternalState].set('fingerprint512', value); | ||
| 242 | + } | ||
| 243 | + return value; | ||
| 244 | + } | ||
| 245 | + | ||
| 236 | 246 | get keyUsage() { | |
| 237 | 247 | let value = this[kInternalState].get('keyUsage'); | |
| 238 | 248 | if (value === undefined) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1103,6 +1103,10 @@ MaybeLocal<Object> X509ToObject(Environment* env, X509* cert) { | |||
| 1103 | 1103 | info, | |
| 1104 | 1104 | env->fingerprint256_string(), | |
| 1105 | 1105 | GetFingerprintDigest(env, EVP_sha256(), cert)) || | |
| 1106 | + !Set<Value>(context, | ||
| 1107 | + info, | ||
| 1108 | + env->fingerprint512_string(), | ||
| 1109 | + GetFingerprintDigest(env, EVP_sha512(), cert)) || | ||
| 1106 | 1110 | !Set<Value>(context, | |
| 1107 | 1111 | info, | |
| 1108 | 1112 | env->ext_key_usage_string(), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -68,6 +68,7 @@ Local<FunctionTemplate> X509Certificate::GetConstructorTemplate( | |||
| 68 | 68 | env->SetProtoMethod(tmpl, "validFrom", ValidFrom); | |
| 69 | 69 | env->SetProtoMethod(tmpl, "fingerprint", Fingerprint); | |
| 70 | 70 | env->SetProtoMethod(tmpl, "fingerprint256", Fingerprint256); | |
| 71 | + env->SetProtoMethod(tmpl, "fingerprint512", Fingerprint512); | ||
| 71 | 72 | env->SetProtoMethod(tmpl, "keyUsage", KeyUsage); | |
| 72 | 73 | env->SetProtoMethod(tmpl, "serialNumber", SerialNumber); | |
| 73 | 74 | env->SetProtoMethod(tmpl, "pem", Pem); | |
@@ -268,6 +269,15 @@ void X509Certificate::Fingerprint256(const FunctionCallbackInfo<Value>& args) { | |||
| 268 | 269 | args.GetReturnValue().Set(ret); | |
| 269 | 270 | } | |
| 270 | 271 | ||
| 272 | + void X509Certificate::Fingerprint512(const FunctionCallbackInfo<Value>& args) { | ||
| 273 | + Environment* env = Environment::GetCurrent(args); | ||
| 274 | + X509Certificate* cert; | ||
| 275 | + ASSIGN_OR_RETURN_UNWRAP(&cert, args.Holder()); | ||
| 276 | + Local<Value> ret; | ||
| 277 | + if (GetFingerprintDigest(env, EVP_sha512(), cert->get()).ToLocal(&ret)) | ||
| 278 | + args.GetReturnValue().Set(ret); | ||
| 279 | + } | ||
| 280 | + | ||
| 271 | 281 | void X509Certificate::KeyUsage(const FunctionCallbackInfo<Value>& args) { | |
| 272 | 282 | Environment* env = Environment::GetCurrent(args); | |
| 273 | 283 | X509Certificate* cert; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -81,6 +81,7 @@ class X509Certificate : public BaseObject { | |||
| 81 | 81 | static void ValidTo(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 82 | 82 | static void Fingerprint(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 83 | 83 | static void Fingerprint256(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 84 | + static void Fingerprint512(const v8::FunctionCallbackInfo<v8::Value>& args); | ||
| 84 | 85 | static void KeyUsage(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 85 | 86 | static void SerialNumber(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| 86 | 87 | static void Raw(const v8::FunctionCallbackInfo<v8::Value>& args); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -256,6 +256,7 @@ constexpr size_t kFsStatsBufferLength = | |||
| 256 | 256 | V(file_string, "file") \ | |
| 257 | 257 | V(filename_string, "filename") \ | |
| 258 | 258 | V(fingerprint256_string, "fingerprint256") \ | |
| 259 | + V(fingerprint512_string, "fingerprint512") \ | ||
| 259 | 260 | V(fingerprint_string, "fingerprint") \ | |
| 260 | 261 | V(flags_string, "flags") \ | |
| 261 | 262 | V(flowlabel_string, "flowlabel") \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -103,6 +103,12 @@ const der = Buffer.from( | |||
| 103 | 103 | 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:C6:F5:89:E3:0D:' + | |
| 104 | 104 | '84:AC:5B:08:9A:20:89:B6:8F:D6' | |
| 105 | 105 | ); | |
| 106 | + assert.strictEqual( | ||
| 107 | + x509.fingerprint512, | ||
| 108 | + 'D0:05:01:82:2C:D8:09:BE:27:94:E7:83:F1:88:BC:7A:8B:D0:39:97:54:B6:' + | ||
| 109 | + 'D0:B4:46:5B:DE:13:5B:68:86:B6:F2:A8:95:22:D5:6E:8B:35:DA:89:29:CA:' + | ||
| 110 | + 'A3:06:C5:CE:43:C1:7F:2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68' | ||
| 111 | + ); | ||
| 106 | 112 | assert.strictEqual(x509.keyUsage, undefined); | |
| 107 | 113 | assert.strictEqual(x509.serialNumber, 'ECC9B856270DA9A8'); | |
| 108 | 114 | ||
@@ -226,6 +232,11 @@ const der = Buffer.from( | |||
| 226 | 232 | fingerprint256: | |
| 227 | 233 | 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:' + | |
| 228 | 234 | 'C6:F5:89:E3:0D:84:AC:5B:08:9A:20:89:B6:8F:D6', | |
| 235 | + fingerprint512: | ||
| 236 | + 'D0:05:01:82:2C:D8:09:BE:27:94:E7:83:F1:88:BC:7A:8B:' + | ||
| 237 | + 'D0:39:97:54:B6:D0:B4:46:5B:DE:13:5B:68:86:B6:F2:A8:' + | ||
| 238 | + '95:22:D5:6E:8B:35:DA:89:29:CA:A3:06:C5:CE:43:C1:7F:' + | ||
| 239 | + '2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68', | ||
| 229 | 240 | serialNumber: 'ECC9B856270DA9A8' | |
| 230 | 241 | }; | |
| 231 | 242 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -69,6 +69,12 @@ connect({ | |||
| 69 | 69 | 'B0:BE:46:49:B8:29:63:E0:6F:63:C8:8A:57:9C:3F:9B:72:C6:F5:89:E3:0D:84:AC:' + | |
| 70 | 70 | '5B:08:9A:20:89:B6:8F:D6' | |
| 71 | 71 | ); | |
| 72 | + assert.strictEqual( | ||
| 73 | + peerCert.fingerprint512, | ||
| 74 | + 'D0:05:01:82:2C:D8:09:BE:27:94:E7:83:F1:88:BC:7A:8B:D0:39:97:54:B6:' + | ||
| 75 | + 'D0:B4:46:5B:DE:13:5B:68:86:B6:F2:A8:95:22:D5:6E:8B:35:DA:89:29:CA:' + | ||
| 76 | + 'A3:06:C5:CE:43:C1:7F:2D:7E:5F:44:A5:EE:A3:CB:97:05:A3:E3:68' | ||
| 77 | + ); | ||
| 72 | 78 | ||
| 73 | 79 | // SHA256 fingerprint of the public key | |
| 74 | 80 | assert.strictEqual( | |
@@ -119,6 +125,12 @@ connect({ | |||
| 119 | 125 | 'AB:08:3C:40:C7:07:D7:D1:79:32:92:3B:96:52:D0:38:4C:22:ED:CD:23:51:D0:A1:' + | |
| 120 | 126 | '67:AA:33:A0:D5:26:5C:41' | |
| 121 | 127 | ); | |
| 128 | + assert.strictEqual( | ||
| 129 | + peerCert.fingerprint512, | ||
| 130 | + '52:F4:86:64:69:0F:94:6F:78:DE:17:7A:5C:92:CA:0F:05:2E:6A:EE:4A:FF:8B:39:' + | ||
| 131 | + 'D6:5E:7A:B8:08:77:B3:80:FC:40:A1:F4:58:CC:7A:DF:BB:3D:38:F9:02:77:50:2B:' + | ||
| 132 | + '9A:0B:FB:79:B4:BD:E9:F5:9C:44:C8:5D:D5:F0:E2:BC' | ||
| 133 | + ); | ||
| 122 | 134 | ||
| 123 | 135 | assert.strictEqual( | |
| 124 | 136 | sha256(peerCert.pubkey).digest('hex'), | |
| Back | FazBrowse Home | New Git URL |
0 commit comments