3

I'm trying to read an encrypted database created with sqlcipher on my PC but I can't read it on my app. For example:

Cursor c = database.rawQuery("SELECT name FROM sqlite_master WHERE type='table'", null);
    c.moveToFirst();
    do {
        String s = c.getString(0);
        if (s.equals("android_metadata")) {
            // System.out.println("Get Metadata");
            continue;
        } else {
            dirArray.add(s);
        }
    } while (c.moveToNext());
    Log.i("getS", "DATABASE = " + dirArray.toString());
    Log.i("getS", "length = " + dirArray.size());

result on the following

03-12 03:28:12.691: I/getS(9895): DATABASE = []
03-12 03:28:12.691: I/getS(9895): length = 0

also this:

Cursor c2 = database.query("my_table", new String[] { "name" }, null, null, null, null, "name");

return in to this:

03-12 03:28:12.701: I/Database(9895): sqlite returned: error code = 1, msg = no such table: my_table

I'm compiling with sdk-7, if I try the same database unencrypted and without the sqlcipher, I don't have any problems. Could anyone teach me how do I read on android a database encrypted on my computer? Appreciate ;)

2
  • I ran into a similar issue and received a solution: stackoverflow.com/questions/9742686/… Commented Mar 20, 2012 at 13:49
  • @djx- were you able to solve the problem ?? i would really apprecaite any help ! thanks Commented Nov 18, 2012 at 19:37

1 Answer 1

1

You will want to use the SQLCipher for Android library which will allow you to access and modify a sqlcipher database on an Android device. We currently support Android 2.1 - 4.0.3. Binary downloads can be found here:

https://github.com/sqlcipher/android-database-sqlcipher/downloads

A tutorial on itegrating SQLCipher for Android can be found here:

http://sqlcipher.net/sqlcipher-for-android/

Sign up to request clarification or add additional context in comments.

5 Comments

I already add the libraries like it's on tutorial, but still doesn't work.
Also, that tutorial doesn't teach how to read a database created from PC
@djx- were you able to solve the problem ?? i would really apprecaite any help ! thanks
@nia - Sorry but no, since then I was waiting if anyone had any example or something like that. If you get any progress please tell me.
@aanm I'm facing it now too... Did you solve the probem? I'm stuck and unable to get any help...

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.