I am using node version 8.9.1 and wwant to know which version of TLS does it use by default.
I tried googling and looked at the node js documentation but could not find the answer
I am using node version 8.9.1 and wwant to know which version of TLS does it use by default.
I tried googling and looked at the node js documentation but could not find the answer
 
    
    You can generate a self signed certificate with :
openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes
It will create key.pem and cert.pem files in current directory, you can then start a server with :
const tls = require('tls');
const fs = require('fs');
const options = {
  key: fs.readFileSync('key.pem'),
  cert: fs.readFileSync('cert.pem')
};
const server = tls.createServer(options, (socket) => {
  console.log('server connected',
          socket.authorized ? 'authorized' : 'unauthorized', socket.getProtocol());
  socket.write('welcome!\n');
  socket.setEncoding('utf8');
  socket.pipe(socket);
});
server.listen(8000, () => {
  console.log('server bound');
});
and connect to it using openssl s_client :
openssl s_client -connect 127.0.0.1:8000
Testing on node v8.11.3 will output :
server bound
server connected unauthorized TLSv1.2
ref :
