summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-pfx-gh-5100-regr.js
blob: 142a7de10b841ab4baa1a3da18cb4cb3e8d18ab0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict';

const common = require('../common');

if (!common.hasCrypto) {
  common.skip('node compiled without crypto.');
  return;
}

const assert = require('assert');
const tls = require('tls');
const fs = require('fs');
const path = require('path');

const pfx = fs.readFileSync(
    path.join(common.fixturesDir, 'keys', 'agent1-pfx.pem'));

const server = tls.createServer({
  pfx: pfx,
  passphrase: 'sample',
  requestCert: true,
  rejectUnauthorized: false
}, common.mustCall(function(c) {
  assert.strictEqual(
    c.authorizationError,
    null,
    'authorizationError must be null'
  );
  c.end();
})).listen(0, function() {
  const client = tls.connect({
    port: this.address().port,
    pfx: pfx,
    passphrase: 'sample',
    rejectUnauthorized: false
  }, function() {
    client.end();
    server.close();
  });
});