https验证证书的三个级别
一、无条件信任证书
1、
func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if(challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust)
{
print(challenge.protectionSpace.host)
if(challenge.protectionSpace.host == "111.11.11.11")
{
let credential = URLCredential(trust: challenge.protectionSpace.serverTrust!)
completionHandler(URLSession.AuthChallengeDisposition.useCredential, credential)
}
}
}
2、
SecTrustSetAnchorCertificates(serverTrust, trustedCertList)
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling,nil);
二、系统缺省验证:根据系统根证书验证证书链
completionHandler(NSURLSessionAuthChallengePerformDefaultHandling,nil);
三、证书强验证:根据本地保存的证书信息进行全面验证;
https://stackoverflow.com/questions/19507207/how-do-i-accept-a-self-signed-ssl-certificate-using-ios-7s-nsurlsession-and-its/20314162?r=SearchResults#20314162
https://www.jianshu.com/p/81eb390dc4c2
相关文章
- <转载> nginx服务器安装及配置文件详解 https://segmentfault.com/a/1190000002797601
- ASP.NET Web配置使用HTTPS实用案例
- 【Https异常】This request has been blocked; the content must be served over HTTPS
- 【Nginx】使用certbot安装免费https证书使Nginx支持Https请求
- 【自学课程】IIS7如何实现HTTP重定向HTTPS
- 真机远程页面调试工具spy-debugger 3.x:集成weinre+AnyProxy,页面调试+抓包。调试生产HTTPS页面。
- 【刷题】面筋-网络-HTTPS抓包原理与charles抓包步骤
- haproxy 配置https 同时技持443 80端口
- nginx 反向代理 配置 https 实现http https同时存在 经测试 支持location 规则
- wireshark分析https数据包解密前后的特点
- 图解HTTPS
- 如何在HTTPS 网页中引入HTTP资源: Mixed Content?
- 解决SVN提示https证书验证失败问题svn: E230001: Server SSL certificate verification failed: certificate issued
- 请说明一下http和https的区别
- 前端面试题:http 和 https 的区别 ?
- Atitit Java制作VCARD vcf 以上就是关于vCard的基本介绍,维基百科(英文)https://en.wikipedia.org/wiki/VCard写的比较全,可惜我看不懂。
- 关于httpclient 请求https (如何绕过证书验证)
- 成功解决 Exception: URL fetch failure on https://s3.amazonaws.com/img-datasets/mnist.npz: None -- [Errno
- Nginx报错Mixed Content: The page was loaded over HTTPS, This content should also be served over https
- Android okhttp https TrustManager简单总结
- php判断是否https
- Jmeter录制一个难度*****的HTTPS脚本——禅道登录