Skip to content

Releases: alkathirikhalid/security

Security

23 Apr 14:56
Compare
Choose a tag to compare

A utility for secure one-way and two-way encryption.

AES (encrypt / decrypt)

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 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 this can easily be generate as explain previously on IV.

SaltAndHash

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