0

I am storing a (.sqlite) in my documents folder. I need to encrypt this file, so that no one can directly access the file. Can this be achieved in iOS?

Burhanuddin Sunelwala
  • 5,318
  • 3
  • 25
  • 51

2 Answers2

3

In iOS app no one actually can access your .sqlite file, except you. This documentation folder will be available only for your app

Kiril
  • 31
  • 3
  • Well I have an external .sqlite file which download using On Demand Resources and then place it in Document's folder and Document's folder is accessible. – Burhanuddin Sunelwala Apr 16 '17 at 09:42
0

You can use sqlcipher library which provide good level of encryption to your sqlite database. It is adds the encryption layer on sqlite. It's free and open source. You can see more details and the tutorial below. https://www.zetetic.net/sqlcipher/ios-tutorial/

Ben Aubin
  • 5,542
  • 2
  • 34
  • 54
codester
  • 36,891
  • 10
  • 74
  • 72
  • Well I tried this was not able to make it work in swift. Also it seems that it encrypts .db file and not .sqlite. Kindly correct me if I am wrong. – Burhanuddin Sunelwala Apr 16 '17 at 10:22
  • SQLCipher can use with swift. Also sqlcipher can encrypt the sqlite files also.Check https://github.com/stephencelis/SQLite.swift This implementation have sqlcipher support for swift. Also you can check this thread more https://discuss.zetetic.net/t/sqlcipher-ios-and-swift/1398/4. It's little bit complicated to work with sqlcipher and make it work. – codester Apr 16 '17 at 10:28