Hi everyone I'm working with symmetric encryption in my app to encrypt messages that users send to each other. Now I'm trying to create a fairly secure key to decrypt this data (decryption key) using an NSMutableData. Currently I have two questions:
Is a 256-bit key for decryption safe enough?
I have some problems with NSString. When I want to retrieve the string value of the NSMutableData my NSLog always returns me a null value
Where am I doing wrong?
NSMutableData *masterKey = [NSMutableData dataWithLength:32];
int result = SecRandomCopyBytes(kSecRandomDefault, 32, masterKey.mutableBytes);
if (result != noErr) {
NSLog(FAILED_MASTERKEY);
return;
}
NSLog(@"MASTER %@",[[NSString alloc] initWithData:masterKey encoding:NSUTF32StringEncoding]);
2018-11-28 16:06:31.803868+0100 [41860:9341804] MASTER (null)