Reputation: 1483
I want to implement the scenario that I am giving the user some XML files in RAW folder and I want to encrypt them so that the user can't access those file by exploring the APK of app. Is there any package or technique available in android to perform such action. Please do tell.
Upvotes: 1
Views: 635
Reputation: 39797
There is nothing provided for the specific purpose of encrypting / decrypting resources in your APK. There's also no requirement that the resources you provide as RAW resources fit any particular format, so you have a lot of freedom with the XML you're providing as RAW.
One option you have is to encrypt certain contents within your XML file, and decrypt them on the fly while you parse the file. If the XML is of your own design and you have flexibility to modify it, this may be preferable (or not, at your discretion of course).
Another option is to encrypt the entire file before placing it within your APK. In this option you will need to open the resource as a plain file and decrypt what you read from it; once it's decrypted in its entirety, you can pass the data to your XML parser.
Upvotes: 1