生产环境中的服务器信任问题

时间:2013-03-10 14:30:11

标签: iphone cocoa-touch https nsurlconnection

我们正在测试我们的应用程序正在生产中,今天我们遇到了一个问题“此服务器的证书无效。您可能正在连接到假装是”server.name“的服务器,它可能会提供您的机密信息处于危险之中。

我们使用https连接,SSL证书也有效。

这种情况只会发生一段时间,并且不会再出现。

当被要求NSURLAuthenticationMethodServerTrust时,从客户端,canAuthenticateAgainstProtectionSpace:返回NO。

然后在

中记录以下错误
    - (void)connection:(NSURLConnection *)connection
      didFailWithError:(NSError *)error
{
    NSLog(@"Connection failed! Error - %@ %@",
           [error localizedDescription],
           [[error userInfo] objectForKey:NSURLErrorFailingURLStringErrorKey]);
}

错误记录是:

Connection failed! Error - The certificate for this server is invalid. You might be connecting to a server that is pretending to be “server.name” which could put your confidential information at risk.

服务器证书由COMODO High-Assurance Secure Server CA颁发。

1 个答案:

答案 0 :(得分:1)

可能的原因:

  • 证书并非完全有效
    • 时间已过,或本地时钟错误
    • 您访问的方式使主机无效,子网未被证书等覆盖
  • 您正在使用重写代理,即Charles,因此当前的证书不是您的服务器证书。
  • cert不是由服务器正确销售的。
  • 其他软件错误!
相关问题