SQLcipher Guide
Contents
SQLCipher is based on SQLite, and thus, the majority of the accessible API is identical to the C/C++ interface for SQLite 3. However, SQLCipher does add a number of security specific extensions in the form of PRAGMAs, SQL Functions and C Functions.
1. Build SQLcipher from source
- $ git clone https://github.com/sqlcipher/sqlcipher.git
- $ cd sqlcipher
- $ ./configure –enable-tempstore=yes CFLAGS="-DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2" LDFLAGS="-lcrypto"
- $ make
- $ make install #if you want to do a system wide install of SQLCipher
Mark the output of make install, especially the following lines:
- libtool: install: /usr/bin/install -c .libs/libsqlcipher.a /usr/local/lib/libsqlcipher.a
- /usr/bin/install -c -m 0644 sqlite3.h /usr/local/include/sqlcipher
these are the folders of SQLcipher headers and the library necessary when building proper C project.
2. Building minimal C project example
In SQLite_example.c put the following lines:
|
|
Build you example:
|
|
e.g. with paths extracted from the output of $make install
|
|
Finally, make sure that your SQLCipher library is in the system wide library path e.g. for (Arch)Linux:
|
|
Run your test code ((Arch)Linux):
|
|