I am creating an XML file data using XML Serializer methods. The XML file is created and stored on the SDCard when custom events occur. I need to encrypt this file while storing it on SDCard and later Decrypt it when the user hits the button.
I want to encrypt and decrypt the XML file as a whole because data stored in XML file is large. So, is there a way to encrypt and decrypt the XML file as a whole?
You can’t use RSA to encrypt anything larger than the key size (typically 1024-4096 bits). For large data, you need to use a block (or stream) cipher, such as AES. You need to use the
Cipherclass with a suitable mechanism such as ‘AES/CBC/PKCS5Padding’. As usual, the bigger problem is where and how to store the key.What are you trying to achieve? Who/what are you trying to protect your data from? What level of protection do you need?