Skip to content

Latest commit

 

History

History

EncryptionOnAndroid

Resource Encryption use in an Android App

This sample app for Android™ illustrates the use of Resource Encryption in PreEmptive Protection™ DashO™. This project can be imported into Android Studio. Control Flow Obfuscation, String Encryption, and Resource Encryption are handled via the DashO Gradle Plugin for Android integration. Renaming Obfuscation and Removal are handled by R8.

This sample is configured with both asset and raw resource encryption on the release builds.

Setup

See the main README for the requirements.

Build Without Resource Encryption

Compile, protect, and install the debug version of the application.

  1. Run the command: gradlew uninstallAll (if necessary)
  2. Run the command: gradlew installDebug

If you check for encryption, you will see neither res/raw/quotes.txt nor the images in assets/img have been encrypted.

Build With Resource Encryption

Compile, protect, and install the release version of the application.

  1. Run the command: gradlew uninstallAll (if necessary)
  2. Run the command: gradlew installRelease

If you check for encryption, you will that res/raw/quotes.txt and most of the images in assets/img have been encrypted. The sample configuration does not encrypt the images allison-*

Running the Sample

sample

This sample has two buttons. The Random Image button picks a random image from the assets/img directory, determines a sampling size, and displays the image. A message will display showing the time used to read, decrypt (if needed), and decode the image. The Random Quote button reads res/raw/quotes.txt and displays a random quote from that file.

Checking the Encryption

To verify if the assets and raw resources have, or have not, been encrypted, unzip the apk. Look at res/raw/quotes.txt and the images in assets/img.

How to Add Resource Encryption to Your Android Application

To enable resource encryption, simply enable the feature in your project and rebuild the application.

Please read through the limitations and provide feedback.

Attributions

Images are from the following contributors on Unsplash:

The quotes are a subset from https://github.com/erossignon/qod4outlook/blob/master/quotes.txt.

Note: The Android robot is reproduced or modified from work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
Android is a trademark of Google Inc.
Gradle is a trademark of Gradle Inc.