【问题标题】:SSL certificate for iPhone -> which CA?iPhone 的 SSL 证书 -> 哪个 CA?
【发布时间】:2011-02-15 11:24:35
【问题描述】:

我发现 NSUrlConnection 的所有这些变通方法都使用封闭的 API 来访问不受信任的 SSL 证书。其他选项是首先使用 Safari/Mail 应用程序安装证书。

我想知道安装了哪些根证书,所以我可以从受信任的 CA 获得一个,按照您应该这样做的方式..

有人知道我需要什么 CA 吗?

【问题讨论】:

标签: iphone ssl https nsurlconnection certificate-authority


【解决方案1】:

您实际上可以使用公共 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];
}

【讨论】:

    【解决方案2】:

    这里是iphone预装的可用CA列表

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

    您可以让任何这些机构签署您的证书,或者您可以签署自己的证书并使用 OpenSSL 创建自己的 CA

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-25
      • 1970-01-01
      • 2021-01-17
      • 2015-04-01
      • 1970-01-01
      • 2021-12-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多