使用SFCertificateTrustPanel
显示SecTrustRef
对象的结果时,默认为消息:
证书信任验证期间发生故障。请指定需要更新的证书的信任设置。
与Safari的实施相比,这似乎相当模糊和缺乏:
Safari无法验证网站“example.com”的身份
本网站的证书无效。您可能正在连接到假装为“example.com”的网站,这可能会使您的机密信息面临风险。您还想连接到网站吗?
如果您让NSURLConnection
或类似内容失败,则NSError
包含以下内容:
NSLocalizedDescription = "The certificate for this server is invalid. You might be connecting to a server that is pretending to be "example.com" which could put your confidential information at risk.";
NSLocalizedRecoverySuggestion = "Would you like to connect to the server anyway?";
所以我似乎有几个选择:
我有错过的选项4吗?如果不是,那么2.和3.中哪一个更好?我很担心2.由于没有考虑到特定的边缘情况,很容易产生错误的信息。