【发布时间】:2013-03-10 14:30:10
【问题描述】:
我们正在测试我们的应用是否已投入生产,今天我们遇到了一个问题“此服务器的证书无效。您可能正在连接到一个伪装成“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 颁发。
【问题讨论】:
-
也许你被间歇性的MITMed!
标签: iphone cocoa-touch https nsurlconnection