mercredi 15 avril 2015

Decrypting core data

Warning: I don't know obj C but was handed this project for this one task


I am successfully encrypting the fields which lay in core data (sqlite) but I cannot decrypt them using a similar method. Below is my code which is causing the app to break during the fetch of core data:



NSManagedObjectContext *context = [self getContext];
NSEntityDescription *entityDesc = [NSEntityDescription entityForName:entityName inManagedObjectContext:context];

NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entityDesc];
[request setReturnsObjectsAsFaults:NO];
if (predicate != nil) {
[request setPredicate:predicate];
}
NSError *error;
//the code that breaks
NSMutableDictionary *theFetch = [[context executeFetchRequest:request error:&error] mutableCopy];
return [[self decryptDictionaryData:theFetch withUserId:entityDesc.propertiesByName[@"theUnlockKey"]] mutableCopy];

Aucun commentaire:

Enregistrer un commentaire