2

I am designing one Custom library, in that library to store the confidential data. For storing the data i have 2 options.

1) shared preferences.

2) Sqlite3 database.

If , i use SharedPreferences with MODE_PRIVATE . It can be accessed by the application developers those who are use my library.

Second option is Sqlite3 Database, Here i can store but still data can be used by the application developers by adding my library.

SO, i been looking for the answers that, Do we have option for setting password for the Database in Android.If yes please guide..

Thank you in advance for the answers.

Naveen
  • 371
  • 3
  • 4
  • 14

2 Answers2

3

Hey the same Problem with me too....

I got an Solution....

The Solution is Dual Passwords :D

Here all we can do is encrypt all the data that is confidential...

Step 1 : Ask user for two Passwords ( Password1 & Password2 ) rather than a username & pass...

Step 2 : You can encrypt all the data using a Password that may be 1 or 2...

Step 3 : to decrypt that data again the same password must be used..

THE PROBLEM SOLVED: The problem is how Can we store the Passwords in the database..

ALL WE DO is encrypt the first password with the other.... ENCRYPTION AND DECRYPTION refer this link

----> http://www.androidsnippets.com/encryptdecrypt-strings <----

JUST USE THAT it works like charm

SO FINALLY HOW THE PROCESS GOES IS

  1. Ask for two passwords...
  2. encrypt one with other then compare the hash with the one in database
  3. continue to next
  4. Beware decrypt all the data before you present to user.....
ivar ajet
  • 196
  • 2
  • 9
2

The company behind SQLite provides a commercial solution which you can use.

However, SQLCipher is a free (and open source) alternative that allows you to encrypt your SQLite databases.

Raghav Sood
  • 81,899
  • 22
  • 187
  • 195
  • I am creating library,(if i am developing application, i can use the SQLcipher - because SqlCipher creates library to load). I don't want add the library with in a library, that will be weird right?? – Naveen Mar 28 '13 at 12:16
  • @Naveen ActionBarSherlock uses the supporr library even though it is a library. It is definitely possible. – Raghav Sood Mar 28 '13 at 13:28
  • @Naveen you could always encrypt the data itself using AES or something before you write it to the database, and decrypt it after you read it if you want something dynamic. – Raghav Sood Mar 28 '13 at 14:04
  • Thank you very much, i been looking for what you say now. Please share the tutorial regarding the same. – Naveen Mar 28 '13 at 14:06
  • @Naveen There's an SO question on it here: http://stackoverflow.com/q/6788018/1069068. Many more are there too, which Google can help you with – Raghav Sood Mar 28 '13 at 14:08