0

I have a DB existing that I copy on the device, and I can access with no problem. The problem, is that I must put a password to it (SQLCipher, I used "DB Browser for SQLite" to put that password), but now I want to access it by passing the password programmatically. Here is my code:

  public class DatabaseAccess {
        private SQLiteOpenHelper openHelper;
        private SQLiteDatabase database;
        private static DatabaseAccess instance;

        private DatabaseAccess(Context context, String db_name) {
            this.openHelper = new DBHelper(context, db_name);
        }


        public static DatabaseAccess getInstance(Context context, String db_name) {
                instance = new DatabaseAccess(context, db_name);
            return instance;
        }

Thanks in advance.

21
  • 1
    "On Android (may be it is not correct), it seems that every body that install Android File transfer for example can access to the all files of the app ?" -- if you are referring to your APK, and your database copy packaged as an asset, yes, anyone can get to that. They can also get to the encryption passphrase to be able to decrypt it. They cannot get to the copy of that asset that you make on internal storage, without rooting their device. If the asset itself has "secured informations", do not package it as an asset. Commented Aug 1, 2019 at 15:36
  • 1
    "Or anyone can check the "code" with the password in it ?" -- if the password is in your app, people can get to the password. Commented Aug 1, 2019 at 16:54
  • 1
    The source code will not be on the user's device when they install your app. The APK will, and the APK will have your password. Commented Aug 2, 2019 at 12:46
  • 1
    By looking at it. Research "decompile" with respect to Android development. Commented Aug 2, 2019 at 13:10
  • 1
    Yes, that question and answer are discussing decompiling an Android app. There is quite a bit of material on this subject online, though mostly not in Stack Overflow. Commented Aug 2, 2019 at 13:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.