curl忽略ssl证书进行https请求
·
在调试一块设备连接业务平台是发现报错:
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS alert, Server hello (2):
* SSL certificate problem: certificate has expired
curl: (60) SSL certificate problem: certificate has expired
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
the -k (or --insecure) option.
问题比较明显:
SSL certificate problem: certificate has expired
SSL证书过期了。解决办法就是更新服务器的证书。
不过一些其他原因导致这个证书更新需要时间,在这段时间其实也可以继续调试接口,那就要采用忽略证书校验这一步,但保留SSL认证流程。
curl的社区大神们给了这样一个参数
-k
注意是小写的k,意思是:允许curl使用非安全的ssl连接并且传输数据(证书不受信)。
curl -v -k https://xxx.xxxx.xxx/xx
整个SSL的握手过程终于正常进行了:
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
更多推荐
已为社区贡献9条内容
所有评论(0)