sqlite-jdbc-crypt
sqlite-jdbc-crypt copied to clipboard
Doesn't open SQLCİpherV4 db files
DB files encrypted with SqlCipher V3 can be opened successfully. However, V4 encrpyted files can not be opened. The following error is produced: File opened that is not a database file (file is not a database)
SQLiteMCSqlCipherConfig.getV3Defaults().withKey(Constants.DB_CIPHER).createConnection(url) opens V3 db files. SQLiteMCSqlCipherConfig.getV4Defaults().withKey(Constants.DB_CIPHER).createConnection(url) doesn't open V4 db files.
DB files are created with SQLite DB Browser compiled with SqlCipher support.
Which version did you use? In march a bug was fixed regarding V4 defaults. Maybe you used an older version?
I used both the latest version in maven, which 3.35.5.3 and latest release in github, which 3.36.0.
I'll be assuming version is 3.36.0 or 3.35.5.3
Last year, I reported an issue to the maintainer of SQLiteMc for something related to sqli cipher v4. We discovered that the configuration was not applied correctly and that the legacy parameters was important and must be the first. I looked into ou code and it seams that we might have the wrong order of parameters. But as it should all be defaults this shouldn't have any effect...
For testing purposes, you can try to open the database using parameters in the URL: file://mydbfile.db?cipher=sqlcipher&legacy=4&key=myKey
Unfortunately, it doesn't work. Further, I tried with all versions down to v3.33.0. Only v3.33.0 opened the db. Even v3.33.0.1 didn't open. Hwoever, problem with v3.33.0 is that it is not possible to attach another unencrypted db file with the following sql command: <<ATTACH DATABASE user.db AS user KEY ''>>
This sql command works with SQLCipher Android driver provided the developer company. So I assumed the same would work. Is this a bug or is sql command to attach unencrypted dbs wrong?