From 2de69e164e92c47ba7b593f592084bb36a810fbb Mon Sep 17 00:00:00 2001 From: Nick Parker Date: Fri, 23 Jul 2021 13:44:19 -0500 Subject: [PATCH] Initial README --- README.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..0094bad --- /dev/null +++ b/README.md @@ -0,0 +1,54 @@ +# SQLCipher for Android + +SQLCipher for Android provides a library replacement for `android.database.sqlite` on the Android platform for use on [SQLCipher](https://github.com/sqlcipher/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](https://github.com/sqlcipher/android-database-sqlcipher) 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](https://www.zetetic.net/contributions/) 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](#compatibility), 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: + +``` +/sqlcipher/src/main/jni/sqlcipher/android-libs/armeabi-v7a/libcrypto.so +/sqlcipher/src/main/jni/sqlcipher/android-libs/x86/libcrypto.so +/sqlcipher/src/main/jni/sqlcipher/android-libs/x86_64/libcrypto.so +/sqlcipher/src/main/jni/sqlcipher/android-libs/arm64_v8a/libcrypto.so +/sqlcipher/src/main/jni/sqlcipher/android-libs/include/ +/sqlcipher/src/main/jni/sqlcipher/sqlite3.c +/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 +``` +