forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-tls-basic-validations.js
More file actions
40 lines (28 loc) · 1.4 KB
/
Copy pathtest-tls-basic-validations.js
File metadata and controls
40 lines (28 loc) · 1.4 KB
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('missing crypto');
return;
}
const assert = require('assert');
const tls = require('tls');
assert.throws(() => tls.createSecureContext({ciphers: 1}),
/TypeError: Ciphers must be a string/);
assert.throws(() => tls.createServer({ciphers: 1}),
/TypeError: Ciphers must be a string/);
assert.throws(() => tls.createSecureContext({key: 'dummykey', passphrase: 1}),
/TypeError: Pass phrase must be a string/);
assert.throws(() => tls.createServer({key: 'dummykey', passphrase: 1}),
/TypeError: Pass phrase must be a string/);
assert.throws(() => tls.createServer({ecdhCurve: 1}),
/TypeError: ECDH curve name must be a string/);
assert.throws(() => tls.createServer({handshakeTimeout: 'abcd'}),
/TypeError: handshakeTimeout must be a number/);
assert.throws(() => tls.createServer({sessionTimeout: 'abcd'}),
/TypeError: Session timeout must be a 32-bit integer/);
assert.throws(() => tls.createServer({ticketKeys: 'abcd'}),
/TypeError: Ticket keys must be a buffer/);
assert.throws(() => tls.createServer({ticketKeys: new Buffer(0)}),
/TypeError: Ticket keys length must be 48 bytes/);
assert.throws(() => tls.createSecurePair({}),
/Error: First argument must be a tls module SecureContext/);