curl编译支持https

一、正常编译

使用版本
curl7.85.0

…/ 表示需要自己确定的目录

1、编译openssl

./config no-asm no-async -shared --cross-compile-prefix=arm-linux-gnueabihf- --prefix=.../openssl1.1.0e-lz_328arm

2、编译curl

…/ 指定的目录自己修改

./configure --host=arm-linux CC=.../arm-linux-gnueabihf-gcc --prefix=.../out --with-openssl=.../openssl_install --disable-tls-srp --disable-rtsp --disable-hsts --disable-alt-svc --disable-mqtt --disable-ftp --disable-tftp --disable-smb --disable-gopher --disable-imap --disable-pop3 --disable-smtp --disable-telnet --disable-dict

3、测试

-v 查看具体信息
-k 跳过验证,那么就无需指定证书了

./curl <https-url> -v -k

顺便提一下wget的跳过证书校验命令

wget 'https://192.168.0.100:9200' --no-check-certificate

正常出现
在这里插入图片描述
下边出现的异常,单独会描述。

4、代码设置

curl_easy_setopt(curl,CURLOPT_SSL_VERIFYPEER,0L);//设定为不验证证书和HOST
curl_easy_setopt(curl,CURLOPT_SSL_VERIFYHOST,0L);

libcurl 如何支持https

二、遇到问题

1、wrong signature length

在这里插入图片描述
因为我是在虚拟机上编译,的虚拟机是64位,设备是32位,导致编译后的libcrypto.so不对,报签名长度出错。解决办法,编译之前加上 setarch i386。

setarch i386 ./config no-asm no-async -shared --cross-compile-prefix=arm-linux-gnueabihf- --prefix=.../openssl1.1.0e-lz_328arm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值