Hey,
Thanks for your reply, it is amazing to know that you’re working on that JDBC Driver. And I might even consider paying for one of your projects, I just need to get into production phase though.
I managed to compile your Windows version of SQLCipher for testing and I am having problems.
I am creating a SQLite Database using Java and as soon as I hit it with these commands:
R:\client\sqlite_database>sqlcipher plain.db
SQLCipher version 3.8.6 2014-08-15 11:46:33
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> ATTACH DATABASE 'test.db' AS test KEY 'akey';
sqlite> SELECT sqlcipher_export('test');
sqlite> DETACH DATABASE test;
And afterwards issue this:
R:\client\sqlite_database>sqlcipher test.db
SQLCipher version 3.8.6 2014-08-15 11:46:33
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key = 'akey';
sqlite> select * from pa;
1|Andorra|AD|AND|20
2|Emiratos Árabes Unidos|AE|ARE|784
3|Afeganistão|AF|AFG|4
I am having encoding problems…
This is the dependency I’m using to generate the database:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.7.2</version>
</dependency>
EDIT: I’ve tried using the generated encrypted database from sqlcipher_export() from the procedure above and sent it to my Android app, using the same password. This is the result:
net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
EDIT 2: Seems that I get the same output from a simple “SELECT * FROM pa;” on the generated sqlite database from Java. I’ve updated the dependency to 3.8.6 and re-generated the database to match the SQLCipher SQLite version (3.8.6) but no go…
R:\client\sqlite_database>sqlcipher plain.db
SQLCipher version 3.8.6 2014-08-15 11:46:33
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> SELECT * FROM pa;
1|Andorra|AD|AND|20
2|Emiratos Árabes Unidos|AE|ARE|784
3|Afeganistão|AF|AFG|4
LAST EDIT:
I am major dumb. Reasons:
- Windows cmd doesnt output UTF-8, only ASCII (forgot my first days of Computer Science… ), that’s why the output is weirdo.
- Android and Java SQLite + SQLCipher DOES match, I got it working. The reason it was not working before was that I was moving the database inside my app’s /database folder and user/group was root, the app cannot read files outside its user/group.
Admin can mark this thread as RESOLVED.
Note: Maybe, the dev could say net.sqlcipher.database.SQLiteException: file is encrypted or is not a database (have you also check your file user/group/permissions?)
Thank you all!