File is not a database:

hi i am using last version of Community sqlcipher for android . i made a sqlite db and I encrypted it with DB browser . but when i use sqlcipher @aar file or dependencies i got this error : file is not a database: , while compiling: select count(*) from sqlite_master;
plz help me
sorry for bad english

Hi @naser_jafari

Did you previously use another major version of SQLCipher? SQLCipher 4.0.0 introduces many new performance and security enhancements for applications that use SQLCipher for secure local data storage. However, the introduction of new default algorithms, increased KDF iterations and a larger page size means that SQLCipher 4 will not open older databases by default.

Please take a look at the documentation for upgrading to SQLCipher 4 here.

Thank you for your answer .ye i used Community vesion 3.5.9 . i am new android developer and can you give me example how use Community SQLCipher 4.0.0 in local android app ?
i used this document
for new SQLCipher but i give same error

Hi @naser_jafari

The integration instructions for Android are here, which you already linked to. You will need to upgrade your database, or set the compatibility settings as described here. An example of upgrading a database from a different major version can be found in our Android test suite here.

I think I found the problem.i made my db in sqlite format with firefox addon sqlite manager and now this db dos not work with SQLCipher.
and iam begeinner developer and ican not understand this document this
plz tell me simple way to convert my old sqlite to new compatible sqlite with SQLCipher 4.0.1

Hello @naser_jafari - please review this document it explains exactly how to convert from a SQLite to SQLCipher.

I repeatedly read this
i iam just android developer .
I did not understand where and where to run these commands
plz plz plz
tell me How do I run these code?
With what software?
And make it clear to me, and I only know Java and Android as a beginner

Hello @naser_jafari

Those special SQL commands can be executed directly from the SQLCipher for Android library. To give you an example of how you can migrate a database, take a look at this example from the SQLCipher for Android test suite. You can integrate those steps into your application.

@naser_jafari As an idea, since you’re starting out with SQLite and still learning, a good place for asking questions is the SQLite users mailing list:

The people there don’t do SQLCipher stuff (generally), but they’re very good with SQLite.

Another useful place for SQLite questions is the Database Administrator Stack Exchange:

Lots of helpful people there too, and plenty of new users learning stuff as well. :slight_smile:

Hello again . my sqlite db is local and before use is 5Mb .
I want to encrypt it before using it and then open it in the my app
How can I encrypt it before using it in my app

Hello @naser_jafari

We have put together some guidance on migrating from a plaintext SQLite database to a SQLCipher encrypted database. Please review this post for more information:

1 Like