I want to encrypt an NSString
so I referred to AES Encription for NSString.
That code served well, and I can use it.
But if someone can get hold of the encryption key, it's easy to decode my NSString
.
I executed strings -a
command in Terminal on the generated executable, and I was able to see that encryption key.
So, we protected the data before it's sent, but the encryption key is still exposed. How can I protect this encryption key?
EDIT: I have multiple processes running on system. Sometimes they communicate with NSDistributedNotificationCenter by posting notifications. Sometimes that notification act as command. My worry is anybody can post notifications and try to fool my process. So I decided to use postNotificationName:object:userInfo:deliverImmediately:
. In this API I can send encrypted data (command) and only my executables know encryption key.