当前系统环境:centos7 x64. dotnet 2.0.

不管是

ServicePointManager.ServerCertificateValidationCallback = (a, b, c, d) => true;

还是:

HttpClient httpClient = new HttpClient(new HttpClientHandler() { ServerCertificateCustomValidationCallback = (a, b, c, d) => true });

都会发生错误:

错误信息大致如下:

(The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.28.4").) ---> System.PlatformNotSupportedException: The handler does not support custom handling of certificates with this combination of libcurl (7.29.0) and its SSL backend ("NSS/3.28.4").

at System.Net.Http.CurlHandler.SslProvider.SetSslOptionsForUnsupportedBackend(EasyRequest easy, ClientCertificateProvider certProvider)

at System.Net.Http.CurlHandler.SslProvider.SetSslOptions(EasyRequest easy, ClientCertificateOption clientCertOption)

解决方案:

# yum update(可选)
# yum install openssl-devel gcc #安装openssl和gcc # 安装指定版本的curl
# wget https://curl.haxx.se/download/curl-7.55.1.tar.gz
# tar -zxf curl-7.55.1.tar.gz
# cd curl-7.55.1
# ./configure --prefix=/usr/local/curl/ --without-nss --with-ssl=/usr/local/ssl/
# make
# make install #备份原来的curl
mv /usr/bin/curl /usr/bin/curl.bak #将安装的curl 创建软连
ln -s /usr/local/curl/bin/curl /usr/bin/curl
# curl --version
#差不多输出下面的内容
#curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1 OpenSSL/1.0.2k zlib/1.2.7 #增加lib搜索目录
# vi /etc/ld.so.conf
#增加
# /usr/local/curl/lib
# cat /etc/ld.so.conf
差不多下面这样子
#
include ld.so.conf.d/*.conf
/usr/local/curl/lib # 重新load配置
# ldconfig

参考文章:

https://www.latoooo.com/xia_zhe_teng/368.htm

https://segmentfault.com/a/1190000012282935

https://www.cnblogs.com/Anker/p/3209876.html

https://github.com/dotnet/corefx/issues/9728#issuecomment-286251370

解决linux netcore https请求使用自签名证书忽略安全检查方法的更多相关文章

  1. openssl req 证书请求及自签名证书

    介绍 openssl req 用于生成证书请求,以让第三方权威机构CA来签发,生成我们需要的证书.req 命令也可以调用x509命令,以进行格式转换及显示证书文件中的text,modulus等信息.如 ...

  2. C#创建https请求并使用pfx证书

    常规情况下创建Web请求,并获取请求数据的代码如下: WebRequest req = WebRequest.Create(url); req.Timeout = 15000; WebResponse ...

  3. WinInet:HTTPS 请求出现无效的证书颁发机构的处理

    首先,微软提供的WinInet库封装了对网页访问的方法. 最近工作需要从https服务器获取数据,都知道https和http网页的访问方式不同,多了一道证书认证程序,这样就使得https在请求起来比h ...

  4. linux 测试 get 请求 跳过SSL证书验证

    Linux 下测试 get 请求: curl : curl "http://www.qq.com" # 标准输出页面内容 curl -i "http://www.qq.c ...

  5. AFNetWorking https请求 SSL认证 自制证书

    1.服务器会给一个证书,一般为.pem格式证书 2.将.pem格式的证书转换成.cer格式的证书 打开电脑自带终端 ,进入到桌面  cd Desktop 回车回到桌面Desktop Admin$ 输入 ...

  6. 解决Linux系统下程序找不到动态库的方法

    思路:一般来说,通过make命令已经将程序依赖的动态库编译出来了,通过make install命令已经将动态库安装到系统的某个路径下.找没找到动态库就看这个路径是否包含在系统默认搜索动态库的路径中,如 ...

  7. linux:Nginx+https双向验证(数字安全证书)

    本文由邓亚运提供 Nginx+https双向验证 说明: 要想实现nginx的https,nginx必须启用http_ssl模块:在编译时加上--with-http_ssl_module参数就ok.另 ...

  8. [https]公司导入自签名证书实现https监控

    https://www.v2ex.com/t/143012

  9. git openssl 模块生成 https 请求的 ssl 测试证书

    1,请先确定安装了相关模块 1.1,git --version 1.2,openssl version -a 2,创建一个目录, cd 到该目录下 3,生成私钥  key 文件   openssl g ...

随机推荐

  1. insertion sort list (使用插入排序给链表排序)

    Sort a linked list using insertion sort. 对于数组的插入排序,可以参看排序算法入门之插入排序(java实现),遍历每个元素,然后相当于把每个元素插入到前面已经排 ...

  2. 二叉树的序列化和反序列化(Java)

    请实现两个函数,分别用来序列化和反序列化二叉树 序列化就是将二叉树以字符串输出,反序列化:根据自己输出的字符串,构建二叉树. 这里先序遍历输出,且为了方便反序列化,各个节点","隔 ...

  3. java中Scanner类nextLine()和next()的区别和使用方法

    转载:http://blog.csdn.net/zhiyuan_ma/article/details/51592730 在实现字符窗口的输入时,很多人更喜欢选择使用扫描器Scanner,它操作起来比较 ...

  4. JAVA程序员面试宝典

    程序员面试之葵花宝典 面向对象的特征有哪些方面    1. 抽象:抽象就是忽略一个主题中与当前目标2. 无关的那些方面,3. 以便更充分地注意与当前目标4. 有关的方面.抽象并不5. 打算了解全部问题 ...

  5. 在Redis Sentinel环境下,jedis该如何配置

    在Redis主从复制架构中,如果master出现了故障,则需要人工将slave提升为master,同时,通知应用侧更新master的地址.这样方式比较低效,对应用侧影响较大. 为了解决这个问题,Red ...

  6. 我的AngularJS学习轨迹

    开始接触Anguljar可能是在2013年初,那个时候的版本1.0.*,那个时候国内主要的中文资料AngularJS学习笔记:http://zouyesheng.com/angular.html,an ...

  7. springboot中使用分页,文件上传,jquery的具体步骤(持续更新)

    分页: pom.xml     加依赖 <dependency> <groupId>com.github.pagehelper</groupId> <arti ...

  8. python argparse用法总结

    转:python argparse用法总结 1. argparse介绍 argparse是python的一个命令行解析包,非常适合用来编写可读性非常好的程序. 2. 基本用法 prog.py是我在li ...

  9. maxSubArray

    Description: Find the contiguous subarray within an array (containing at least one number) which has ...

  10. python 中的csv读写

    1.首先 import csv 2.读一个csv文件 data = open(filename) lines = csv.reader(data)  #reader 函数和 dirtreader函数的 ...