summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-client-renegotiation-13.js
blob: 075eb70e917c06dc7fb2856057fca5cbba5d6308 (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
41
'use strict';

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

// Confirm that for TLSv1.3, renegotiate() is disallowed.

const {
  assert, connect, keys
} = require(fixtures.path('tls-connect'));

const server = keys.agent10;

connect({
  client: {
    ca: server.ca,
    checkServerIdentity: common.mustCall(),
  },
  server: {
    key: server.key,
    cert: server.cert,
  },
}, function(err, pair, cleanup) {
  assert.ifError(err);

  const client = pair.client.conn;

  assert.strictEqual(client.getProtocol(), 'TLSv1.3');

  const ok = client.renegotiate({}, common.mustCall((err) => {
    assert.throws(() => { throw err; }, {
      message: 'error:1420410A:SSL routines:SSL_renegotiate:wrong ssl version',
      code: 'ERR_SSL_WRONG_SSL_VERSION',
      library: 'SSL routines',
      reason: 'wrong ssl version',
    });
    cleanup();
  }));

  assert.strictEqual(ok, false);
});