From 41bedacd76cded18d9a47b54a567b49b9d47da2f Mon Sep 17 00:00:00 2001 From: Ademar Alves de Oliveira Date: Sun, 31 Jan 2016 21:30:16 -0200 Subject: [PATCH] Prepare version 1.3.0 --- Examples/Android/app/build.gradle | 2 +- Examples/Java/build.gradle | 2 +- README.md | 41 ++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Examples/Android/app/build.gradle b/Examples/Android/app/build.gradle index ec05bdb..74b4d11 100644 --- a/Examples/Android/app/build.gradle +++ b/Examples/Android/app/build.gradle @@ -12,5 +12,5 @@ android { } dependencies { - compile 'com.github.simbiose:Encryption:v1.3.0' + compile 'com.github.simbiose:Encryption:1.3.0' } diff --git a/Examples/Java/build.gradle b/Examples/Java/build.gradle index 062fb0b..aed6213 100644 --- a/Examples/Java/build.gradle +++ b/Examples/Java/build.gradle @@ -19,5 +19,5 @@ sourceSets { } dependencies { - compile 'com.github.simbiose:Encryption:v1.3.0' + compile 'com.github.simbiose:Encryption:1.3.0' } diff --git a/README.md b/README.md index ce570f4..9034264 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,35 @@ Encryption ===================== -Encryption is a simple way to create encrypted strings to Android project. +Encryption is a simple way to encrypt and decrypt strings on Android and Java project. [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-encryption-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/935) -#Java Users# - -I'm working at new version "1.3.0" and it will works both in Android and Java - #How to use# -1º Add the gradle dependency +1º Add [JitPack](https://jitpack.io/) to your build file +``` +allprojects { + repositories { + ... + maven { url "https://jitpack.io" } + } +} +``` + +2º Add the gradle dependency ``` -compile 'se.simbio.encryption:library:1.2.0' +compile 'se.simbio.encryption:library:1.3.0' ``` -2º a) Get an Encryption instance + +3º Use Encryption + +a) Get a default Encryption instance ``` Encryption encryption = Encryption.getDefault("YourKey", "YourSalt", yourByteIvArray); ``` -2º b) Or build a new Encryption instance + +b) Or build a custom Encryption instance ``` Encryption encryption = new Encryption.Builder() .setKeyLength(128) @@ -35,25 +45,28 @@ Encryption encryption = new Encryption.Builder() .setSecretKeyType("PBKDF2WithHmacSHA1") .build(); ``` -3º Encrypt your text + +4º Encrypt your text ``` String encrypted = encryption.encryptOrNull("Text to be encrypt"); ``` -4º Decrypt your text +5º Decrypt your text ``` String decrypted = encryption.decryptOrNull(encrypted); ``` +More examples see Examples folder, there is an Android and a Java project, or see the tests. + #FAQ# - What is Encryption library? - - Encryption library is an Open Source library to help encryption routines in Android applications, our target is to be simple and secure. + - Encryption library is an Open Source library to help encryption routines in Android and Java applications, our target is to be simple and secure. - What is the "IV", what should be my `yourByteIvArray` - Encryption 1.2+ uses by default the AES algorithm in CBC mode, so to encrypt and decrypt works you should have the same key and the same IV byte array to encrypt and to decrypt. An example of IV is `byte[] iv = {-89, -19, 17, -83, 86, 106, -31, 30, -5, -111, 61, -75, -84, 95, 120, -53};` like you can see, 16 bytes in a byte array. So if you want to use this library I recommend you create you own IV and save it :floppy_disk:. - - I Don't like null returns when errors occurs, what to do to handle errors? + - I Don't like null returns when errors occurs, what to do to handle errors? - You have the power to handle the exceptions, instead of uses `encryptOrNull` method just uses the `encrypt` method. The same for the `decryptOrNull`, just uses the `decrypt` method. - - I'm getting problems with main thread, what to do? + - I'm getting problems with main thread, what to do? - Encrypt routines can take time, so you can uses the `encryptAsync` with a `Encryption.Callback`to avoid ANR'S. The same for `decryptAsync` - I'm an older user, version 1.1 or less, what to do to update Encrypt to version 1.2+? - The library has several changes in his structure in version 1.2, both in algorithm and in code usage, so if you are an older user you need migrate the encrypted stuff or configure the `Builder` manually to the same parameters used in version 1.1 and olds.