i am able to create sqlite database using firefox addon and use database in iPhone. Now I want to give the the password to database and used it in my iPhone application. i tried a lot on google to search the proper way yo create password protected database but still no success.
anybody have idea that how can create the password protected sqlite database and how can we use it in iPhone
Try SQLiteEncrypt.The SQLiteEncrypt is an AES encryption embedded SQLite database engine through which you can encrypt and decrypt your SQLite database file. When set a password key into your database file, content is no longer stored in cleartext, so that we achieve the purpose of data protection.
But it is not free.
Note: But IT is not for iOS (thanks brad to pointed it out).
*Edit***
For iPhone you can use SQLCIPHER which is an open source full database encryption for sqlite.
Unfortunately, there is no free solution for doing that.
There are some commercial applications, which allows sqlite database encryption.
Also, there is virtual filesystem support in SQLite, where you can change calls which reads/writes data to SQLite database, however that will require some coding.
Related
Hello,
Can anyone tell me how to encrypt the .db or sqlite file in Xcode so as to prevent others person to access the data of .db file ?
I have given the ipa file for testing and the tester is able to access all data in .db file.
So can anyone please suggest any mechanism to prevent users to see the data in .db file ?
Thanks.
The best way as per my research & understanding is to use the OS level encryption, by that way you reduce the chances of getting into runtime DB issues.
I recommend you have a look at this article which explains/talks more about it in detail.
Core Data and Enterprise iPhone Applications – Protecting Your Data
Maybe you can use this project to encrypt your database with Core Data
Or you can use this API with this wrapper to encrypt your .db
check out http://sqlcipher.net
Full Database Encryption for SQLite
SQLCipher is an open source extension to SQLite that provides transparent 256-bit AES encryption of database files.
Okey, so i am studying sqlcipher and preparing a document on it. so far study shows that how to encrypt database, i could not find how to decrypt database. Like that i have few more questions.
I found that you can not perform coredata operation on encrypted database.so
1) Can i run a sql query on encrypted database.
2) so if i have to perform a coredata operation, so i have to decrypt the database.
3) and last but not least, how to do decryption using sqlcipher.
Please answer if these questions make sense.
Thanks
Yes, you can perform a SQL query on an encrypted database, however the pages within a SQLCipher enabled SQLite database need to be decrypted prior to retrieving the unencrypted data. In order to access an SQLCipher encrypted database, you need issue either the PRAGMA key command, or programmatically call sqlite3_key. Additional documentation can be found here, along with the mailing list here.
I have an encrypted version of an sqlite database
and also I have the KEY
but honestly I have no idea about using it or how to get the data from the encrypted database?
I guess the solution somewhere in the open function?
if(sqlite3_open([_dbPath UTF8String],&database)==SQLITE_OK);
Can anybody help me??
The core SQLite database implementation does not itself provide encryption support. There does however exist a number of extensions for adding encryption to SQLite. Some of these encrypt the entire database file while some other only encrypt the contents of the tables.
These extensions are for the most part not compatible, so you will most likely have to use the same extension on the iPhone as the one used on C#. And if you're lucky that extension is also supported on iOS.
Can you store an sqlite database remotely on a server? I am building an iphone app and all the tutorials seem to store the sqlite database on the iphone itself...
That is not advisable, as you will quickly run into concurrency problems. I would use a traditional RDMS such as MySQL or PostegreSQL in such a case.
SQLite has a useful page explaining when to use it. It says:
If you have many client programs
accessing a common database over a
network, you should consider using a
client/server database engine instead
of SQLite.
I agree with Matthew Flaschen, but if you really want to, you can connect to a sqlite db throuth an ssh tunnel. If multiple clients prefer mysql postgresql.
I have no idea how to store username and password details so that the user does not have to login everytime for the iPhone app.
Can anyone lead me in the right direction? I can't seem to find what to do.
Thanks!
You should be using the Keychain API. It will encrypt the data (not hash, as if you have to send it a the server, then the hash wouldn't be any use).
It's a bit of a pain, so take a look at some of sample code and 3rd-party wrappers available on the internet.
You can use Core Data or SQLite or any other storage (XML, JSON), since there are no cookies in iPhone.
Core Data
http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
SQLite
http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/
Also remember to hash the password you should use MD5 at least.