简体   繁体   English

NSURLCredential是否通过https安全?

[英]Is NSURLCredential secure over https?

Is NSURLCredential a safe way to send a password over a https connection when responding to a authentication challenge? NSURLCredential是响应身份验证挑战时通过https连接发送密码的安全方法吗? 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? 加密,而不仅仅是作为url中的参数-这是正确的吗?

Thanks for the responses! 感谢您的回复!

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];

}

Yes, Yes it is. 是的,是的。 NSURLCredential is secure if you answer the delegate method properly. 如果正确回答委托方法,则NSURLCredential是安全的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM