Skip to content

tinmegali/MCipher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCipher Library

A Simple Encryption and Decryption Library for Android

This simple library aims to reduce the overhead necessary to securely encrypt and decrypt files in the Android system. It relies only in Android native libraries, making use of the KeyStore, combined with SecretKeys or KeyPair to make the encryption and decryption process.

The MCipher is currently in development process, but it is pretty stable so far. I tried to document the library as detailed as I could. Check it out the JavaDoc.

If you have the time, any help to improve the tool will be welcomed.

MCipher Advantages

  • Compatible with SDK 19.
  • Uses the best Android framework compatible with the SDK in use.
  • Extremely simple to use.
  • Relies only on Android native libraries.

Using MCipher

The encryption and decryption process relies on two interfaces, MEncryptor and MDecryptor. All you have to do is build the interfaces, providing a common 'alias' for both MEcnryptor and MDecryptor and you're good to go.

Keep in mind that it could be a good idea to make the encryption and decryption using background task, otherwise your ui thread may be compromised.

// a good idea is to use your package name as a foundation for the 'alias'
String ALIAS = "my.package.name.mcipher.alias"
MEncryptor encryptor = new MEncryptorBuilder( ALIAS ).build();
MDecryptor decryptor = new MDecryptorBuilder( ALIAS ).build();

String toEncrypt = "encrypt this string";
// encrypting
String encrypted = encryptor.encryptString( toEncrypt, this );

// decrypting
String decrypted = decryptor.decryptString( encrypted, this );

Installation

You can download MCipher from jcenter directly. Don't forget to point to jcenter distribution center.

Maven
<dependency>
    <groupId>com.tinmegali.android</groupId>
    <artifactId>mcipher</artifactId>
    <version>0.4</version>
    <type>pom</type>
</dependency>
Gradle
compile 'com.tinmegali.android:mcipher:0.4'