androidxmlencryptionspongycastle

How to encrypt and decrypt a file using Spongy Castle for 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.


Solution

  • 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.