Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 390e050

Browse filesBrowse files
sam-githubBethGriggs
authored andcommitted
tls: support "BEGIN TRUSTED CERTIFICATE" for ca:
Support the same PEM certificate formats for the ca: option to tls.createSecureContext() that are supported by openssl when loading a CAfile. Fixes: #24761 PR-URL: #24733 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 016e352 commit 390e050
Copy full SHA for 390e050

File tree

Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-7
lines changed
Open diff view settings
Collapse file

‎doc/api/tls.md‎

Copy file name to clipboardExpand all lines: doc/api/tls.md
+5-2Lines changed: 5 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1054,6 +1054,9 @@ argument.
10541054
<!-- YAML
10551055
added: v0.11.13
10561056
changes:
1057+
- version: REPLACEME
1058+
pr-url: REPLACEME
1059+
description: The `ca:` option now supports `BEGIN TRUSTED CERTIFICATE`.
10571060
- version: v11.4.0
10581061
pr-url: https://github.com/nodejs/node/pull/24405
10591062
description: The `minVersion` and `maxVersion` can be used to restrict
@@ -1092,8 +1095,8 @@ changes:
10921095
certificate can match or chain to.
10931096
For self-signed certificates, the certificate is its own CA, and must be
10941097
provided.
1095-
For PEM encoded certificates, supported types are "X509 CERTIFICATE", and
1096-
"CERTIFICATE".
1098+
For PEM encoded certificates, supported types are "TRUSTED CERTIFICATE",
1099+
"X509 CERTIFICATE", and "CERTIFICATE".
10971100
* `cert` {string|string[]|Buffer|Buffer[]} Cert chains in PEM format. One cert
10981101
chain should be provided per private key. Each cert chain should consist of
10991102
the PEM formatted certificate for a provided private `key`, followed by the
Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ void SecureContext::AddCACert(const FunctionCallbackInfo<Value>& args) {
801801
return;
802802

803803
X509_STORE* cert_store = SSL_CTX_get_cert_store(sc->ctx_.get());
804-
while (X509* x509 = PEM_read_bio_X509(
804+
while (X509* x509 = PEM_read_bio_X509_AUX(
805805
bio.get(), nullptr, NoPasswordCallback, nullptr)) {
806806
if (cert_store == root_cert_store) {
807807
cert_store = NewRootCertStore();
Collapse file

‎test/parallel/test-tls-client-auth.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-tls-client-auth.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ connect({
254254
return cleanup();
255255
});
256256

257-
// Confirm lack of support for "BEGIN TRUSTED CERTIFICATE".
257+
// Confirm support for "BEGIN TRUSTED CERTIFICATE".
258258
connect({
259259
client: {
260260
key: client.key,
@@ -269,11 +269,11 @@ connect({
269269
requestCert: true,
270270
},
271271
}, function(err, pair, cleanup) {
272-
assert.strictEqual(err.code, 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY');
272+
assert.ifError(err);
273273
return cleanup();
274274
});
275275

276-
// Confirm lack of support for "BEGIN TRUSTED CERTIFICATE".
276+
// Confirm support for "BEGIN TRUSTED CERTIFICATE".
277277
connect({
278278
client: {
279279
key: client.key,
@@ -288,7 +288,7 @@ connect({
288288
requestCert: true,
289289
},
290290
}, function(err, pair, cleanup) {
291-
assert.strictEqual(err.code, 'ECONNRESET');
291+
assert.ifError(err);
292292
return cleanup();
293293
});
294294

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.