A utility for secure one-way and two-way encryption.
Advanced Encryption Standard utility. Provides a way to Encrypt and Decrypt texts. It is important to note this utility class is only applicable for UTF input types and more secure ways might be required for different applications.
Quick Usage:AES.encrypt(plainText, encryptionKey, IV);
AES.decrypt(cipherText, encryptionKey, IV);
The IV is a random text that prevents the same plaintext from always being transformed into the same ciphertext it can either be passed into the encrypt method or be generated SaltAndHash.getSalt().substring(0, 16);
. The Class also has a self adjust private inner class checkAndPatch(plainText)
That allows an input text of a value other than 16 bytes or 128 bits to be encrypted, both the encryptionKey
and IV
still needs to be 16 bytes or 128 bits these can easily be generated.
Provides a way to get salt and hash passwords. It is important to note this utility class is configurable based on the standard hashing algorithms provided by the Java MessageDigest for SHA-1, SHA-256, SHA-384, SHA-512.
Quick Usage:SaltAndHash.getSalt();
SaltAndHash.hashPassword(password, salt)
// Default "SHA-512"SaltAndHash.hashPassword(password, salt, messageDisgest)
// Pass a hashing algorithms that is required
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.alkathirikhalid:security:v1.01'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.alkathirikhalid</groupId>
<artifactId>security</artifactId>
<version>v1.01</version>
</dependency>
- Document download: https://github.com/alkathirikhalid/security/releases/download/v1.01/apidocs.zip
- Jar download: https://github.com/alkathirikhalid/security/releases/download/v1.01/Security-v1.01.jar
Copyright 2015 Al-Kathiri Khalid www.alkathirikhalid.com
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.