Android存储密钥、反编译恐惧
我正在使用令人惊叹的 FPS,并且必须将密钥存储在 java 代码中。但是我担心有人会反编译我的 apk 并找到密钥。我自己反编译了apk,找不到密钥,但我不是VM专家。有什么帮助吗?
I'm using amazing FPS and I have to store the secret key in the java code. However I am afraid that someone would decompile my apk and find the key. I have decompiled the apk myself and could not find the key, but I am not a VM expert. Any help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不能将加密密钥放入应用程序中并期望它保持秘密。所需要的只是一位坚定的程序员对其进行反编译并找到密钥,然后他们就可以与全世界分享。
非对称/公钥加密正是您想要的解决方案。创建公钥/私钥对,然后将公钥放入您的应用程序中,并自行保留私钥。然后您可以做两件事:
You can't put your encryption key into your application and expect it to remain a secret. All it takes is for one determined programmer to decompile it and find the key, and they can share it with the world.
Asymmetric/public-key cryptography is exactly the solution you want. Create a public/private key pair, then put the public key in your application and keep the private key yourself. Then you can do two things:
一个足够坚定的人将能够提取你的密钥,对此确实无能为力。您可以尝试以某种方式混淆密钥(提高它们需要确定的标准),但您无法阻止他们获取密钥。
但是,根据您需要存储密钥的原因,您也许可以使用 非对称密钥加密。您将能够存储仅限于加密(而非解密)或身份验证目的的公钥,同时能够保证私钥的安全。
A determined enough individual will be able to extract your key, and there really isn't that much that can be done about it. You can attempt to obfuscate the keys somehow (raising the bar on how determined they need to be), but you can't keep them from getting the key.
However, depending on why you need to store the secret key, you might be able to use Asymmetric Key Cryptography. You'll be able to store a public key that may be limited to encryption (not decryption) or authentication purposes, while being able to keep the private key safe.