Slight problem enabling encryption in xerial/sqlite-jdbc

320 views
Skip to first unread message

kenneth johansen

unread,
Jul 4, 2018, 4:52:19 PM7/4/18
to Xerial
Hi all, ive got a slight problem enabling encryption in xerial/sqlite-jdbc

At this point ive compiled sqlicpher(3.20.1) and ive compiled  xerial/sqlite-jdb (3.22.0)
The resulting jar file: sqlite-jdbc-3.22.0-SNAPSHOT .jar has size 6714089

now then, i followed the instructions in Usage.md which states:
=============================================================
SQLite support encryption of the database via special drivers and a key. To use an encrypted database you need a driver which supports encrypted database via `pragma key` or `pragma hexkey`, e.g. SQLite SSE or SQLCipher. You need to specify those drivers via directly referencing the .dll/.so through:

```
-Dorg.sqlite.lib.path=.
-Dorg.sqlite.lib.name=sqlite_cryption_support.dll
```
==========================================================

The first problem here is that Make doesnt like variables with . (dot) in them and adding (i put the sqlcipher.dll file in the same directory as sqlite-jdbc for ease of usage):

-Dorg.sqlite.lib.path=. \
-Dorg.sqlite.lib.name=sqlcipher.dll \

to the 
 $(CC) -o $@ -c $(CCFLAGS) \
 command yields a lot of errors on the form:
=====================================
<command-line>:0:4: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:4: warning: ISO C99 requires whitespace after the macro name
<command-line>:0:0: warning: "org" redefined
<command-line>:0:0: note: this is the location of the previous definition
=====================================

before make does an exit 1.

okay,it failed, but  i can work with this. so i rename the variables to:
-Dorg_sqlite_lib_path=. \
-Dorg_sqlite_lib_name=sqlcipher.dll \
i.e i replace . with _
and i edit the file src/main/java/org/sqlite/SQLiteJDBCLoader.java to use org_sqlite_lib_path and org_sqlite_lib_name instead of org.sqlite.lib.path and org.sqlite.lib.name.
this change will make make (tm) finish withouth any errors, but the finished jar file has the same size as the first one i made  (6714089) wich leads me to conclude that
the make command was unable to include that sqlcipher.dll file. also, if i open the .jar file in intellij, i will find no trace of sqlcipher/encryption/decryption functions.

so... ive done something wrong, but at this stage im out of ideas. any and all help appriciated.

regards

Kenneth

kenneth johansen

unread,
Jul 8, 2018, 6:23:34 PM7/8/18
to Xerial
never mind. i figured it out. using https://github.com/Willena/sqlite-jdbc-crypt instead :)

kenneth
Reply all
Reply to author
Forward
0 new messages