如何使用 Android 版 Spongy Castle 加密和解密文件
我有一个 XML 文件存储在 SDCard 上。我需要对整个文件作为一个单元进行加密和解密。
我发现 Spongy Castle 是一个很好的 Android 加密和解密库。但是,我找不到任何密码类来将文件作为一个单元进行加密和解密。如果有人能就此提供进一步的帮助,我将不胜感激。任何示例代码都会有很大帮助。
I have a XML file stored on the SDCard. I need to perform encryption and decryption on the complete file as a unit.
I have seen that Spongy Castle is a good library for the Encryption and Decryption for android. But, I could not find any cipher class to encrypt and decrypt the file as a single unit. I would be really grateful if anyone could provide some further assistance on this. Any sample code will be of great help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您能否查看一下之前涉及 Android 加密技术的问题,并让我们知道它们是否回答了您的问题?如果没有,您能否详细说明您的要求,特别是详细解释为什么您需要加密这个特定的 XML 文件,以及您期望密钥来自哪里?
Android 附带旧版本的 Bouncy Castle ;如果您需要更多加密算法和模式,您可能需要包含 Bouncy Caslte 的最新版本。
请,请,请,在您实施甚至考虑未来使用加密技术之前,请阅读以下文章:加密正确答案。如果您不理解本文中的任何概念,请考虑查阅一些参考资料,我很乐意在另一个问题中提供这些参考资料。
Could you please take a look at previous questions that cover cryptography on Android and let us know if they answer your question? If not, could you please expand on your requirements, in particular explaining in detail why you need to encrypt this particular XML file, and where you expect the keys to be coming from?
Android comes with an old version of Bouncy Castle; you probably want to include an up-to-date version of Bouncy Caslte if you need more cryptographic algorithms and modes.
And please, please, please, before you implement or even consider future use of cryptography, read the following article: Cryptographic Right Answers. If you don't understand any of the concepts in the article please consider consulting some references, which I'm happy to provide in a different SO question.