Giter Club home page Giter Club logo

android_imageencryptor's Introduction

Android Image Encryptor/Decryptor

This is a simple Android app that allows you to protect your images through encryption. It is just like a "vault" for images.

This app is powered by:

Some of the Features:

  • Display the encrypted images on the fly.
  • Support thumbnails (thumbnails are also encrypted).
  • Support swipe and drag-and-drop gestures in the list.
  • Add images from Gallery (or other similar apps).
  • Take pictures using Camera (or other similar apps), original image is deleted once it's encrypted.
  • Display a zoomable view of the image (powered by PhotoView library).
  • Recover the encrypted image and expose it to other Gallery alike apps.
  • Support Share functionality, with which you can initiate this app to encrypt the image that you selected in other apps.

Details of Implementation

  1. The authentication and authorisation mechanism is essentially that, the username and salt are stored in the app's DB in plaintext. However, the password is not persisted, only the hash of it is stored. The hash is generated as the persudo code below. Only one user can be registered. When both the name and the hash are matched, the user is authenticated.

    Persudo code -> passwordHash = SHA256(concatenate(password, pw_salt))

  2. All images are encrypted using AES algorithm. Images are encrypted and stored in the App's internal storage. The key used for encryption is neither stored in local files nor in DB. It's generated in runtime when the user is successfully authenticated. The key is generated as the persudo code below. Note that the salt used for generating the key for image encryption/decryption is different from the one used for hashing password. Two different salts are used.

    Persudo code -> imgKey = SHA256(concatenate(password, img_salt))

  3. When a user browses the images, the images are decrypted in memory. No actual files are created during this process. However, one issue may be involved in this approach, the size of the image may exceed the one allowed by OpenGL ES3.0. The adapted solution to this is to downscale the image when displaying it.

Additional Hints For Usage

  • The first time you use this app, the app expects you to register. You simply enter the username and password that you want to use. Please make sure you remember it, since there is no way to recover it.
  • Once you have encrypted some images, and you want to delete some of them. You just swipe the image name (from right to left) in the list, a dialog will pop up and ask you whether you want to delete it. Press "Yes" to delete it.
  • In the image list, you can drag and drop (long press first then move it) the image names to change their positions.
  • When you are viewing an image, and you want to zoom in/out the image, you just do the gesture that you will normally do on any other apps.
  • When you are viewing an image, and you want to recover it back to your normal Gallery apps, you just long press the image, and a dialog will pop up and ask you whether you want to recover it. Notice that you will be asked to grant permission for this operation. It will fail, if you refuse to grant the permission.

android_imageencryptor's People

Contributors

curtisnewbie avatar

Stargazers

 avatar Rafael Cosio Castro avatar Adam Alfarizi Ismail avatar Xu Yong avatar

Watchers

James Cloos avatar  avatar

Forkers

sid009900

android_imageencryptor's Issues

ImageUtil.decodeBitmapWithScaling bug

Hi, just tried out your examples, very nice! However I did spot a couple of issues you may want to consider. This issue only occurred for me when viewing an imported image with a large size. The app would crash with an erorr of "canvas: trying to draw too large"

  1. in ImageUtil.decodeBitmapWithScaling, the variable 'options' is never populated. and so therefore imgHeight amd imgWidth are always zero. Add the following statement to line 42
    BitmapFactory.decodeByteArray(data, 0, data.length, options);

e.g.
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
// for getting the outWidth and outHeight
BitmapFactory.decodeByteArray(data, 0, data.length, options);
int imgWidth = options.outWidth;
int imgHeight = options.outHeight;

  1. the rescaling algorithm on line 49 of ImageUtil.decodeBitmapWithScaling goes into an endless loop if reqHeight or reqWidth are zero, therefore set their defualt values to a non-zero value in the parent ImageViewActivity class. i.e. since: reqWidth = reqHeight = maxsize[0], set maxsize to non-zero on line 139. e.g.

GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, maxsize, 0);
maxsize[0] != 0 ? maxsize[0] : 2048;
int reqWidth, reqHeight;
reqWidth = reqHeight = maxsize[0];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.