I don't have a lot experience about Client Certificate Authentication. Anybody can tell me how to use it in iOS app? Thanks :)
A:
Your NSURLConnection delegate should respond to the 'connection:didReceiveAuthenticationChallenge:' delegate method (see link below).
It should respond by asking the challenge for its 'sender' and providing it with an appropriate credential.
Something like:
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
id sender = [challenge sender];
// create a credential from a certificate
// see doco for details of the parameters
NSURLCredential *creds = [NSURLCredential credentialWithIdentity:ident certificates:certs persistence:persistence];
[sender useCredential:creds forAuthenticationChallenge:challenge];
}
See the NSURLCredential class reference for details of how to create a credential based on a certificate:
Jake
2010-09-22 03:09:00