As I understand it, modern mobile OS's often encrypt app data when a device is locked with a pin or password. However, how do I protect users if their device or pin has been compromised?

If I manually encrypt certain pieces of my app data, where do I store the key to decrypt it in the event a hacker or unauthorized user gets hold of the physical device or pin/password?

| improve this question | | | | |
  • Preferably in a place „somewhere else“, best „in your mind“. However key/password storage is a compromise between the optimum and real life restrictions, like the human mind usually not being able to memorize highly random passwords. Therefore, „best place“ depends on your requirements and restrictions which you might want to elaborate on. – not2savvy Jun 20 '19 at 9:47

How do I protect users if their device or pin has been compromised?

The best way is to avoid storing data on the device in the first place. This however means that the app won't be able to work offline, needs to re-download data each time and might have performance impact.

In the end it depends on the risk you want to accept and the user experience you want to give to your users. One possible solution is to require the user to setup a separate pin/password in the app which is used to derive an encryption key. Keep in mind however that in case of a physical compromise of the device, the data is vulnerable to offline brute force attacks. The security of this data depends thus on:

  • A strong password policy
  • A solid encryption scheme

Basically once the data is out there, it's only a matter of time.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.