Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何查看NodeJS SSL协商结果_Node.js_Ssl - Fatal编程技术网

Node.js 如何查看NodeJS SSL协商结果

Node.js 如何查看NodeJS SSL协商结果,node.js,ssl,Node.js,Ssl,我正在使用HTTPS创建一个nodeJS服务器,与此类似: var https = require('https'); function listener(req, res) { // for example, I wish this worked... console.log(req.chosen_cipher) } var httpsd = https.createServer(SslOptions, listener); httpsd.listen(8081, opts

我正在使用HTTPS创建一个nodeJS服务器,与此类似:

var https = require('https');

function listener(req, res) {
    // for example, I wish this worked...
    console.log(req.chosen_cipher)
}

var httpsd = https.createServer(SslOptions, listener);
httpsd.listen(8081, opts.ip);
如何查找SSL协商结果(尤其是所选密码),例如ECDHE-RSA-AES128-GCM-SHA256等

我已经序列化了req&res对象,但似乎没有任何可能的候选对象

谢谢

当前连接的是
req.client

因此,要获取密码和协议调用:

function listener(req, res) {
    console.log(req.client.getCipher());
    // Possible result: 
    // { name: 'ECDHE-RSA-AES128-GCM-SHA256', version: 'TLSv1/SSLv3' }
}