Android Database (SQLite) encryption scheme

Source: Internet
Author: User

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:

[Plain] View Plain Copy Print ?

    • $. build/envsetup.sh



This allows you to initialize the environment  
4, go to this source directory, run: [plain] view plain copy print ?

    • $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

Android Database (SQLite) encryption scheme

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.