0
기본 HTTP 인증을 수행하는 코드를 사용합니다 (아래 참조). 이것은 IOS 5에서 잘 작동합니다. 그러나 이제 프로토콜을 https로 변경했으며 가짜 자체 서명 인증서를 사용했습니다. 그것은 또한 일했다! 이것은 안전하지 않은 것처럼 보인다. 특정 인증서를받지 못하게하려면이 방법으로 무언가를해야하는지 알 수 있습니까?ios5에서 자체 서명 된 SSL 인증서 방지
- (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:
(NSURLAuthenticationChallenge *)challenge {
if ([challenge previousFailureCount] <= maxRetryCount) {
NSURLCredential *newCredential =
[NSURLCredential
credentialWithUser: userName
password:password
persistence:NSURLCredentialPersistenceForSession];
[[challenge sender]
useCredential:newCredential
forAuthenticationChallenge:challenge];
}
else
{
NSLog(@"Failure count %d",[challenge previousFailureCount]);
}
}
주 –