Encrypt Files in Android native code - android

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.

Related

What is the best practise to secure data from back to front with archive

I'm working on a project using android studio and moodle.
One of the objectives of the mission is to get data from moodle into an archive and get that archive into an SD card to access the data into the mobile without internet connexion.
The client wants the data on the SD card, not te be read by anyone.
So I thought of multiple solutions:
Creating a key on the RAR archive
Encrypting the archive
Encrypting each file within the archive (and the archive ?)
But I still don't know how to pass the data to the android safely. And if those solutions which I thought are good because you need to decrypt it with android later. The best would be that it could be done without internet.
I'm not familiar with moodle, but I assume it is a web app? If so, the easiest way to handle the data securely would be:
Download the file from the web app over HTTPS
Use the Android Jetpack security libraries to store the file on the SD card
Here is an article (from the Google Android Security team) that shows how to generate keys and store encrypted files using Jetpack: https://medium.com/androiddevelopers/data-encryption-on-android-with-jetpack-security-e4cb0b2d2a9
It abstracts away a lot of the crypto work for you.

How to protect phonegap application source code?

I want to know whether when I upload my phonegap application on play store then anyone can view source code after they install my application or not.
If the source code is viewable, what steps can I take to protect it?
Basically a PhoneGap application is html/css and javascript codes wrapped in a native Android WebView. So in order to protect your source code from others, you can encode it using techniques like uglify. To a normal user, this would be enough. It is similar to what Proguard does for native Android apk. However if you want total secrecy of some part of your code logic, keep it at the server end itself. Any client facing application is readable (eg- Webpages, executable files etc).
As you may know, an apk file is actually just a zip archive, so you can try to rename (or simply force your decompressing tool to open the apk file) the file to appname.apk.zip and extract it with any zip utility.
You can however encryption your source code checkout here https://ourcodeworld.com/articles/read/386/how-to-encrypt-protect-the-source-code-of-an-android-cordova-app

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.

Secure my applcation used file in sdcard android

I have use AES encryption to secure my data in sdcard.It work fine but take some time to decrypt mp3 file as file size is large.
when I checked file stored in other application like whats-app ,Facebook etc.. it is encrypted in different way.
Is there is any other option which I can apply to secure my files in sdcard. Please help me.
First, I will start my mentioning that you should evaluate files size and encryption/decryption time versus file importance. For example, we may want a 500mb file be only accessible by our application through Android, in which case we can set the required permissions. Because this file is not that important for us, we may decide not to encrypt it and encrypt the small and important files.
This said, I would suggest looking into faster/less reliable encryption schemes which will produce faster results. Following that you mentioned Facebook, you can look at Conceal, an open source framework developed by Facebook.

How to encrypt and decrypt folder in android sdcard

is it possible to encrypt the sd card folder r not please help me
if it possible , what is the processor of encryption and decryption
not possible , let me know what can i do for folder security in android sdcard
My file is here :/mnt/sdcard/image1.jpeg.
So How to encrypt this file in android please help me
and Android encryption support MBs r not
is it possible to encrypt the sd card folder r not please help me
Only by modifying the operating system and creating your own custom ROM.
not possible , let me know what can i do for folder security in android sdcard
If your objective is to allow the user to defend against other people stealing the user's data, you can encrypt individual files as part of how you store them. For example, you could use SQLCipher for Android to encrypt a SQLite database that you put on external storage.
If your objective is to hide data from the user, that is implausible. Your encryption algorithm and key will be in your app, which anyone can examine and use to get at the encrypted data. If you do not want users having access to certain pieces of data, do not put that data on the user's device.
Yes, you can encrypt and decrypt the files and folders in your sd card using java libraries. You can implement through javax.security package.
Below is the sample of Encryption and Decryption in java
Example 1
Example2
Example 3
Example 4
Take a Look at this Example

Categories

Resources