Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android版本微信小程序连接wss失败 #645

Open
once-samuel opened this issue Dec 5, 2024 · 1 comment
Open

android版本微信小程序连接wss失败 #645

once-samuel opened this issue Dec 5, 2024 · 1 comment

Comments

@once-samuel
Copy link

使用android版本微信小程序去连接libhv创建的websocket服务器,直接返回websocket error,服务器方面已经按照下面代码设置了ssl:

m_WebSocketServer.https_port = port;
hssl_ctx_opt_t param = {};
param.crt_file = crt_file_path.c_str();
param.key_file = key_file_path.c_str();
param.endpoint = HSSL_SERVER;
if (0 != m_WebSocketServer.newSslCtx(&param))
{
return 2;
}

ssl的crt文件和key文件都是从aliyun申请的,经测试,ios版本的微信小程序、unity3d电脑版、unity3d的app版等版本,都可以正常连接,唯独android版本微信小程序的无法连接,经https://www.myssl.cn/tools/check-server-cert.html的检测,发现如下警告:

证书来源: 缺失证书
状态: 错误: 服务器缺少中间证书

根据资料查询要求将中间证书复制到crt证书后面,但阿里云提供的证书里面,crt证书后面已经有了中间证书,文件如下:

-----BEGIN CERTIFICATE-----
crt证书内容
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
中间证书内容
-----END CERTIFICATE-----

按网络上面资料证书是齐全的,但不知为何依然报错缺少中间证书???

@ithewei
Copy link
Owner

ithewei commented Dec 6, 2024

不太清楚,可以抓包看看SSL握手过程

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants