1

I have a question about an extended SSL certificate verification on iOS. The code I have looks as it follows:

- (void) validateAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {

    if (!someCustomCheck()) { // I do some custom check here
        [paramChallenge.sender cancelAuthenticationChallenge:challenge];
    }

    NSURLCredential *credential = [NSURLCredential credentialForTrust:[challenge protectionSpace].serverTrust];
    if (credential) {
        [challenge.sender useCredential:credential forAuthenticationChallenge:challenge];
    }
    else {
        [challenge.sender cancelAuthenticationChallenge:challenge];
    }
}

The tests show me that at this point the normal iOS check for SSL certificate is not happening. Can I assume that if I replace the line:

[challenge.sender useCredential:credential forAuthenticationChallenge:challenge];

with

[challenge.sender performDefaultHandlingForAuthenticationChallenge:challenge];

so after my custom check I will still have the default system SSL certificate check?

It makes sense from the documentation but many examples which I have seen normally do some custom verification and then call

[challenge.sender useCredential:credential forAuthenticationChallenge:challenge];

Thanks.

Dmytro
  • 2,522
  • 5
  • 27
  • 36

0 Answers0