Original address: http://blog.csdn.net/feifei454498130/article/details/8843402
Recently, because of the security needs of some projects to encrypt the database, the first thing to think about is to encrypt the database through AES, then run the decryption, the other is to encrypt the contents of the database.
Soon both of these scenarios are not ideal, the first encryption method is a dummy, the second, if the encrypted field is to find the data becomes troublesome.
So the third solution is to decrypt in memory, on-line to find SQLite is to support encryption, so according to the guidance of the Web-based to compile the SQLite to support encryption.
So the next step is how to make the SDK easy to use? The first idea was to transplant the native database usage, but it was harder to do than you might have imagined, but eventually the transplant was done in tinkering. The first is the use of Android2.2 database module source code, but the runtime will often have some problems, and then use the ANDROID4.0 database module source code to solve these problems, of course, at the beginning of the Android4.0 source code compile, in the Android4.0 above the mobile phone operation is no problem, but in a ndroid4.0 The following will be an error. So force not proud of the ANDROID4.0 database module to the Android2.2 source directory compiled, of course, to solve the version of the use of some problems.
Android native does not support database encryption, so it is necessary to use other methods to encrypt the database. And this SDK is from the native Android4.0 source code to separate the SQLite module, and this module is added to the encryption method, because the SQLite source code is encrypted interface, so the porting only need to add this precompiled parameters and some files.
This SDK only supports versions above Android2.1.
Compilation Environment:
Android2.2 Source
Ubuntu12.10 64-bit
1, synchronous Android2.2 Source (about 4G capacity)
2. Install the necessary dependent libraries
3. Run in Android2.2 source directory:
$. build/envsetup.sh
This allows you to initialize the environment
4, go to this source directory, run:
$mm
This will compile and generate the results in out\target\product\generic\system\lib\libsqlcrypt_jni.so
Originally also want to generate x86 library, because there are some problems, there is no time to solve.
Source: Https://github.com/lendylongli/android-sqlite-encrypt
"Go" Android SQLite encryption