Aaron
Aaron

Reputation: 71

Is NSURLCredential secure over https?

Is NSURLCredential a safe way to send a password over a https connection when responding to a authentication challenge? I assume that this sends the user name and password in a safe way, aka. encrypted and not just as parameters in the url - is this correct?

Thanks for the responses!

Upvotes: 0

Views: 817

Answers (2)

Elak Wish
Elak Wish

Reputation: 26

Yes, Yes it is. NSURLCredential is secure if you answer the delegate method properly.

Upvotes: 0

user170317
user170317

Reputation: 1202

If you answer the delegate method, it is passed securely.

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
NSString *user = you user
NSString *password = you pass;

NSURLCredential *credential = [NSURLCredential credentialWithUser:user
                                                         password:password
                                                      persistence:NSURLCredentialPersistenceForSession];
[[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];

}

Upvotes: 1

Related Questions