Failed to setLocale() when constructing, closing the database net.sqlcipher.database.SQLiteException: file is encrypted or is not a database


#1

I have a server that sends me a database with 1.x database. I am able to decrypt using 1.x SQLCipher. I would like to use the latest version of SQLCipher. Please let me know how can I decrypt a database which is created using 1.x SQLCipher. Any help will be grealty appreciated.


#2

Hello @sjanardhanan - there are two options here:

  1. use PRAGMA cipher_migrate to upgrade the database from 1.x to 3.x in place; org
  2. use PRAGMA cipher_use_hmac = OFF in conjunction with PRAGMA kdf_iter = 4000 to open the database using the original SQLCipher 1.x security settings

#3

I am new in using SQLCipher. Could you be able to provide me statements in SQLitedatbaseHook so that I can understand. Your help is greatly appreciated.


#4

Hello @sjanardhanan - here is a concise example from the SQLCipher for Android test application:


#5

Thanks a lot. I found the same example and it worked… thanks a ton


#6

One more small question. Will there be slowness due to migration? Does this migration happen everytime or only oncce?


#7

Hello @sjanardhanan - yes, there is a definite performance impact from the migration. it would be best to track whether the database has been upgraded separately, i.e. in an application preference or something, so that you can selectively run the migration only when necessary.


#8

HI,

I have another database that needs to be migrated and attached to main database ( both are encrypted). Please let me know if there is a solution for the same


#9

Hello @sjanardhanan

You will want to apply the same approach for migrating your database using the PRAGMA cipher_migrate command.