I'm designing architecture for sending private messages (i.e. only sender and receiver are able to read a message).
Client side - iOS, server side - Parse.com
I'm thinking of using RSA to encrypt/decrypt messages as follows:
- iOS app generates a private/public key pair for each user.
- Private key is stored locally in iOS Keychain
- Public key is stored on the server.
- When a user initiates a new conversation, it fetches recipient's public key from the server, encrypts his message with it and sends it to the server.
- Recipient then fetches the message and decrypts it with his private key from his Keychain
My goal is that no one except the participants of the conversation is able to read the messages. Will this system ensure that?
On the side note, would you recommend any iOS libraries for RSA encryption/decryption?