Security in iPhone
My problem is : 1. I am developing an iPhone application i have proceded like this : the user authentication, with a user name and a password ( after a verification with web services), my question is how it is stored the username and the password in my applica开发者_高级运维tion. are there secured or did i proced to implement a secure mechanism ?
thanks for your answer
I am using SFHFKeychainUtils. It uses apple's Security Framework. It's easy to use, to save a Username and Password:
[SFHFKeychainUtils storeUsername:userNameString andPassword:passwordString forServiceName:@"YourServiceName" updateExisting:TRUE error:&error];
and to retrieve the encrypted password for a Username
[SFHFKeychainUtils getPasswordForUsername:userNameString andServiceName:@"YourServiceName" error:&error];
Use the Keychain : Keychain iphone
Saving:
NSUserDefaults *userNamePrefs = [NSUserDefaults standardUserDefaults];
NSUserDefaults *passwordPrefs = [NSUserDefaults standardUserDefaults];
[userNamePrefs setObject:@"username" forKey:@"username"];
[passwordPrefs setObject:@"password" forKey:@"password"];
Retrieving
NSUserDefaults *userNamePrefs = [NSUserDefaults standardUserDefaults];
NSUserDefaults *passwordPrefs = [NSUserDefaults standardUserDefaults];
NSString *savedUsername = [prefs stringForKey:@"username"];
NSString *savedPassword = [prefs stringForKey:@"username"];
what else UITextbox User enter just match the string like
if ((usernameTextBox.Text isEqualToString(savedUsername)) && (passwordTextBox.Text isEqualToString(savedPassword)) ){
// pass authentication
}
else{
// show alert view fail authetication
}
精彩评论