Tag: 安全传输

为什么我的服务器的通配符SSL证书被拒绝?

我正在使用NSURLConnection连接到通配符TLS证书(如“* .domain.com”)的服务器,当我在NSURLConnectionDelegate的-connection:willSendRequestForAuthenticationChallenge:方法中调用SecTrustEvaluate时,证书被拒绝为无效。 另一台具有完全指定的TLS证书的服务器(如“server2.domain.com”)被接受。 两个证书都由同一个CA颁发,并且已经将CA证书添加到我的设备的可信证书列表中。 我在iPhone / iOS 8.1上看到了与Safari相同的行为。 具有通配符证书的服务器被报告为具有不可信证书,而其他服务器正常工作。 所以它看起来像iOS的默authentication书validation拒绝通配符证书。 这是这种情况吗? 有没有办法告诉SecEvaluateTrust允许通配符证书? 这是我的-connection:willSendRequestForAuthenticationChallenge:摘录-connection:willSendRequestForAuthenticationChallenge: – (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { SecTrustRef trust = [challenge.protectionSpace serverTrust]; SecTrustResultType trustResult; OSStatus status = SecTrustEvaluate(trust, &trustResult); if (status == noErr) { if (trustResult == kSecTrustResultProceed || trustResult == kSecTrustResultUnspecified) { // Success. server2 gets here } […]