【发布时间】:2013-10-30 15:39:51
【问题描述】:
我正在尝试将 SQLCipher 添加到使用 Magical Record 库的 iOS 项目中以加密数据库。还使用来自 encrypted-core-data 项目的 EncryptedStore 类:https://github.com/project-imas/encrypted-core-data。
已按照帖子iOS 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* 对象(返回 nil)。返回的错误代码也为零。
使用的 SQLCipher 库是商业 iOS 版本,其中已包含 openSSL。 SQLCipher 的集成似乎没问题,我在 encrypted-core-data 项目中测试时可以很好地使用加密数据库。
可能很长,但是在将 SQLCipher 与 Magical Record 集成时是否有人遇到过类似的问题 - 任何建议表示赞赏。
提前致谢 2J
【问题讨论】:
标签: ios encryption sqlcipher