iOS Https 服务器证书无效
来源:互联网 发布:手机实用小五金软件 编辑:程序博客网 时间:2024/05/18 13:43
错误:“此服务器的证书无效。您可能正在连接到一个伪装成“www.xxxxxx.com”的服务器,这会威胁到您的机密信息的安全。”
原因:安全证书是自己的服务器生成的,未获权威认证。
方案:需要iOS客户端忽略证书验证。关键代码:
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace{ return [protectionSpace.authenticationMethodisEqualToString:NSURLAuthenticationMethodServerTrust];}- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ if ([challenge.protectionSpace.authenticationMethodisEqualToString:NSURLAuthenticationMethodServerTrust]) { [[challenge sender] useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]forAuthenticationChallenge:challenge]; [[challenge sender] continueWithoutCredentialForAuthenticationChallenge: challenge]; }}
0 0
- iOS Https 服务器证书无效
- iOS里加载https请求报错说服务器证书无效的解决办法
- ios UIWebView加载https出现 load page error:Error Domain=NSURLErrorDomain Code=-1202 "此服务器的证书无效
- ios证书无效解决办法
- OpenSSL创建客户端、服务器证书,ios双向https认证
- ios企业版发布 https证书以及服务器设置
- iOS企业版发布 HTTPS证书以及服务器设置
- iOS https请求第一步从服务器下载证书
- iOS HTTPS安全请求 验证服务器返回的证书
- IOS HTTPS证书问题
- IOS HTTPS证书问题
- iOS HTTPS 自建证书
- HTTPS证书问题 iOS
- 微信小程序免费https证书报错https证书无效
- 服务器证书无效的解决办法
- 【MFC】https post 出现证书无效问题
- 自建证书配置HTTPS服务器
- Apache服务器安装https证书
- 静态网页与动态网页
- HUAWEI 3层交换机VLANIF VLAN间路由
- 纪念我的大学生活
- 2.7 缓冲区对象
- 20 迭代器模式
- iOS Https 服务器证书无效
- jvm_内存溢出_虚拟机栈和本地方法栈溢出
- error和Exception有什么区别
- OSG和osgearth显示中文
- Android 高级动画总结(Property Animation)
- java中length属性,length()方法和size()的方法的区别
- 3.11 如何让app使用icon fonts
- ScrollView好用技巧
- MFC消息映射机制(2)