Skip to content

Commit 2de69e1

Browse files
Initial README
1 parent 94d0a0d commit 2de69e1

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# SQLCipher for Android
2+
3+
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.
4+
5+
### Compatibility
6+
7+
SQLCipher for Android supports Android API 16 and up on `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures.
8+
9+
### Contributions
10+
11+
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.
12+
13+
14+
### Application Integration
15+
16+
17+
```
18+
import net.zetetic.database.sqlcipher.SQLiteDatabase;
19+
20+
System.loadLibrary("sqlcipher");
21+
SQLiteDatabase database = SQLiteDatabase.openOrCreateDatabase(databaseFile, password, null, null, null);
22+
```
23+
24+
### Pre/Post Key Operations
25+
26+
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:
27+
28+
```
29+
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
30+
public void preKey(SQLiteConnection connection) { }
31+
public void postKey(SQLiteConnection connection) { }
32+
};
33+
```
34+
35+
### Building
36+
37+
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:
38+
39+
```
40+
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/armeabi-v7a/libcrypto.so
41+
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/x86/libcrypto.so
42+
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/x86_64/libcrypto.so
43+
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/arm64_v8a/libcrypto.so
44+
<project-root>/sqlcipher/src/main/jni/sqlcipher/android-libs/include/
45+
<project-root>/sqlcipher/src/main/jni/sqlcipher/sqlite3.c
46+
<project-root>/sqlcipher/src/main/jni/sqlcipher/sqlite3.h
47+
```
48+
49+
To build the AAR package, either build directly within Android Studio, or from the command line:
50+
51+
```
52+
./gradlew assembleRelease
53+
```
54+

0 commit comments

Comments
 (0)