假设 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 权限的设备用户可用的地方。