I'm trying to use the KeychainItemWrapper.h
and keychainWrapperItemWrapper.m
to store user credentials such as username and password. I currently store when user logs in for the first time like this:
KeychainItemWrapper* keychain = [[KeychainItemWrapper alloc] initWithIdentifier:@"login" accessGroup:nil];
[keychain setObject:_usernameField.text forKey:(__bridge id)kSecValueData];
[keychain setObject:_passwordField.text forKey:(__bridge id)kSecAttrAccount];
This stores the values in keychain. But the next time user opens app I want to retrieve the username and password again. However when i call the following:
NSString *password_ = [keychain objectForKey:(__bridge id)kSecValueData];
NSString *username_ = [keychain objectForKey:(__bridge id)kSecAttrAccount];
It seems i get weird encrypted key such as: <6f78696c 69676874 2d746573 74>
Is there any way to retrieve the original strings for username and password?
I've never worked with keychain before, any help would be appreciated!