use*_*637 6 iphone encryption core-data ios
我只需要对此进行确认.
用iPhone 3GS及以上版本来说,写入文件系统的任何数据都是使用硬件加密加密的吗?只需在文件系统上创建XXX.sqlite文件,存储在其中的数据就已经加密了.
还提供进一步的安全性NSFileProtectionComplete?
谢谢.
[_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:@{ NSPersistentStoreFileProtectionKey : NSFileProtectionComplete } error:&error]
Run Code Online (Sandbox Code Playgroud)
不,这不正确.您需要在sqlite文件上启用加密.创建后添加以下内容persistentStoreCoordinator:
// Make sure the database is encrypted when the device is locked
NSDictionary *fileAttributes = [NSDictionary dictionaryWithObject:NSFileProtectionComplete forKey:NSFileProtectionKey];
if (![[NSFileManager defaultManager] setAttributes:fileAttributes ofItemAtPath:[storeURL path] error:&error]) {
// Deal with the error
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4832 次 |
| 最近记录: |