Skip to content

Project Update #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Oct 29, 2011
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8fe294e
Adding the .DS_Store file to the ignore list
developernotes Aug 25, 2011
884119f
Adding libandroid_runtime.so and libbinder.so to ease linking
developernotes Aug 25, 2011
38679e8
Changing the SQLite build to allow extension loading
developernotes Aug 25, 2011
95c3059
Adding a build file for ant
developernotes Aug 30, 2011
5be3f35
Build configuration that includes a statically linked version of the …
developernotes Oct 4, 2011
41668d6
Adding updates for the icu project
developernotes Oct 4, 2011
bf9f016
Update gitmodule for the icu project
developernotes Oct 4, 2011
1e3039f
Initial merge of icu build project into the root external build file
developernotes Oct 6, 2011
2796385
Fix to allow cross process cursors to work with sqlcipher
developernotes Oct 21, 2011
ed7d5d2
Updating icu4c submodule back to correct commit and repository
developernotes Oct 25, 2011
608f142
Creating the directories for libcrypto and libssl for install
developernotes Oct 25, 2011
d4ee12b
Removing user specific files for build system
developernotes Oct 25, 2011
c9ad76d
Updating the README with build instructions and formatting
developernotes Oct 25, 2011
b234b5c
Revert "refactored code to use android/database/CursorWindow instead …
sjlombardo Oct 25, 2011
a486208
Revert "refactoed to code to use android/database/CursorWindow instea…
sjlombardo Oct 25, 2011
702b730
bring master inline with gp-cursor following reverts
sjlombardo Oct 25, 2011
878aaff
remove generated files from version control
sjlombardo Oct 25, 2011
79b1890
add bin/ and gen/ to ignore list
sjlombardo Oct 25, 2011
feade3a
Adding Makefile for building project and updating documentation
developernotes Oct 25, 2011
a6f071f
Adjustment to the build instructions
developernotes Oct 25, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,9 @@ TAGS
external/libs
jni/libs
obj/
.DS_Store
local.properties
build.xml
proguard.cfg
bin/
gen/
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

.DEFAULT_GOAL := all

init:
git submodule update --init
android update project -p .

all: build-external build-jni build-java

build-external:
cd external/ && \
make -f Android.mk build-local-hack && \
ndk-build && \
make -f Android.mk copy-libs-hack

build-jni:
cd jni/ && ndk-build

build-java:
ant compile && \
cd bin/classes && \
jar -cvf sqlcipher.jar .
79 changes: 45 additions & 34 deletions README → README.org
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@

