1
호스트가 신뢰할 수있는 목록에 있으면 NSURLConnection과 함께 자체 서명 된 인증서를 허용하려고합니다. 당신이 useCredential:forAuthenticationChallenge
를 호출하지만, 후도 continueWithoutCredentialForAuthenticationChallenge
왜 내가 궁금하네요,NSURLConnection을 통한 자체 서명 인증서 처리
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
if (allowSelfSignedCertForThisHost) {
NSLog(@"Allowing self signed!");
return YES;
}
}
return NO;
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) {
if ([trustedHosts containsObject:challenge.protectionSpace.host]) {
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
}
}
[challenge.sender continueWithoutCredentialForAuthenticationChallenge:challenge];
}
을하지만 :
나는 사람들의 많은이 같은 일을 참조하십시오.
그건 가능하지 않습니다. 연결하려는 호스트에서 전송됩니다. –
@Will이므로 다운로드하여 설치하십시오. 개인 키가 필요하지 않습니다. 그냥 증명서로 충분할거야. –
이 사용자 지정 인증서를 인식하기 위해 코드를 변경해야합니까? 이것은 더 간단하고 안전 해 보입니다. –