mirror of
https://github.com/nodejs/node.git
synced 2025-05-09 03:18:24 +00:00

Add an option 'clientCertEngine' to `tls.createSecureContext()` which gets wired up to OpenSSL function `SSL_CTX_set_client_cert_engine`. The option is passed through from `https.request()` as well. This allows using a custom OpenSSL engine to provide the client certificate.
36 lines
665 B
JavaScript
36 lines
665 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const https = require('https');
|
|
|
|
const agent = new https.Agent();
|
|
|
|
// empty options
|
|
assert.strictEqual(
|
|
agent.getName({}),
|
|
'localhost:::::::::::'
|
|
);
|
|
|
|
// pass all options arguments
|
|
const options = {
|
|
host: '0.0.0.0',
|
|
port: 443,
|
|
localAddress: '192.168.1.1',
|
|
ca: 'ca',
|
|
cert: 'cert',
|
|
ciphers: 'ciphers',
|
|
key: 'key',
|
|
pfx: 'pfx',
|
|
rejectUnauthorized: false,
|
|
servername: 'localhost',
|
|
};
|
|
|
|
assert.strictEqual(
|
|
agent.getName(options),
|
|
'0.0.0.0:443:192.168.1.1:ca:cert::ciphers:key:pfx:false:localhost:'
|
|
);
|