Willena / sqlite-jdbc-crypt

SQLite JDBC Driver with encryption support
Apache License 2.0
172 stars 33 forks source link

unable to open the database using sqlcipher #11

Closed kamaaina closed 5 years ago

kamaaina commented 5 years ago

created an encrypted database

...

        try (final Connection connection = DriverManager.getConnection("jdbc:sqlite:db.sqlite", "", "apassword")) {
            try (final Statement stmt = connection.createStatement()) {
                stmt.execute("CREATE TABLE test (data TEXT(10));");
                stmt.execute("INSERT INTO test VALUES('hello');");
            }
            connection.close();
        } catch (final SQLException e) {
            e.printStackTrace();
        }

...

then tried to open the database from the command line using sqlcipher

SQLCipher version 3.15.2 2016-11-28 19:13:37
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> PRAGMA key='apassword';
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
/**** ERROR: (26) file is encrypted or is not a database *****/
ROLLBACK; -- due to errors
sqlite>
kamaaina commented 5 years ago

nevermind, i see this will never work as sqlcipher uses SSL's libcrypto library and sqlite-jdbc-crypt is a custom implementation. sorry for the troubles....