I have a live iOS application on apple app-store which is using the core data.
Now I want to encrypt the core-data using EncryptedCoreData (https://github.com/project-imas/encrypted-core-data 2).
I am successfully able to implement the same with my project and it working fine for fresh installed but when I tried to override my existing application which is not using the encrypted coredata with the new application which is using the encrypted coredata at that time getting error
Error Domain=EncryptedStoreErrorDomain Code=6000 "Incorrect passcode" UserInfo={NSLocalizedDescription=Incorrect passcode, NSUnderlyingError=0x6000039e4810 {Error Domain=NSSQLiteErrorDomain Code=26 "(null)" UserInfo={EncryptedStoreErrorMessage=file is not a database}}}
Following is my old code sample
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (persistentStoreCoordinator_ != nil) {
return persistentStoreCoordinator_;
}
else if (!storeUrl)
return nil;
NSError *error = nil;
persistentStoreCoordinator_ = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:self.managedObjectModel];
NSDictionary *options = @{
EncryptedStorePassphraseKey : @"123456",
EncryptedStoreFileManagerOption : [EncryptedStoreFileManager defaultManager],
NSMigratePersistentStoresAutomaticallyOption : @YES
};
NSPersistentStore *store = [persistentStoreCoordinator_
addPersistentStoreWithType:EncryptedStoreType
configuration:nil
URL:storeUrl
options:options
error:&error];
if (!store && error)
{
NSLog(@"%@",error.description);
// Here is the error
// Error Domain=EncryptedStoreErrorDomain Code=6000 "Incorrect passcode" UserInfo={NSLocalizedDescription=Incorrect passcode, NSUnderlyingError=0x6000039e4810 {Error Domain=NSSQLiteErrorDomain Code=26 "(null)" UserInfo={EncryptedStoreErrorMessage=file is not a database}}}
}
return persistentStoreCoordinator_;
}
How I can resolve this issue, I want to implement Encrypted coredata in such a way so the existing user(those having unencrypted DB) does not affect and there DB should be converted into Encrypted core data without losing their data.
I have a live iOS application on apple app-store which is using the core data. Now I want to encrypt the core-data using EncryptedCoreData (https://github.com/project-imas/encrypted-core-data 2). I am successfully able to implement the same with my project and it working fine for fresh installed but when I tried to override my existing application which is not using the encrypted coredata with the new application which is using the encrypted coredata at that time getting error Error Domain=EncryptedStoreErrorDomain Code=6000 "Incorrect passcode" UserInfo={NSLocalizedDescription=Incorrect passcode, NSUnderlyingError=0x6000039e4810 {Error Domain=NSSQLiteErrorDomain Code=26 "(null)" UserInfo={EncryptedStoreErrorMessage=file is not a database}}}
Following is my old code sample
How I can resolve this issue, I want to implement Encrypted coredata in such a way so the existing user(those having unencrypted DB) does not affect and there DB should be converted into Encrypted core data without losing their data.