mirror of
https://github.com/nodejs/node.git
synced 2026-11-26 21:58:26 -05:00
PR-URL: https://github.com/nodejs/node/pull/15874 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const tls = require('tls');
|
|
// import fixtures directly from its module
|
|
const fixtures = require('../common/fixtures');
|
|
|
|
const cipher_list = ['AES128-SHA256', 'AES256-SHA256'];
|
|
const cipher_version_pattern = /TLS|SSL/;
|
|
const options = {
|
|
key: fixtures.readKey('agent2-key.pem'),
|
|
cert: fixtures.readKey('agent2-cert.pem'),
|
|
ciphers: cipher_list.join(':'),
|
|
honorCipherOrder: true
|
|
};
|
|
|
|
const server = tls.createServer(options,
|
|
common.mustCall(function(cleartextStream) {}));
|
|
|
|
server.listen(0, '127.0.0.1', common.mustCall(function() {
|
|
const client = tls.connect({
|
|
host: '127.0.0.1',
|
|
port: this.address().port,
|
|
ciphers: cipher_list.join(':'),
|
|
rejectUnauthorized: false
|
|
}, common.mustCall(function() {
|
|
const cipher = client.getCipher();
|
|
assert.strictEqual(cipher.name, cipher_list[0]);
|
|
assert(cipher_version_pattern.test(cipher.version));
|
|
client.end();
|
|
server.close();
|
|
}));
|
|
}));
|