You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+38-9Lines changed: 38 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,6 @@
2
2
3
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](https://www.sqlite.org/android/doc/trunk/www/index.wiki) project and aims to be a long-term replacement for the original [SQLCipher for Android](https://github.com/sqlcipher/android-database-sqlcipher) library.
4
4
5
-
***N.B.*** This library is currently distributed in source-only format at this time, and requires [other external dependencies](#external-dependencies) to build. Community edition AAR artifacts will be distributed eventually.
6
-
7
5
### Compatibility
8
6
9
7
SQLCipher for Android supports Android API 21 and up on `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures.
@@ -17,19 +15,19 @@ We welcome contributions, to contribute to SQLCipher for Android, a [contributor
17
15
18
16
Add a local reference to the local library and dependency:
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:
There are two main options for using SQLCipher for Android within an Application:
51
+
52
+
1.[Using the SQLCipher for Android classes](#sqlcipher-for-android-classes)
53
+
2.[Using SQLCipher for Android in conjunction with the Android Room API](#sqlcipher-for-android-room-integration)
54
+
55
+
In both cases, prior to using any portion of the SQLCipher for Android library, the native SQLCipher core library must be loaded into the running application process. The SQLCipher core library is bundled within the AAR of SQLCipher for Android, however, the developer must load this library explicitly. An example below:
56
+
57
+
```java
58
+
System.loadLibrary("sqlcipher");
59
+
```
60
+
61
+
#### SQLCipher for Android classes
62
+
63
+
SQLCipher for Android provides two classes for opening and access database files. The `SQLiteDatabase` provides static methods for opening/creating database files and general data access.
64
+
Additionally, applications may choose to subclass the `SQLiteOpenHelper` class which provides mechanisms for performing database migrations, as well as general data access.
65
+
66
+
#### SQLCipher for Android Room Integration
67
+
68
+
SQLCipher for Android may also integrate with the Room API via the `SupportOpenHelperFactory`, an example is given below:
This repository is not batteries-included. Specifically, you will need to build `libcrypto.a`, the static 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:
Copy file name to clipboardExpand all lines: README.md.template
+38-9Lines changed: 38 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,6 @@
2
2
3
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](https://www.sqlite.org/android/doc/trunk/www/index.wiki) project and aims to be a long-term replacement for the original [SQLCipher for Android](https://github.com/sqlcipher/android-database-sqlcipher) library.
4
4
5
-
***N.B.*** This library is currently distributed in source-only format at this time, and requires [other external dependencies](#external-dependencies) to build. Community edition AAR artifacts will be distributed eventually.
6
-
7
5
### Compatibility
8
6
9
7
SQLCipher for Android supports Android API <%=minSdkVersion%> and up on `armeabi-v7a`, `x86`, `x86_64`, and `arm64_v8a` architectures.
@@ -17,19 +15,19 @@ We welcome contributions, to contribute to SQLCipher for Android, a [contributor
17
15
18
16
Add a local reference to the local library and dependency:
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:
42
40
43
-
```
41
+
```java
44
42
SQLiteDatabaseHook hook = new SQLiteDatabaseHook() {
45
43
public void preKey(SQLiteConnection connection) { }
46
44
public void postKey(SQLiteConnection connection) { }
47
45
};
48
46
```
49
47
48
+
### API Usage
49
+
50
+
There are two main options for using SQLCipher for Android within an Application:
51
+
52
+
1. [Using the SQLCipher for Android classes](#sqlcipher-for-android-classes)
53
+
2. [Using SQLCipher for Android in conjunction with the Android Room API](#sqlcipher-for-android-room-integration)
54
+
55
+
In both cases, prior to using any portion of the SQLCipher for Android library, the native SQLCipher core library must be loaded into the running application process. The SQLCipher core library is bundled within the AAR of SQLCipher for Android, however, the developer must load this library explicitly. An example below:
56
+
57
+
```java
58
+
System.loadLibrary("sqlcipher");
59
+
```
60
+
61
+
#### SQLCipher for Android classes
62
+
63
+
SQLCipher for Android provides two classes for opening and access database files. The `SQLiteDatabase` provides static methods for opening/creating database files and general data access.
64
+
Additionally, applications may choose to subclass the `SQLiteOpenHelper` class which provides mechanisms for performing database migrations, as well as general data access.
65
+
66
+
#### SQLCipher for Android Room Integration
67
+
68
+
SQLCipher for Android may also integrate with the Room API via the `SupportOpenHelperFactory`, an example is given below:
This repository is not batteries-included. Specifically, you will need to build `libcrypto.a`, the static 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:
0 commit comments