java - 良好做法 : How to handle keystore passwords in android/java?

标签 java android security keystore password-protection

<分区>

假设 keystore 的密码不是由用户密码提供或绑定(bind)到用户密码(这或多或少意味着它只是代码中某处的字符串或数组[]),它是否足以保护它不能或只能从字节码中提取出来吗?

我知道 keystore (JKS/BKS)的密码只是用来验证 keystore 的完整性。此外,完全清楚的是,我必须假设应用程序在或多或少受信任的环境中运行是“安全的”。但是无论如何,是否可以仅从 apk 文件中提取密码?

在应用程序的源代码中硬编码任何密码感觉是错误的,所以也许有一些想法,如何使它实际上不那么具有威胁性。 例如。在外部配置文件中配置密码或在安装应用程序期间随机生成密码(然后应将其存储在何处)会更好吗?

最佳答案

is it a sufficient protection that it just cannot or can only hardly be extracted out of the bytecode?

“足够”是一个主观术语;只有您自己才能确定您觉得什么对您来说足够了。

is it possible to extract the password just from the apk file?

是的,因为可以反编译 APK 文件,可以嗅探未加密的网络对话等。

how to make it actually less threatening

您可以购买 DexGuard 的许可证并使用它,因为它将加密硬编码字符串,例如您的密码。这是否值得额外防御由您决定。

would it be better to make the password configurable within an external configuration file

root 设备的任何人都可以访问该文件。

or generate it randomly during installation of the app (and where should it then be stored)?

它至少会存储在已获得 root 权限的设备用户可用的地方。

关于java - 良好做法 : How to handle keystore passwords in android/java?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21646688/

相关文章:

image - 如何使用 apache 或 .htaccess 限制对某种内容的访问?

java - 如何传递一个类型的值并将其转换为另一种类型?

java - ClassNotFoundException : org. springframework.web.context.ContextLoaderListener 问题

android - 在 Android XML 中重用 TextView 代码

android - TextToSpeech 和内存泄漏

android - 如何排除 Kotlin 中测试类的显式Api 警告?

javascript - 使用 eval 使用字符串输入按名称将函数分配给变量有哪些风险?

java - 如何打印每隔一个的数字?

java - Ignite CacheStore 实现在服务器端抛出 ClassNotFoundException

java - 为要上传到 Web 主机的 jsp 页面提供安全性