public class EncryptionUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
decrypt(String encryptedText,
String password)
Decrypts text and returns the readable clear text.
|
static String |
encrypt(String clearText,
String password)
Encrypt the clear text and adds a random salt.
|
static String |
encrypt(String clearText,
String password,
byte[] salt)
Encrypt the clear text with a defined salt.
|
static byte[] |
generateSalt()
Generates secure random bytes.
|
static byte[] |
generateSalt(int saltSize)
Generates secure random bytes.
|
static String |
getSalt(String encryptedText)
returns the stored salt (encoded) of a encrypted value
|
public static String decrypt(String encryptedText, String password) throws EncryptionException
encryptedText
- the encrypted string (required)password
- the password (required)EncryptionException
- in the event of an encryption failurepublic static String encrypt(String clearText, String password) throws EncryptionException
clearText
- the string to encrypt (required)password
- the password (required)EncryptionException
- in the event of an encryption failurepublic static String encrypt(String clearText, String password, byte[] salt) throws EncryptionException
clearText
- the string to encrypt (required)salt
- a predefined salt added to the clear text (required)password
- the password (required)EncryptionException
- in the event of an encryption failurepublic static byte[] generateSalt()
public static byte[] generateSalt(int saltSize)
saltSize
- the length for the salt in bytesCopyright © 2019 Communote team. All rights reserved.