EXPERTS! What is the best way to protect the data in the SQLite database?

immarch

New Member
Licensed User
Longtime User
EXPERTS! What is the best way to protect the data in the SQLite database? When your app is installed on a phone a user or developer could simply locate the db file and use it in their program.

Anyone have any examples or code or suggestions on how to protect the data or database using a fairly simple method?

Thanks!
 

kickaha

Well-Known Member
Licensed User
Longtime User
Put it in DirInternal, this is for application private data and is hidden from file explorers.
 
Upvote 0

immarch

New Member
Licensed User
Longtime User
DirInternal and DB protection.

I just tried DirInternal and it raises an error. However, DirDefaultExternal works but leaves the db file unprotected.

can any experts post any sample code on how to encrypt or decrypt using the provided library? Or maybe 2 functions that use a unique password to get the job done?
 
Upvote 0

AscySoft

Active Member
Licensed User
Longtime User
if this is still intreasteing you, the you could do a couple a things, like
1) encrypt every rows in all the tables using Encryption class - but I think that if your database is big enough then this is not gonna be practical couse of the lag time
2) decrypt the database file (DirInternal = /data/data/<packetname>/files), save the records, encrypt it back when done and delete the unencrypted copy

Would U share us your solution, your approach?
 
Upvote 0
Top