我找到了所有这些用于Nsurlconnection的工作,它们使用封闭的API访问未经信任的SSL证书。其他选项是首先使用Safari/Mail应用程序安装证书。

我想知道已安装了什么根证书,因此我可以从可信赖的CA中获得您应该做的方式。

有人知道我需要什么?

有帮助吗?

解决方案

这是iPhone上安装的可用CA Pre的列表

http://support.apple.com/kb/ht2185

您可以获得这些当局签署的证书,也可以签署自己的证书并使用OpenSSL创建自己的CA

其他提示

实际上,您可以使用公共API接受自签名的SSL证书:

- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
    return [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust];
}

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
    if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
        [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
    }

    [challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top