Note: I orignally posted this over on Crypto Stack Exchange, but was pointed here instead
I'm working on a project which requires encryption of sensitive data, with communication of said data between a mobile app and a website (via an API).
I'm new to encryption and security, but my current thoughts are this:
- Data will always be input into the app and viewed via the website, so only users of the website will need a public and private key as only they need to view the information (could use hybrid, but messages will be short)
- Encrypt the data server-side using the public key of the correct user authorised to view the information
- The encrypted data will be stored in the database
- Keys will be stored on the server (not sure how this works in terms of access controls)
It is important that other users of the website are only able to see the data they are authorised to view, hence the public and private key cryptography. Obviously, querying the database here could prove difficult, but I think the use of IDs and other non-identifiable information would make it easier.
Is this a realistic idea or completely wrong in terms of how encryption works? I'm a complete beginner here, so don't know much about key management etc.