gpt4 book ai didi

android - 从安卓 keystore 中提取 key

转载 作者:搜寻专家 更新时间:2023-11-01 07:45:57 25 4
gpt4 key购买 nike

来自Android Keystore Docs

Android Keystore system protects key material from unauthorized use. Firstly, Android Keystore mitigates unauthorized use of key material outside of the Android device by preventing extraction of the key material from application processes and from the Android device as a whole. Secondly, Android KeyStore mitigates unauthorized use of key material on the Android device by making apps specify authorized uses of their keys and then enforcing these restrictions outside of the apps' processes.

我无法完全理解它。

by preventing extraction of the key material from application processes

  • 这是什么意思?设备中的任何应用程序都无法从存储中提取 key ?
  • 因此,一旦将 key 放入商店,就无法从商店中获取它(以防我也想在其他地方使用它)。因此,如果我想这样做,我该如何实现我自己的自定义 keystore ,它允许仅为我的应用程序的进程提取 key ,而不是其他人。

最佳答案

What does it mean? Any application process in the device can not extract the key from the store?

在您链接的文档的上下文中,“防止提取”是指“防止对手提取 key Material ”。这并不意味着您自己的应用程序不能使用 keystore 中的 key 来加密/解密数据。这确实意味着您将永远无法从 Android KeyStore 获取 key 文件之类的东西,将其复制到其他地方并重新使用它。

此外,假设您需要在应用程序的客户端和服务器之间发送加密消息。您天真地生成一个 key 并将文件(“ key Material ”)存储在您应用程序的内部存储中。对手获得对设备的根访问权限。他们现在可以访问您的 key 文件并使用您的 key 。即使您使用密码作为 key ,如果您的应用进程遭到破坏,那么由于对手可以访问 key Material (即 key 文件),仍然存在危险。

文档中所谈论的优点与这些缺点恰恰相反。 Android Keystore 加密转换发生在应用程序进程之外(作为系统进程),并且可能绑定(bind)到安全硬件。没有任何 key Material ( key 文件等)会暴露给对手以某种方式重复使用(例如解密消息或签署电子邮件)。

请注意,如果您希望一个 key 用于多个应用程序,那么您可能需要 KeyChain API而不是 keystore 。

关于android - 从安卓 keystore 中提取 key ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44255922/

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