Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I safe store db password on Android Application?

I have an encrypted db with the "sqlcipher library", but now I don't know where I can store the db passwrod in the correct way, inside the app. I think that SharedPreferences, in PRIVATE_MODE, is a good place to store it; but I'm not sure. Any suggestion? Thanks.

like image 457
Paolo Avatar asked Aug 09 '13 15:08

Paolo


2 Answers

Even if you were to hide the password within the app itself, it can still be decompiled and found out. There is no where safe on a device with root. Your best bet would to have the db on a web-server and have the data retrieved from the server. That is the only way to keep a database safe from users (if the server is setup and secure).

like image 155
ObieMD5 Avatar answered Nov 15 '22 05:11

ObieMD5


I don't know where I can store the db passwrod in the correct way

The "correct way" is for the password to be inside the user's head, as the only reason to use SQLCipher for Android is to allow the user to defend the user's data.

You appear to be attempting to use SQLCipher for Android as a DRM mechanism, which will not work. There is no place for you to store a password "inside the app" that users cannot get to, given sufficient interest in doing so.

like image 25
CommonsWare Avatar answered Nov 15 '22 05:11

CommonsWare