在 Android 中以安全的方式将数据保存在 SDCard 上
我想在 SDCard 上保存一些文件,这些文件将从网络下载。用户不应该能够直接访问它。我的意思是该文件应该是安全的,并且不应将其传输到其他设备,并且如果传输了,则它不应该是可读格式。 SDCard 上是否有一个特定的目录可以保存这些文件并且也很安全?此外,卸载应用程序时应自动删除此文件。我想在 Android 2.2 中有一个直接的方法,但不能低于它。因此,如果有人有任何想法这样做,请告诉我。
I want to save some files on SDCard which will be downloaded from net. The user should not be able to have direct access to it. I mean the file should be secure and it should not be transferred to other device and if its transferred then it should not be in readable format. Is there a particular directory on SDCard where these files can be saved and be secure too? Also this files should be automatically deleted on uninstall of the app. I guess there is a direct way of that in Android 2.2 but not below that. So, if someone has any idea of doing that then please let me know.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
加密。如果您担心用户读取的文件是您会找到的最接近的答案,但您还需要一种安全的方法来存储解密密钥,而这实际上是不可能实现的。
实际上,设备所有者不得查看的任何内容都不得位于设备上。
Encryption. If you're concerned about the user reading a file that's the closest answer you'll find -- but you need a secure way to store the decryption key also, which is not really attainable.
Realistically, anything that must not be viewed by the device owner must not be on the device.
如果这些文件由专门用户实际拥有,则没有实际的方法可以使它们无法复制。您可以使它们难以复制,但并非不可能。
如果您像 @mah 指出的那样使用加密,然后不要将密钥存储在设备上:从服务器获取密钥,将其保留在内存中,并且永远不要将解密的文件或密钥写到磁盘上,您可能没问题威慑随意的海盗。奉献的灵魂会弄清楚的。
If the files are in the physical possession of a dedicated user there is no practical way to make them impossible to copy. You can make them DIFFICULT to copy, but not impossible.
If you use encryption as @mah pointed out, and then don't store the key on the device: fetch the key from a server, retain it in memory and never write out the decrypted file or the key to disk you might be ok in deterring the casual pirate. The dedicated souls will figure it out.