如何从NSURLAuthenticationMethodServerTrust挑战中确定SSL证书过期日期

时间:2016-02-05 12:55:45

标签: ios ssl-certificate nsurlconnection

代表内部

- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

获得服务器挑战后,我可以使用以下代码提取X.509证书:

    SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
    SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, 0);

现在我需要从此SecCertificateRef获取过期日期。

还要检查证书是否具有有效的域名。 我已经浏览了苹果文档和google了很长时间,有些人建议使用SLL库来获取这些细节。在项目中,不允许使用第三方库。有没有办法在没有第三方库的情况下获得这些细节?

0 个答案:

没有答案
相关问题