Search code examples
ibm-mobilefirstcloudant

Can we use CloudantSync(CDTDatastore) encryption with IMFData SDK?


Now CloudantSync(CDTDataStore) can encrypt localstore using CloudantSyncEncryption. IMFData of MobileFirst Platform Foundation adds security and depends on CloudantSync.

Is there any way combination of IMFData and CloudantSync Encryption?

IMFData creates local data store like below.

IMFDataManager *manager = [IMFDataManager sharedInstance];
NSString *name = @"automobiledb";
NSError *error = nil;

//Create local store
CDTStore *store = [manager localStore:name error:&error];

CloudantSync creates encrypted local data store like below.

// To create an encrypted datastore, create your datastore using an object
// implementing the CDTKeyProvider protocol
CDTDatastoreManager *manager =[[CDTDatastoreManager alloc] initWithDirectory:path error:&error];
CDTEncryptionKeychainProvider *provider = [CDTEncryptionKeychainProvider 
                                           providerWithPassword:@"blahblah" 
                                           forIdentifier:@"default"];
CDTDatastore *encrypted = [manager datastoreNamed:@"encrypted_datastore"
                        withEncryptionKeyProvider:provider
                                            error:&error];

Solution

  • You can't do this yet, but work to support it is in progress. Keep an eye on new releases.

    Update: IMFData 1.1.1 provide support for using encryption. See the docs here for info on creating encrypted local datastores.