Encrypt database file

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


Sponsored Links
 Hello,

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
wrapper.

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,
Daniel

-- 



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
unencrypted.

 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. Complex Object Collision Detection

Hello,

I am currently working on a collision detection routine for an Android
based game which is capable of handling complex concave curves in 2D.
I use complex in this post to describe any non-trivial, arbitrary
shape (beyond circles, squares, etc.).  My problem is that all of the
various methods I have come across are either too simplistic to be
realistic or too complex for a cell phone.  At the moment I am
favoring a tile-based scheme but I am having problems figuring out how
to do this with convex curves that span several tiles and may have
several line segments per tile.  I gave some thought to representing
the curves mathematically, with each tile being an interval of the
function, but there will likely be points where the curve doubles-back
on itself (think the big loop at the top of a pinball table that
brings the ball all the way around the table and back the direction it
came).  My questions boil down to:

1.  Does anyone know of a way of hit testing a given simple shape (eg.
a circle) against a concave series of line segments (shapes beyond
circles can be figured out from there) beyond just a Boolean result?

2.  What is the best way to represent large, complex shapes
programatically?  I am currently favoring an XML file describing my
levels and the objects in them with shape/position/physics/etc. data
to be parsed in during load time.

3.  Is there an altogether better way of doing this beyond line
segments?

The one saving grace in this conundrum is that I know the vast
majority of the objects are stationary with, at most, three or four
(usually one) dynamic objects moving around.  Thanks in advance for
any help.

-cheers

-- 

2. calling list (first time coder)

This is my first time dealing with code. I've read several books but
have no 1st hand experience. That being said, I'll keep my question to
a minimal.

How do I call a list? Yes I have done the list tutorial but its starts
off as extending the list activity so its not called so simply.  I
know this is pretty simple and all I really need is the first line.
I'll add my current code if needed.

Is it something like getList() .... ?

thanks for your help.

-- 

3. Is there a way to get notified when a new task is starting or finishing ?

4. android phones and upgrades

5. Eclipse always loads Android SDK content, even with non-Android projects

6. Howto profiling methods

7. Could not find HelloAndroid.apk: sun.security.x509.X500Name not found