Current SDK distro for developers, with the jar’s, .so’s and a quick sample can be found here:
https://github.com/guardianproject/android-database-sqlcipher/downloads
[[https://github.com/guardianproject/android-database-sqlcipher/downloads]]

A full demonstration app with the bundled SQLCipher R1 release is here:
https://github.com/guardianproject/notepadbot
[[https://github.com/guardianproject/notepadbot]]

SQLCipher for Android project source repo is here:
https://github.com/guardianproject/android-database-sqlcipher
[[https://github.com/guardianproject/android-database-sqlcipher]]

Update May 2011:
*** Update May 2011:

After some major breakthroughs during last week’s development sprint, we’re extremely excited to announce SQLCipher for Android, Developer Preview r1. SQLCipher is an SQLite extension that provides transparent 256-bit AES encryption of database files. To date, it has been open-sourced, sponsored and maintained by Zetetic LLC, and we are glad to be able to extend their efforts to a new mobile platform. In the mobile space, SQLCipher has enjoyed widespread use in Apple’s iOS, as well as Nokia / QT for quite some time. Given that Android by default provides integrated support for SQLite databases, our goal was to create an almost identical API for SQLCipher, so that developers of all skill level could use it, without a steep learning curve.

In an environment where mobile data privacy is increasingly in the headlines, this project will make it easier than ever for mobile developers to properly secure their local application data, and in turn better protect the privacy of their users. The data stored by Android apps protected by this type of encryption will be less vulnerable to access by malicious apps, protected in case of device loss or theft, and highly resistant to mobile data forensics tools that are increasingly used to mass copy a mobile device during routine traffic stops.

However, while the core SQLCipher database is vetted and market-ready, the Android support libraries in this release are still very much alpha quality, hence the Developer Preview label. This R1 release should not be integrated into critical or production software. Our goal is to give Android developers early access to the technology, so they can provide feedback on our approach, and help us deliver the right offering for securing mobile data. We expect to release a market-ready version this summer, and will be publicly iterating through the codebase until then.

An Illustrative Terminal Listing
*** An Illustrative Terminal Listing

A typical SQLite database in unencrypted, and visually parseable even as encoded text. The following example shows the difference between hexdumps of a standard SQLite db and one implementing SQLCipher.

~ sjlombardo$ hexdump -C sqlite.db
00000000 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 |SQLite format 3.|
000003c0 65 74 32 74 32 03 43 52 45 41 54 45 20 54 41 42 |et2t2.CREATE TAB|
000003d0 4c 45 20 74 32 28 61 2c 62 29 24 01 06 17 11 11 |LE t2(a,b)$…..|
000007e0 20 74 68 65 20 73 68 6f 77 15 01 03 01 2f 01 6f | the show…./.o|
000007f0 6e 65 20 66 6f 72 20 74 68 65 20 6d 6f 6e 65 79 |ne for the money|

~ $ sqlite3 sqlcipher.db
sqlite> PRAGMA KEY=’test123′;
sqlite> CREATE TABLE t1(a,b);
sqlite> INSERT INTO t1(a,b) VALUES (‘one for the money’, ‘two for the show’);
sqlite> .quit

~ $ hexdump -C sqlite.db
00000000 84 d1 36 18 eb b5 82 90 c4 70 0d ee 43 cb 61 87 |.?6.?..?p.?C?a.|
00000010 91 42 3c cd 55 24 ab c6 c4 1d c6 67 b4 e3 96 bb |.B?..?|
00000bf0 8e 99 ee 28 23 43 ab a4 97 cd 63 42 8a 8e 7c c6 |..?(#C??.?cB..|?|

~ $ sqlite3 sqlcipher.db
sqlite> SELECT * FROM t1;
Error: file is encrypted or is not a database
: ~ sjlombardo$ hexdump -C sqlite.db
: 00000000 53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 |SQLite format 3.|
:
: 000003c0 65 74 32 74 32 03 43 52 45 41 54 45 20 54 41 42 |et2t2.CREATE TAB|
: 000003d0 4c 45 20 74 32 28 61 2c 62 29 24 01 06 17 11 11 |LE t2(a,b)$…..|
:
: 000007e0 20 74 68 65 20 73 68 6f 77 15 01 03 01 2f 01 6f | the show…./.o|
: 000007f0 6e 65 20 66 6f 72 20 74 68 65 20 6d 6f 6e 65 79 |ne for the money|
:
: ~ $ sqlite3 sqlcipher.db
: sqlite> PRAGMA KEY=’test123′;
: sqlite> CREATE TABLE t1(a,b);
: sqlite> INSERT INTO t1(a,b) VALUES (‘one for the money’, ‘two for the show’);
: sqlite> .quit
:
: ~ $ hexdump -C sqlite.db
: 00000000 84 d1 36 18 eb b5 82 90 c4 70 0d ee 43 cb 61 87 |.?6.?..?p.?C?a.|
: 00000010 91 42 3c cd 55 24 ab c6 c4 1d c6 67 b4 e3 96 bb |.B?..?|
: 00000bf0 8e 99 ee 28 23 43 ab a4 97 cd 63 42 8a 8e 7c c6 |..?(#C??.?cB..|?|
:
: ~ $ sqlite3 sqlcipher.db
: sqlite> SELECT * FROM t1;
: Error: file is encrypted or is not a database

(example courtesy of SQLCipher)

Details for Developers
*** Details for Developers

We’ve packaged up a very simple SDK for any Android developer to add SQLCipher into their app with the following three steps:

Expand All @@ -57,23 +57,34 @@ SQLiteDatabase.loadLibs(this); //first init the db libraries with the context
SQLiteOpenHelper.getWritableDatabase(“thisismysecret”):
*Note: we are working on some dialog builder helper methods for password and PIN input, password caching, and other features that we would like to standardize across all applications that use SQLCipher.

Compatibility
*** Compatibility

The Developer Preview implements SQLCipher v1, is compatible with Android 2.2 & 2.3, and works only within one process (you can’t pass a Cursor from a remote Service to an Activity).

Notepad + SQLCipher = Notepadbot

Notepadbot is a sample application pulled from the standard Android samples code and updated to use SQLCipher. You can browse the source here and download the apk here.

*** Building

Final Notes
In order to build android-database-sqlcipher from source you will need both the Android SDK as well as Android NDK. Once you have cloned the repo, change directory into the root of the repository and run the following commands:

: # this only needs to be done once
: make init

: # to build the source
: make

Copy =libsqlcipher_android.so= in =external/libs/armeabi= and =libdatabase_sqlcipher.so= in =jni/libs/armeabi= to your application =libs/armeabi= folder. Copy the =sqlcipher.jar= file in =bin/classes= to your =libs= directory. Copy the =icudt44l.zip= file in the =assets= directory to your =assets= directory. Finally, you will need to copy =commons-codec.jar= and =guava-r09.jar= located in the =libs= directory into your application =libs= directory.

*** Final Notes

It’s important to note that this project is not intended to be a distinct, long-term fork of SQLCipher. We’ve been working closely with the SQLCipher team at Zetetic and fully intent to closely maintain the project as SQLCipher evolves, re-integrating changes in upcoming releases such as SQLCipher v2.

The Android support libraries are licensed under Apache 2.0, in line with the Android OS code on which they are based. The SQLCipher code itself is licensed under a BSD-style license from Zetetic LLC. Finally, the original SQLite code itself is in the public domain.

Downloads and Source
*** Downloads and Source

SQLCipher for Android project source repo is here: https://github.com/guardianproject/android-database-sqlcipher
Current SDK distro for developers, with the jar’s, .so’s and a quick sample can be found here: https://github.com/guardianproject/android-database-sqlcipher/downloads
SQLCipher for Android project source repo is here: [[https://github.com/guardianproject/android-database-sqlcipher]]
Current SDK distro for developers, with the jar’s, .so’s and a quick sample can be found here: [[https://github.com/guardianproject/android-database-sqlcipher/downloads]]

Loading