Android File encryption and decryption - android

My android application is configurable using an external XML file present in the SD Card. The changes in the configuration requires a new XML file to be copied in that location. This XML file needs to be encrypted. So if the user request a new config for the app, the steps would be:
New XML file is generated for desired configuration.
File is encrypted using some standard encryption utility.
The file is sent to client/user.
Client copies the file to SD Card, and starts my app.
My application opens the file, decrypt it, read the content and delete the file.
I need help in step 2 and 5. Which standard tool I can use to encrypt my XML file (Should use some standard encryption algo) and secondly how the file can be decrypted in my android app. I am looking into java crypto package.

You can use this:
Android encryption
Beware as you should salt your encryption key with something not stored on the app (coming from a server for example) so that by reverting the APK to code you couldn't read the file anyway.

Related

What type of file is encrypted by EncryptedFile

I'm using the EncryptedFile class which is part of the Android Jetpack library and introduced in Google I / O 19. I just want to know if this library only encrypts a .txt file or any type of file such as a farmware file. , Image file, video file or any large file can be encrypted.
As mentioned here, it seems to be used for creating or reading a previously encrypted file. No such limitation to *.txt files is mentioned.
You can always try more and more files to discover it even further!

Android: Decrypt and load a PDF without writing it on disk

I have some PDF files on the server, those files are encrypted using AES. Using an API call, I get the file-URL and the corresponding decryption key. Then I download the encrypted file. Now I need to decrypt the file using the key and need to show it in a PDF-renderer (i will use any pdf library, though I haven't decided the library yet). Now my question is, how can I decrypt the file without writing/saving the decrypted file to disk? The target is: the decrypted file should be only on RAM, so that no other cannot get the file without using the app. The risk is, if I write the decrypted file to disk, someone can connect the device to PC and can save the file. I want to decrypt it only on RAM and want to load/show the file from RAM. So that when anyone leaves the app, the decrypted file no longer exists.

How to encrypt a dynamic library such as .so file?

I've made a .so file using in Android to encode/decode some private string , but I found it's easy to decrypt the .so file by using ida ,and easy to debug with some reverse engineering software.How to encrypt the .so file ? How to use the encrypted .so file in java?
You can't. A .so file is instructions to be used by the client processor. You can leave it encrypted until you need it, but before using it you have to unencrypt it so it can be put unencrypted in memory where the processor can access it. An encrypted .so file would need an entirely new type of architecture from the processor, to the motherboard, to RAM. And even then the client would have to have the decryption keys, which basically means you need a cryptographically secure system with all code encrypted by keys controlled by the processor OEMs. Which you don't want.

Encrypt Files in Android native code

I need to encrypt the zip file (generated from 5-6 files of size 50 MB) which are created by the android native service written in C++.
After doing google learned that there are some open source libs which can help to do the encryption. But I would like to know if there is any inbuilt support to achieve the encryption.
Code flow : Read log files create a custom logs and write to the desired location, zip and encrypt the files
Note : even if i can compress the file with password protection is enough for me.
Sorry, there is no standard Java mechanism to password protect a zip file. You will have to use a third party library.

How should I start this project in Android?

Design/develop a simple prototype for file encryption. Prototype will upload image file from internal/external memory and will save in YoApp/test folder with encrypted file name (you don't need to encrypt file itself). For encryption you can use any simple and existing algorithm. Project will have single screen with upload button.

Categories

Resources