Iphone 评估服务器证书
如何从已吊销或过期的证书中检测自签名证书 我正在使用NSURLConnection并在代理上实现connection:didReceiveAuthenticationChallenge:Iphone 评估服务器证书,iphone,security,certificate,Iphone,Security,Certificate,如何从已吊销或过期的证书中检测自签名证书 我正在使用NSURLConnection并在代理上实现connection:didReceiveAuthenticationChallenge: - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{ if ([challenge.protectionS
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge{
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]){
NSURLProtectionSpace *tmpSpace=[challenge protectionSpace];
SecTrustRef currentServerTrust=[tmpSpace serverTrust];
SecTrustResultType trustResult;
OSStatus err = SecTrustEvaluate(currentServerTrust, &trustResult);
BOOL trusted = (err == noErr) && ((trustResult == kSecTrustResultProceed) || (trustResult == kSecTrustResultUnspecified));
if (trusted){
// Do something
}
}
}
目前,“if(trusted){}”块仅适用于iOS信任的证书,我希望它也适用于其他证书,但前提是证书未被吊销或过期
文档使用SecTrustSettingsSetTrustSettings更改设置并重新评估信任。但是我在iOS上找不到这个方法(或者SecTrustSetting),只有在Mac上
感谢信任评估的成功
在这两种情况下,您都需要访问锚证书。信任评估才能成功
在任何一种情况下,您都需要访问锚证书。请阅读我关于此问题的帖子: 基本上:
- OCSP用于EV证书
- 工作“尽力而为”
- 这是一个阻塞操作
- OCSP用于EV证书
- 工作“尽力而为”
- 这是一个阻塞操作