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

测试https 使用curl 验证不通过 #209

Open
lialvin opened this issue Jan 7, 2022 · 7 comments
Open

测试https 使用curl 验证不通过 #209

lialvin opened this issue Jan 7, 2022 · 7 comments

Comments

@lialvin
Copy link

lialvin commented Jan 7, 2022

#由ca 生成证书
openssl genrsa -out server.key 1024
openssl req -new -subj /CN=thgy/O=thchain/OU=keyms -key server.key -out server.csr

openssl genrsa -out ca.key 1024
openssl req -new -subj /CN=thgy/O=thchain/OU=keyms -key ca.key -out ca.csr
openssl x509 -req -in ca.csr -signkey ca.key -out ca.crt
openssl x509 -req -CA ca.crt -CAkey ca.key -CAcreateserial -in server.csr -out server.crt
openssl x509 -in ca.crt -out ca.pem -outform PEM
https 服务端 使用 server.key server.crt

客户端使用
curl --cacert ca_info.pem -H "Content-type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"encDataKey","params":["'123456'"],"id":83}' https://127.0.0.1:9001/

访问 alvin@node1:~/thkms/scripts$ curl --cacert ca_info.pem -H "Content-type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"encDataKey","params":["'123456'"],"id":83}' https://127.0.0.1:9001/
curl: (60) SSL certificate problem: self signed certificate
More details here: https://curl.haxx.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
报错,能帮忙确认下问题吗? 使用不验证对端可以访问

@qicosmos
Copy link
Owner

openssl版本是什么版本?

@qicosmos
Copy link
Owner

我之前测试的好像是1.02版

@lialvin
Copy link
Author

lialvin commented Jan 11, 2022

openssl版本是什么版本?

alvin@node1:~$ openssl version
OpenSSL 1.1.1l 24 Aug 2021

@qicosmos
Copy link
Owner

新版本我都还没测试过

@qicosmos
Copy link
Owner

qicosmos commented Jan 11, 2022

不确定asio是不是支持了新版本的ssl,我要确认一下

@lialvin
Copy link
Author

lialvin commented Jan 11, 2022

好的,谢谢

@qicosmos
Copy link
Owner

可否测试一下最新的代码呢?

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