How to Store SQLcipher password locally - android

I'm working on an application which uses SQLcipher and it's offline, So its not possible for me to fetch Key from server to communicate with encrypted database.I have to store it securely somewhere within the device. One solution would be to store key in preference but if the phone is rooted on can gain access to these folders. Data used in application are highly confidential and I cannot let that get accessed. Would be great if you recommend things to sort this case. Thanks in advance.

You can use conceal library by facebook for the same.
https://facebook.github.io/conceal/

Related

How can i secure my application and also protect my Sqlite database in application

How can i secure my application and also protect my database in application. Which means data is not accessed by other application or by reverse engineering. Like in banking application login data and other information is stored in app but we can not accessed. How to achieve this type of security in application.
Encryption is way to achieve security but there are many types of encryption. I am not getting to figured out that which encryption type is better for security in application.
You can use sqlcipher to protect your sqlite database
click here

Encrypting sqlite database on PC and decrypt it on phone

I'm creating a dictionary app. I want to encrypt sqlite database (which has meaning for words) in my PC before creating the app. Then generate the apk file with that encrypted database, so that when somebody unzip the apk file, they only see encrypted database. Each and every time the user searches for a word, then the encrypted "meaning" of the word should be decrypted by the android app. I've gone through multiple threads, they talked about encrypting and decrypting the database in the phone. Please suggest me some safe methods to safeguard my hardwork.
There is no problem. Just encrypt before compiling the app, add the key to the app and decrypt in the app when needed.
Of course a competent attacker will be able to get the key.
Protecting assets from the device owner is very hard and generally requires DRM which is difficult and still not completely secure.
Actually, there should no need to encrypt any data on the mobile side because this sounds incorrect at the first place when you publish things should be secured around the world, you don't know how much the user device itself secure, and the user could be professional enough to crack your app and its security.
If you want something secured, secure it in your backend, and talk with your backend with api secured with https with headers have Auth token auto-generated for each user.
I want to encrypt the database before creating apk and decrypt it when
a user searches for a word.
If you mean decrypt inside your mobile and search inside your sqllite itself, why you encrypt it, if the code inside mobile will encrypt and decrypt, attacker even junior level one, will be able to hack your data!!

Where to store encrypted key of a prepulated sqlite in air application

I have an air mobile application which bundled with a sqlite database which is pre-populated and encrypted with a key. Now since someone can reverse engineer and get the key, I need to know if there is better place to hide it somewhere on the device which can only accessed by my application, els is not an option i guess, because it also expose the key.
The key has to be same so I cant generate it on the device.
It might have been asked previously but I dont see any relevant answer for storing the key.
Thanks

Accessing a password protected SQLite database on Android?

I haven't been able to find a way to open a password-protected SQLite database on Android. Since the device can easily be rooted, I am thinking of password protecting the database file. However, I am not having much luck finding anything built into the Android platform.
I don't think that Android framework supports password protection on databases. Your best bet is to encrypt your data. See SO question: Android Sqlite Password Encryption
You can encrypt SQLiteDatabases. Android does not support full-database encryption so you'd have to implement that yourself if you want to.
If you want to go down the encryption route, you're much better off just encrypting the sensitive information yourself and storing it in a database field, as per Morrison's answer.
All that said -- where are you putting the password for the encryption function? You'll probably need it somewhere in your application! In which case someone can just disassemble your code and then find the password, and decrypt the info (although it will be a bit more work).
Unless you're hashing info (one-way) then without hardware encryption on a device (and even that has flaws) you cannot store anything on the device perfectly securely -- you're always going to need to decrypt the info some time and for that the password has to be on the device somewhere.
If you want really robust security then store sensitive information on a server (preferably in a really secure location), not the device, and only communicate between the device and server over encrypted channels (HTTPS). You'll also need to authenticate the device in a secure manner. But to do that you need to store some sensitive information ON the device in order to authenticate the device with the server, unless you force the user to enter a password every time (recommended if security is a must).
If the information is stored on a server you can't necessarily prevent someone who shouldn't gaining access (by finding the password you have stored or phishing the user if it's stored in their head), but you can revoke access to the information.

Encrypting a DB File in Android

In my Android application I want to encrypt a db file. How can I do that?
The DB, normally, is stored in your application directory which is only accessible to the user-id assigned to your application.
I don't think there's any way to explicitly encrypt the DB using the android framework but an easier approach would be to encrypt the information you store in the DB. That works well if your user needs to enter some password to access the application and you can use this password to encrypt your information. But if your application doesn't require any password login then you will have to keep the encryption key in code and the security of your data will be compromised if some decompiles your application and finds the key.
Sun has an article that explains how to use AES encryption here. As far as I can tell all of the necessary libraries are available from Android.

Categories

Resources