I created an as.net web api to receive users credentials to authenticate. In my iOS app I am sending the username and password to the url. I only want to encrypt the password.
How to send an encrypted password that I can then decrypt it in asp.net?
My code:
NSString *username = Username.text;
NSString *password = Password.text;
NSData *dataToEnc = [Password.text dataUsingEncoding:NSUTF8StringEncoding];
NSData *encryptedData = [dataToEnc AES256EncryptWithKey:password];
NSURL *urlFormat = [NSURL URLWithString:[API_LOGIN stringByAppendingFormat:@"%@/%@",username, encryptedData]];
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:urlFormat cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:60];
NSData *returnData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:nil error:nil];
NSString *responseString = [[NSString alloc] initWithData:returnData encoding:NSUTF8StringEncoding];
This does not work.