mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
ec6b7939eb
agent6 was the only cert that had a chain (an intermediate certificate), and there were no non-RSA certs other than a single self-signed one. This makes it impossible to test cert-chain scenarios with multiple identities which require chains to prove chain completion, and multi-algorithm because OpenSSL doesn't support multiple identities unless they are multi-algorithm. PFX files were also missing for most identities, making it difficult to test multi-PFX and PFX interactions with cert-chain+key and CA options. New server cert chains: - ECC: ca5 signs ca6 signs ec10, CN=agent10.example.com - RSA: ca2 signs ca4 signs agent10, CN=agent10.example.com PFX added for: - agent6 - agent10 - ec10 All pem and pfx regenerated from scratch to test that the Makefile is actually working as intended. PR-URL: https://github.com/nodejs/node/pull/24374 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
'use strict';
|
|
require('../common');
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
// Check cert chain is received by client, and is completed with the ca cert
|
|
// known to the client.
|
|
|
|
const {
|
|
assert, connect, debug, keys
|
|
} = require(fixtures.path('tls-connect'));
|
|
|
|
|
|
// agent6-cert.pem includes cert for agent6 and ca3, split it apart and
|
|
// provide ca3 in the .ca property.
|
|
const agent6Chain = keys.agent6.cert.split(/(?=-----BEGIN CERTIFICATE-----)/);
|
|
const agent6End = agent6Chain[0];
|
|
const agent6Middle = agent6Chain[1];
|
|
connect({
|
|
client: {
|
|
checkServerIdentity: (servername, cert) => { },
|
|
ca: keys.agent6.ca,
|
|
},
|
|
server: {
|
|
cert: agent6End,
|
|
key: keys.agent6.key,
|
|
ca: agent6Middle,
|
|
},
|
|
}, function(err, pair, cleanup) {
|
|
assert.ifError(err);
|
|
|
|
const peer = pair.client.conn.getPeerCertificate();
|
|
debug('peer:\n', peer);
|
|
assert.strictEqual(peer.serialNumber, 'D0082F458B6EFBE8');
|
|
|
|
const next = pair.client.conn.getPeerCertificate(true).issuerCertificate;
|
|
const root = next.issuerCertificate;
|
|
delete next.issuerCertificate;
|
|
debug('next:\n', next);
|
|
assert.strictEqual(next.serialNumber, 'ECC9B856270DA9A7');
|
|
|
|
debug('root:\n', root);
|
|
assert.strictEqual(root.serialNumber, 'CB153AE212609FC6');
|
|
|
|
return cleanup();
|
|
});
|