Reputation: 54023
I'm building an Android app which contains an SQLite db with very sensitive data. Since anyone with physical access to the device could copy the database I thought of a couple solutions to safeguard the data in the database. We can of course encrypt it before entering it into the DB, but since this would inhibit the possibility to actually query the database, it would effectively make the DB useless. Plus: if we store the key within the app, it would make it very easy to retrieve the key as well, and with that the encryption would be pointless.
So we sync all the data with the server upon login, and after that there are a couple options:
Does anybody know if any of these ideas make sense, and more importantly, if there isn't a better/more convenient way of saving data securely across the apps activities? All tips are welcome!
Upvotes: 1
Views: 173
Reputation: 1007659
This means that you cannot share it amongst Activities.
Sure you can. Use a singleton SQLiteDatabase
. You should be doing this anyway, to enable thread-safe access across multiple threads.
Store the synced data in a couple Java Lists/Arrays and getting all the information from them. The problem is that these lists only exist in one Activity.
Once again, you can use a singleton or static data member, if you are careful about memory leaks.
However, if using "a couple Java Lists/Arrays" is an option, I have no idea why you are messing around with SQLite. SQLite is designed to store relational data in files, and it sounds like you do not want any files.
Upvotes: 1