MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

test/parallel/test-tls-dhe.js:77–104  ·  view source on GitHub ↗
(dhparam, keylen, expectedCipher)

Source from the content-addressed store, hash-verified

75}
76
77function test(dhparam, keylen, expectedCipher) {
78 const options = {
79 key,
80 cert,
81 ciphers,
82 dhparam,
83 maxVersion: 'TLSv1.2',
84 };
85
86 const server = tls.createServer(options, (conn) => conn.end());
87
88 server.listen(0, '127.0.0.1', common.mustCall(() => {
89 const args = ['s_client', '-connect', `127.0.0.1:${server.address().port}`,
90 '-cipher', `${ciphers}:@SECLEVEL=1`];
91
92 execFile(opensslCli, args, common.mustSucceed((stdout) => {
93 assert(keylen === null ||
94 // s_client < OpenSSL 3.5
95 stdout.includes(`Server Temp Key: DH, ${keylen} bits`) ||
96 // s_client >= OpenSSL 3.5
97 stdout.includes(`Peer Temp Key: DH, ${keylen} bits`));
98 assert(stdout.includes(`Cipher : ${expectedCipher}`));
99 server.close();
100 }));
101 }));
102
103 return once(server, 'close');
104}
105
106function testCustomParam(keylen, expectedCipher) {
107 const dhparam = loadDHParam(keylen);

Callers 2

testCustomParamFunction · 0.70
test-tls-dhe.jsFile · 0.70

Calls 8

listenMethod · 0.80
includesMethod · 0.80
onceFunction · 0.70
addressMethod · 0.65
closeMethod · 0.65
execFileFunction · 0.50
assertFunction · 0.50
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…