Core Data doesn't encrypt the data you store in the persistent store, but it is possible to enable encryption.
SQLCipher is ideal for protecting application data of all kinds. SQLCipher uses peer-reviewed cryptographic providers and algorithms to ensure that all data in encrypted databases is secured. Simple configuration and good default security practices reduce the burden on developers implementing security solutions.
SQLCipher does not implement its own encryption. Instead it uses the widely available encryption libraries like OpenSSL libcrypto, LibTomCrypt, and CommonCrypto for all cryptographic functions.
Core Data can use SQLite as its persistent store, but the framework itself is not a database. Core Data is not a database. Core Data is a framework for managing an object graph. An object graph is nothing more than a collection of interconnected objects.
Implementing addition protection for users’ data is a really good idea especially when application have a deal with users’ finance information, secure notes, passwords, e.t.c. By default an data base is not encrypted. Its only form of protection is that it is sandboxed from other applications.
For this purpose you can use one of the following way:
NSDictionary *storeOptions = @{ NSPersistentStoreFileProtectionKey : NSFileProtectionComplete };
[coordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:[self storeURL] options:storeOptions error:&error])
NSFileProtectionComplete
- The file is stored in an encrypted format on disk and cannot be read from or written to while the device is locked or booting.SQLCipher
. It’s an open source extension to SQLite
that provides transparent 256-bit AES encryption.pod 'SQLCipher'
sqlcipher_export()
. Example
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With