ios - 使用 identifierForVendor 加密文件是否合适?

标签 ios cocoa security encryption

我正在考虑在我的应用程序中加密文件的正确方法。以下适用于文件中存储的数据:

  • 数据不是很敏感
  • 如果数据丢失了可以重新创建(虽然它非常昂贵)
  • 该文件应该只能由我的应用程序读取
  • 当复制到另一台设备时,我的应用程序不应读取该文件
  • 应用程序不应要求为钥匙串(keychain)使用设备密码

我的一个想法是使用 [[UIDevice currentDevice] identifierForVendor] 作为加密 key ,因为这应该确保我的上述观点。

这样做好吗?请给我所有你能想到的我不应该这样做的理由!

最佳答案

我不建议直接使用它。

原因是它可能会在升级等几种情况下发生变化。

您仍然可以使用它代替随机生成器,然后将其存储在 key 链中以备将来使用。

引用

The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes.

https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor

关于ios - 使用 identifierForVendor 加密文件是否合适?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25381012/

相关文章:

iphone - 如何将 UIImageView 裁剪成自定义形状

cocoa - 构建和分析工具 Cocoa Xcode

html - 使用 Cocoa Webkit 进行国际化显示前修改 HTML 的方法

objective-c - 异步 setUp 方法完成后运行测试

mysql - 在旧的经典 ASP 站点中清理 mysql 的好方法是什么?

security - 尼菲 : how to make ListenHTTP work with SSL

php - parse_ini_file() 出于安全原因已被禁用 - 替代方案?

ios - UIActivityController 在设备和模拟器上的行为不同

ios - 是否可以将 PayPal 与适用于 iOS 应用程序的 Parse.com 连接?

ios - UITableView - 行 - 多重对齐