gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:38:41 24 4
gpt4 key购买 nike

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

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com