I have a sqlite database in asset folder of my android project. I made it with sqlite database browser and use it in my project. It contains some table with 4 columns. This is working great in my apk file. But problem is if someone want he can easily break my apk file and get my real database also. Now my question is how can I protect my database? Is there any way to set password or encrypt my database. I searched this type of problem in stackoverflow.com and found some way. But I think those ways are for, when I creating database with code. If I create database or put data with my program I would make my own encryption method also (like shuffling characters). But, again I am saying, my database is pre made and I want to protect this? In this situation can you help me please? Sorry for bad English.
Asked
Active
Viewed 4,161 times
3 Answers
3
You can protect your database with help of following libraries. And make sure you use Pro-Guard to protect your code which has encryption keys.
- SQL Cipher for Android but its paid library.
- SQLite Encript
- Android Database SQLCipher
Edit
![](../../users/profiles/1841457.webp)
Chintan Rathod
- 24,674
- 13
- 76
- 92
2
You can integrate Proguard in your android app. Here is official documentation for this Proguard It will save your apk file from attack.
You can also encrypt your data in SQLite. You can apply AES Encryption to data beforing storing it to database and decrypt data in your code files before accessing it. Yo can also use SQL Cipher to protect your database
Check this Link it will help you
![](../../users/profiles/-1.webp)
Community
- 1
- 1
![](../../users/profiles/2546262.webp)
Vaibhav Agarwal
- 4,154
- 2
- 16
- 20
-
2Base64 is not an encryption technique – Kumar Bibek Feb 04 '14 at 09:08
-
@KumarBibek check the [Link](http://en.wikipedia.org/wiki/Base64) Base64 is an encoding technique. You can encode and decode your data through this. – Vaibhav Agarwal Feb 04 '14 at 09:11
-
1Encoding and Encryption are different topics. Although the link might be describing to use Base64 to encode, certainly, it's not an encryption technique. You do a Base64 encoding and not Base64 Encrypting. – Kumar Bibek Feb 04 '14 at 09:14
-
1yeah agree but this can fulfill the req here. you can encode data to protect it – Vaibhav Agarwal Feb 04 '14 at 09:16
-
1Base64 doesn't protect your data. Encoding, itself, doesn't aim to protect your data. Anyone can decode your Base64 encoded data, without any help. – Kumar Bibek Feb 04 '14 at 09:18
-
But how will you know that data is base64 encoded. it will only hit and try. with base64 data remains intact without modification during transport. – Vaibhav Agarwal Feb 04 '14 at 09:24
-
1By looking at a string, it is fairly easy to tell if it's a Base64 encoded string or not. Moreover, whoever wants to hack into your data, that's the first thing generally everyone thinks about. – Kumar Bibek Feb 04 '14 at 09:27