call SecTrustEvaluate before calling SecTrustGetCertificateCount

SecTrustGetCertificateCount's documentation says SecTrustEvaluate must be called before calling it. Without calling it, SecTrustGetCertificateCount returns 0 in OS X 10.7.
This commit is contained in:
Josh Chung 2014-04-14 17:13:24 +09:00
parent d74e568cf2
commit 5c237a66eb

View file

@ -592,6 +592,7 @@ willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challe
SecTrustRef serverTrust = challenge.protectionSpace.serverTrust;
SecPolicyRef policy = SecPolicyCreateBasicX509();
SecTrustEvaluate(serverTrust, NULL);
CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust);
NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:certificateCount];