项目作者: abdullahselek

项目描述 :
AES-Encryption is a Java class for encrypting and decrypting strings in Android with AES.
高级语言: Java
项目地址: git://github.com/abdullahselek/AES-Encryption.git
创建时间: 2015-06-08T16:56:08Z
项目社区:https://github.com/abdullahselek/AES-Encryption

开源协议:MIT License

下载


AES-Encryption

AES-Encryption is a Java class for encrypting and decrypting strings in Android with AES.

First initialize your own AESEncryption class variable with a password key. Then you can use encrypt and decrypt methods as below.

Installation

Gradle

Add it in your root build.gradle at the end of repositories

  1. repositories {
  2. maven { url "https://jitpack.io" }
  3. }

Add the dependency

  1. dependencies {
  2. compile 'com.github.abdullahselek:AES-Encryption:0.1'
  3. }

Maven

  1. <repositories>
  2. <repository>
  3. <id>jitpack.io</id>
  4. <url>https://jitpack.io</url>
  5. </repository>
  6. </repositories>

Add the dependency

  1. <dependency>
  2. <groupId>com.github.abdullahselek</groupId>
  3. <artifactId>AES-Encryption</artifactId>
  4. <version>0.1</version>
  5. </dependency>

Example Usage

  • Initialization of AESEncryption class

    1. String passwordKey = "abdullahselek";
    2. AESEncryption aesEncryption = new AESEncryption(passwordKey);
  • For encryption

    1. String encryptedText = aesEncryption.encrypt("encrypt it");
  • For decryption

    1. String decryptedText = aesEncryption.decrypt(encryptedText);

Information

If you get Illegal key size or default parameters error from Java Cipher class you can download two .jar files supported by Oracle according to your jre version. And add to your ${java.home}/jre/lib/security/ folder.

Related StackOverflow link