好的做法:如何处理android / java中的密钥库密码?

参见英文答案 > Handling passwords used for auth in source code5个
假设密钥库的密码不是由用户密码提供或绑定到用户密码(或多或少意味着它只是某个代码中的字符串或数组[]),它是否足够保护它不能或几乎不能是从字节码中提取出来的?

我知道密钥库的密码(JKS / BKS)仅用于验证密钥库的完整性.此外,我必须假设应用程序在一个或多或少受信任的环境中运行才能“安全”.但无论如何,是否可以从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

任何根设备的人都可以获取该文件.

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

它至少会存储在root用户可用的某个地方.

相关文章

Android 如何解决dialog弹出时无法捕捉Activity的back事件 在...
Android实现自定义带文字和图片的Button 在Android开发中经常...
Android 关于长按back键退出应用程序的实现最近在做一个Andr...
android自带的时间选择器只能精确到分,但是对于某些应用要求...