Search code examples
iosobjective-ccore-dataibm-mobilefirst

secure database of core data on iOS


JSONStore from work light IBM has a feature so that If you set the usr and password for sqlite by doing following :

JSONStoreOpenOptions* options = [JSONStoreOpenOptions new];
    [options setUsername:@"usr"];
    [options setPassword:@"pwd"];

    //Open the collections.
    [[JSONStore sharedInstance] openCollections:@[people] withOptions:options error:nil];
    [[JSONStore sharedInstance] openCollections:@[orders] withOptions:options error:nil];

And then If you want to access the data base using third party app ( such as mesaSqlite ), you will get this message enter image description here

My question is

if using core data library to store info. Are there any ways to secure 
the info like worklight IBM does ?

Solution

  • You can read about Core Data security here

    "Core Data makes no guarantees regarding the security of persistent stores from untrusted sources and cannot detect whether files have been maliciously modified. The SQLite store offers slightly better security than the XML and binary stores, but it should not be considered inherently secure. Note that you should also consider the security of store metadata since it is possible for data archived in the metadata to be tampered with independently of the store data. If you want to ensure data security, you should use a technology such as an encrypted disk image. "

    Maybe checkout out the Encrypted Core Data SQLite Store project on Github.

    I have never tried to use it but it claims to provide "a Core Data store that encrypts all data that is persisted. Besides the initial setup, the usage is exactly the same as Core Data and can be used in existing projects that use Core Data."