简体   繁体   中英

How to authenticate username and password using keychain

I am working on creating an app login details. I have gone through keychain and i was able to create keychain wrapper. But the problem is how can we authenticate username and password details entered in login page.I have programmed to set username and password using he following

[keychainItem setObject:@"password you are saving" forKey:kSecValueData];
[keychainItem setObject:@"username you are saving" forKey:kSecAttrAccount];

I was also able to retrieve username and password

NSString *password = [keychainItem objectForKey:kSecValueData];
NSString *username = [keychainItem objectForKey:kSecAttrAccount];

But the above retrieves the recently stored username and password pair. But i want to search the username and password fields and authenticate them. Can any one please help me on this

Check out this tutorial: http://www.raywenderlich.com/6475/basic-security-in-ios-5-tutorial-part-1

It does a great job explaining how to authenticate passwords and even offers a keychain wrapper class. I believe this will answer your questions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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