我试图将SQLCipher添加到iOS项目中,该项目使用魔术记录库对数据库进行加密。还使用来自加密核心数据项目的EncryptedStore类:https://github.com/project-imas/encrypted-core-data。
遵循了PostiOS Magical Record & SQLCipher中的说明
我把方法- (NSPersistentStore *) MR_addSqliteStoreNamed:(id)storeFileName withOptions:(__autoreleasing NSDictionary *)options编辑成..。
[coordinator
addPersistentStoreWithType:EncryptedStoreType
configuration:nil
URL:databaseURL
options:options
error:&error];有备选方案:
NSDictionary *options = @{
EncryptedStorePassphraseKey : @"the_password",
NSMigratePersistentStoresAutomaticallyOption : @YES,
NSInferMappingModelAutomaticallyOption : @YES
};如果使用EncryptedStoreType类型,生成的NSPersistentStore*对象没有被创建(返回为零),我遇到了一个问题。返回的错误代码也是零。
使用的SQLCipher库是商业iOS版本,其中已经包含了openSSL。SQLCipher的集成似乎没问题,在加密核心数据项目中测试时,我可以很好地使用加密数据库。
可能是一个长远的机会,但有没有人遇到类似的问题,当集成SQLCipher与魔法记录-任何建议赞赏。
提前谢谢2J
发布于 2013-11-12 20:40:43
我今天遇到了这个问题,在使用log语句对EncryptedStore.m进行大量搜索之后,我发现它无法创建一个新的数据库,因为我添加了一个以索引作为属性名的实体。
结果发现,您不允许使用索引作为属性名。
我在EncryptedStore.m中的loadMetadata: FunctioninEncryptedStore.m中找到了我的问题,所以如果您还没有解决它,也许可以从那里开始。
https://stackoverflow.com/questions/19687325
复制相似问题