Encrypt database file

by DanielSchH » Tue, 26 Apr 2011 20:41:27 GMT

Sponsored Links

Im looking for a way to secure a SQLite database in Android. I have
read some stuff about sqlcipher but it seems to be quite complicated
to integrate the lib into a Android project and to write a java

So my idea is to create an normal SQLite database and encrypt the
file. Has anybody tried it already or is it not possible.

Thanks a lot,


Re: Encrypt database file

by lbendlin » Tue, 26 Apr 2011 23:52:42 GMT

  http://sqlite-crypt.com/ - but yes , you'll have the same task to incorporate 
the c code into your Java project. Well, tough.


Sponsored Links

Re: Encrypt database file

by DanH » Wed, 27 Apr 2011 09:53:37 GMT

 You can always encrypt/decrypt the DB file each time you end/start the
application.  But if the app dies suddenly the file is left

 You could compile your own version of SqlCipher (I've done it twice
for other platforms -- not exactly rocket science, but it is jet
engine science).  You are faced with the problem of finding a suitable
crypto implementation (ideally OpenSSL).  Easy to just download and
compile a separate copy for yourself if this is for personal use, but
you're apt to run afoul of import/export rules if you try to sell your
app (especially if you ship it from the US).  If you could access the
in-built encryption support that would be ideal (avoids the import/
export problem), but I'm not sure there's a way to get at it.

You can encrypt/decrypt individual rows in the DB as you read/write.
This is inefficient and awkward -- you basically have to put all the
data into one long string, and any search keys must be left in clear
text.  It's also relatively easy to crack.

For small amounts of data it's probably better to put the data into
XML or JSON and read/write the entire file, decrypting/encrypting as
you do the file I/O.


Re: Encrypt database file

by Zsolt Vasvari » Wed, 27 Apr 2011 10:19:34 GMT

 I would just encrypt the really sensitive fields, if anything.  In
most apps, only a very small percentage of the data is really
sensitive.  But, by doing encryption in the application level, you are
going to lose some nice features such as being able to sort or search
on your data.


Other Threads

1. Hide file

Hi para suhu, mau tanya app buat hide file kita ada ngak ya di android..?
biar file2 rahasia ngak keliatan seperti document, pics and video...


2. Multitouch Problem di HD2


Setelah flash pakai magdlr untuk jadi android asli kok,multitouchnya sering
bermasalah ya?
berawal dari iseng pake wp7, terus ke semua build android juga multitouchnya
Gw kira di wp7,bermasalah karena driver multitouchnya bermasalah, ternyata
gak juga :(

ada yg bisa bantu?



3. Paging Mbakyu Ncis ..

4. (WTA) ROM Dell Streak

5. keluar dari vi (text editor)

6. ant build error while importing third-party library

7. "no such table..." message error in my android applications