https访问中,忽略SSL证书检查

有时候,有这么一种场景。https接口有SSL证书, 但访问的客户端不能联网验证证书,也不能本地存储证书。

Python中, 大概如下处理:

verify设置为 False,Requests 能忽略对 SSL 证书的验证。

rs =requests.session()
r= rs.get(url, params=data, timeout=(3,7), verify=False)

C#中,

HttpClientHandler handler = new HttpClientHandler
{
   ServerCertificateCustomValidationCallback=(message,cert,chain,errors)=>{return true;},
   // 忽略tls1.2
}
HttpClient httpClient = new HttpClient(handler);
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls13 | SecurityProtocolType.Tls12;

原创文章,作者:Gary,如若转载,请注明出处:https://www.cpw5.top/81.html

淘宝小店:陈皮王五工作室

(0)
GaryGary
上一篇 2024-08-04 下午1:05
下一篇 2024-08-06 下午12:44

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注