【问题标题】:Private Key storage in AndroidAndroid中的私钥存储
【发布时间】:2011-11-18 12:09:34
【问题描述】:

我必须将我的应用程序的私钥存储在 android 设备中的安全位置,我阅读了有关 certStore 的信息,但它不允许在其中存储文件。 是否有任何位置可以安全地存储它并且在重新安装应用时不会被删除。

【问题讨论】:

  • 您在应用程序中使用该密钥吗?
  • 是的,我收到来自网络的响应并使用此密钥解密
  • 所以,在这种情况下,您只有一个选项是使用共享首选项,在私有模式下,只有您的应用程序可以访问此共享首选项。
  • 但是共享首选项的问题是它会在应用重新安装时被删除。我的应用程序使用注册,并在批准后自行下载。
  • 你试过安卓备份管理器吗?我认为它可以帮助您重新安装活动数据。如果这不是您想要的,那么您也可以尝试使用 android 应用程序的内部存储。

标签: android certificate private-key


【解决方案1】:
You can store the key in the Preferences of your App. This will protect the key from
getting read by other applications because of the underlying file system restrictions of
the Android system.

但这不会保护密钥不被用户自己读取。

如果您想在您的应用程序被删除并再次安装到设备后使用此共享首选项,请尝试使用 Android 备份管理器。 我认为它可以帮助您重新安装活动数据。

EDIT: Android (unfortunately) does not provide a way to do so. The approach I've used
      before is to encrypt this token with another key generated within the app.

      Your app key can be algorithmically generated. This, however, is only as secure as
      your algorithm. Once that is known this is equivalent to storing the token in plain text.

谢谢。

【讨论】:

  • 如果手机已经root,他们能访问这个文件夹吗?
  • 是的,如果手机已root,则他们可以访问此目录。
  • 但是如果你在你的活动或课堂上编写这个密钥,并且一旦你的 apk 创建后使用 progaurd 或任何其他安全工具,那么我认为任何人都不容易得到它。
  • 我假设代码无法从 apk 中检索,因为它已被编译。我不希望外部用户攻击为设备指定的消息。这基本上就是为什么私钥应该在设备中受到保护的原因。或者如果设备在非用户手中,他们应该无法检索密钥。
  • 如果您在应用本身中使用密钥,那么这是输入代码的最佳方式,因此编译代码后没有人会检索它。
猜你喜欢
  • 2013-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-05-27
  • 2020-02-01
  • 2017-12-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多