I am working on an android application, and I need to use encryption for one aspect of it. I am really indifferent to which algorithm I use (AES, DES, RSA, etc...). I am awa
Considering the overhead to encrypt and decrypt data in Android, I devised a library that relies only in Android and Java native libraries to make the process as simple as possible.
To install, use the jcenter distribuition center. On gradle:
compile 'com.tinmegali.android:mcipher:0.4'
Usage
String ALIAS = "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 );
MCipher is compatible from SDK 19+, and it automatically adapts itself to smaller and large chunks of data. By default, it uses AES/GCM/NoPadding for SDKs 23+, and RSA/ECB/PKCS1Padding for older versions.
MCipher on Github