当前系统环境: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. 运行ant脚本(转载)

    http://blog.csdn.net/linwei_1029/article/details/5809801 运行ANT脚本的步骤 1.右击我的电脑-->属性-->高级-->环境 ...

  2. jQuery监听事件经典例子

    关键字:jQuery监听事件经典例子  js代码:  ============================================================  $(function( ...

  3. 阿里REDIS优化

  4. 3 Steps to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id

    http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-s ...

  5. python 脚本自动登陆校园网

    学校的校园网每次重开电脑时都要重新打开浏览器进行网页登录,繁琐的操作比较麻烦,于是便写了个python的脚本进行自动登录,下面说下具体的操作过程: 1. 方法说明 博主采用的python的 reque ...

  6. JSF-使用JSF标记

    使用JSF标记 基于Facelets技术的JSF页面是一个 XHTML页面,文件扩展名为 .xhtml 1)JSF页面可用html标记,但必须满足: ①所有标记都必须闭合.如<p>开始,& ...

  7. SOFA 源码分析 — 预热权重

    前言 SOFA-RPC 支持根据权重对服务进行预热功能,具体地址:预热权重. 引用官方文档: 预热权重功能让客户端机器能够根据服务端的相应权重进行流量的分发.该功能也常被用于集群内少数机器的启动场景. ...

  8. hadoop is running beyond virtual memory limits问题解决

    单机搭建了2.6.5的伪分布式集群,写了一个tf-idf计算程序,分词用的是结巴分词,使用standalone模式运行没有任何问题,切换到伪分布式模式运行一直报错: hadoop is running ...

  9. require/exports 和 import/export 区别

    零.区别 1.require/exports 是 CommonJS 的标准,适用范围如 Node.js 2.import/export 是 ES6 的标准,适用范围如 React 一.间接获取对象 ( ...

  10. ImportError: numpy.core.multiarray failed to import

    1. ImportError: numpy.core.multiarray failed to import pip install -U numpy http://stackoverflow.com ...