返回> 网站首页 

nodejs报错ERR_SSL_WRONG_VERSION_NUMBER分析

yoours2025-06-25 11:54:53 阅读 49

简介一边听听音乐,一边写写文章。

一、报错

    1. 执行命令 npm install -g yarn --verbose

    


二、简化程序进行分析

    编写js文件,内容为:

    var https = require('https');

    const fs = require('fs');

    var options = {

hostname: 'registry.npmmirror.com',

path: '/',

method: 'GET',

port: 443,

minVersion: 'TLSv1.3',

maxVersion: 'TLSv1.3',

ca: [

            fs.readFileSync('C:\\Program Files\\Common Files\\SSL\\certs\\windows_root_certs.pem'),        // 根证书

          ],

    };


const req = https.request(options, (res) => {

console.log('statusCode:', res.statusCode);

console.log('headers:', res.headers);

res.on('data', (d) => {

process.stdout.write(d);

});

});


三、执行简化程序

    node.exe e:\abc.js

    

四、分析
    在网上查找了各种方法,实验均不成功。
    1. 打开wireshake分析
    
    从图中可见https握手没通过。
    红色箭头处为客户端第一次向服务器发送握手数据。抓取分析类别仅仅是TCP,这是不正确的。

    2. 查看捕获的数据
    
    蓝色区域数据应为握手数据,此时可见该数据是异常的。至此结论为加密软件导致数据被加密,造成通讯失败。

五、正确的数据
    
    正常应显示TLSv1.3
    
    正常数据为16开头数据。

微信小程序扫码登陆

文章评论

49人参与,0条评论