SQLCipher provides a special, modified version of SQLite to store data in encrypted form using the Native Development Kit (NDK) on the Android platform. How to rebuild SQLCipher for Android was covered in a recent posting. Unfortunately, SQLCipher for Android is based on an old version of the Android database API and is missing a couple important enhancements:
- get the data type of each row & column in the results for a SQL query, using Cursor.getType()
- number of rows affected by a SQL UPDATE or DELETE statement, using SQLiteStatement.executeUpdateDelete()
These enhancements are especially important for the Cordova/PhoneGap sqlite plugin for Android, in order to properly follow the requirements of the Web SQL API.
The enhancements were obtained from the Android SDK 11 (Honeycomb) version. Only some changes to the cursor classes, database utilities, and SQLiteStatement classes were necessary to get these enhancements working with SQLCipher.
Also the brodyspark / sqlcipher-android-tests fork was made to test these changes.
To compile and test these changes please see my previous posting but with the following changes:
- For the API: $ git clone git://github.com/brodyspark/sqlcipher-android-database.git
- Test project: $ git clone git://github.com/brodyspark/sqlcipher-android-tests.git
- The Makefile is already adapted to work with OSX Homebrew.
UPDATES January 2013: