iOS ATS测试跳过无效证书
来源:互联网 发布:怎样在淘宝联盟买东西 编辑:程序博客网 时间:2024/05/04 18:48
1.
2.
-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{ NSString* url = [[request URL] absoluteString];//判断是不是https if ([url containString:@"https"]) { //如果是https:的话,那么就用NSURLConnection来重发请求。从而在请求的过程当中吧要请求的URL做信任处理。 if (!self.isAuthed) { _isAuthed = kNeverAuthenticate; _originRequest = request; NSURLConnection* conn = [[NSURLConnection alloc] initWithRequest:request delegate:self]; [conn start]; [webView stopLoading]; return NO; } } return YES;}
2.
#pragma mark connection- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ NSLog(@"回调"); if ([challenge previousFailureCount] == 0){ self.isAuthed = kTryAuthenticate; NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; [challenge.sender useCredential:credential forAuthenticationChallenge:challenge]; [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge]; } else{ [[challenge sender] cancelAuthenticationChallenge:challenge]; }}- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{ self.isAuthed = kTryAuthenticate; //webview 重新加载请求。 [self.baseWebView loadRequest:_originRequest]; [connection cancel];}
@implementation NSURLRequest(DataController)+ (BOOL)allowsAnyHTTPSCertificateForHost:(NSString *)host{ return YES;}@end
阅读全文
0 0
- iOS ATS测试跳过无效证书
- IOS ATS适配SSL证书方案
- ios证书无效解决办法
- IOS生成证书提示证书无效
- iOS Https 服务器证书无效
- iOS开发证书无效解决办法
- ios 证书签发者无效
- iOS 开发证书无效 详解
- 解决ios证书无效问题
- ios企业开发者证书无效
- ios 测试证书配置
- ATS的诊断工具:测试iOS使用的HTTPS地址是否符合ATS的规则
- iOS 7.1企业应用证书无效问题
- iOS 生成开发者证书,提示无效
- ios-此证书的签发者无效
- iOS开发之证书无效解决方案
- iOS 开发证书签发者无效
- iOS 此证书签发者无效 解决办法
- Spring Boot 集成 resteasy篇 — jax-rs初步介绍和spring boot集成
- Carbon Data 字典编码
- Flip Game POJ
- ??运算符
- Java中的Filter过滤器
- iOS ATS测试跳过无效证书
- jedis总结
- maven生成可以直接运行的jar(包括依赖和mainclass)
- 静态注册 ACTION_SCREEN_ON & ACTION_SCREEN_OFF 收不到
- springmvc参数绑定
- HDU 6170 Two strings
- 一些关于工程的构想
- xgboost 实战以及源代码分析
- 海量数据处理-BloomFilter