简体   繁体   English

如何使用非纯文本方式进行NSURLRequest登录

[英]How to make an NSURLRequest login NOT in plain text

Whats the best way to make this a more secure and less obvious security risk? 使其更安全且不那么明显的安全风险的最佳方法是什么?

NSString *loginIdentification = [NSString stringWithFormat:@"user=%@&pass=%@&", userNameLogin, passWordLogin];

    addressVariable = [NSString stringWithFormat:@"%@/%@", url, loginIdentification];
    addressVariable =  [addressVariable stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];

    NSURLResponse* response = nil;
    NSError* error = nil;
    NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];

确保您使用的是https连接,而不是http连接。

Instead of putting the sensitive information in the URL (via GET), use the POST method and put them in the body. 不要使用GET方法将敏感信息放在URL中(通过GET),而是将它们放在正文中。 That way, they won't show up in your server logs. 这样,它们将不会显示在您的服务器日志中。

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

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