0

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.

Rohan
  • 2,939
  • 5
  • 36
  • 65
  • I think this link is helpful for you http://stackoverflow.com/questions/5648698/how-to-encrypt-an-database-using-sql-cipher – Naveen kumar Sep 18 '13 at 12:06
  • Generally you either decrypt on opening and encrypt on closing (very insecure) or you use SqlCipher. A few people try to encrypt/decrypt individual values, but that's both insecure and very messy. – Hot Licks Sep 18 '13 at 12:18
  • @Hot Licks can u please share code to decrypt on opening and encrypt on closing – user2791330 Sep 18 '13 at 12:20
  • Nope. I'd never use that technique. – Hot Licks Sep 18 '13 at 12:21
  • This is not a solvable problem. The user will always be able ultimately to decrypt the database you sent them (since you will also have to send them the key at some point). You can create some obfuscation, and SqlCipher is fine for that, but there is no secure solution to this problem. – Rob Napier Sep 18 '13 at 17:21

3 Answers3

0

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

thatzprem
  • 4,697
  • 1
  • 33
  • 41
0

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

Jordan Montel
  • 8,227
  • 2
  • 35
  • 40
0

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.

helst
  • 16
  • 3