Go to file
2021-08-05 11:31:21 -05:00
gradle/wrapper Add upstream Android Bindings snapshot (d49b327e8f) 2021-07-14 08:49:37 -05:00
sqlcipher Add cipher_compatibility test case 2021-08-05 11:31:21 -05:00
sqlciphertest Change tests to load libsqlcipher instead of libsqliteX 2021-07-20 14:16:56 -05:00
www Change tests to load libsqlcipher instead of libsqliteX 2021-07-20 14:16:56 -05:00
.gitignore Update ignore file for amalgamation and lib references 2021-07-15 15:15:56 -05:00
build.gradle Add upstream Android Bindings snapshot (d49b327e8f) 2021-07-14 08:49:37 -05:00
gradle.properties Add upstream Android Bindings snapshot (d49b327e8f) 2021-07-14 08:49:37 -05:00
gradlew Add upstream Android Bindings snapshot (d49b327e8f) 2021-07-14 08:49:37 -05:00
gradlew.bat Add upstream Android Bindings snapshot (d49b327e8f) 2021-07-14 08:49:37 -05:00
local.properties Initial package rename 2021-07-14 10:11:56 -05:00
README.md Initial README 2021-07-23 13:44:19 -05:00
settings.gradle Exclude :sqlciphertest to build standalone aar package 2021-07-14 11:15:33 -05:00

SQLCipher for Android

SQLCipher for Android provides a library replacement for android.database.sqlite on the Android platform for use on SQLCipher databases. This library is based on the upstream Android Bindings project and aims to be a long-term replacement for the original SQLCipher for Android library.

Compatibility

SQLCipher for Android supports Android API 16 and up on armeabi-v7a, x86, x86_64, and arm64_v8a architectures.

Contributions

We welcome contributions, to contribute to SQLCipher for Android, a contributor agreement needs to be submitted. All submissions should be based on the master branch.

Application Integration

import net.zetetic.database.sqlcipher.SQLiteDatabase;

System.loadLibrary("sqlcipher");
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, password, null, null, null);

Pre/Post Key Operations

To perform operations on the database instance immediately before or after the keying operation is performed, provide a SQLiteDatabaseHook instance when creating your database connection:

SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
      public void preKey(SQLiteConnection connection) { }
      public void postKey(SQLiteConnection connection) { }
    };

Building

This repository is not batteries-included. Specificially, you will need to build libcrypto.so, the shared library from OpenSSL using the NDK for the supported platforms, and bundle the top-level include folder from OpenSSL. Additionally, you will need to build a SQLCipher amalgamation. These files will need to be placed in the following locations:

<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/armeabi-v7a/libcrypto.so
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/x86/libcrypto.so
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/x86_64/libcrypto.so
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/arm64_v8a/libcrypto.so
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/include/
<project-root>/sqlcipher/src/main/jni/sqlcipher/sqlite3.c
<project-root>/sqlcipher/src/main/jni/sqlcipher/sqlite3.h

To build the AAR package, either build directly within Android Studio, or from the command line:

./gradlew assembleRelease