public enum Crypto extends Enum<Crypto>
| Modifier and Type | Class and Description |
|---|---|
static class |
Crypto.HashType
Define a hash type enumeration for strong-typing
|
| Modifier and Type | Method and Description |
|---|---|
static String |
decryptAES(String value,
byte[] privateKey)
Decrypt a String with the AES encryption standard.
|
static String |
decryptAES(String value,
byte[] privateKey,
byte[] salt)
Decrypt a String with the AES encryption standard.
|
static String |
decryptAES(String value,
String privateKey)
Deprecated.
|
static String |
decryptAES(String value,
String privateKey,
String salt)
Deprecated.
|
static String |
encryptAES(String value,
byte[] privateKey)
Encrypt a String with the AES encryption standard.
|
static String |
encryptAES(String value,
byte[] privateKey,
byte[] salt)
Encrypt a String with the AES encryption standard.
|
static String |
encryptAES(String value,
String privateKey)
Deprecated.
|
static String |
encryptAES(String value,
String privateKey,
String salt)
Deprecated.
|
static String |
genRandomDigits()
Generate random digital string of random size range from 4 to 12 inclusive
|
static String |
genRandomDigits(int len)
Generate random digital string with the size specified.
|
static String |
genRandomStr()
Generate random string with random length from 4 to 12 inclusive
|
static String |
genRandomStr(int len)
Generate random String with readable characters.
|
static String |
genSecret()
Generate secret string using 4 bytes
|
static String |
genSecret(int len)
Generate a secret string from random byte array
|
static String |
passwordHash(String input)
Create a password hash using the default hashing algorithm
|
static String |
passwordHash(String input,
Crypto.HashType hashType)
Create a password hash using specific hashing algorithm
|
static void |
setCryptoService(CryptoService service) |
static String |
sign(String message,
byte[] key)
Sign a message with a key
|
static Crypto |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Crypto[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static Crypto[] values()
for (Crypto c : Crypto.values()) System.out.println(c);
public static Crypto valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static void setCryptoService(CryptoService service)
public static String sign(String message, byte[] key)
message - The message to signkey - The key to usepublic static String passwordHash(String input)
input - The passwordpublic static String passwordHash(String input, Crypto.HashType hashType)
input - The passwordhashType - The hashing algorithm@Deprecated public static String encryptAES(String value, String privateKey)
encryptAES(String, byte[]) instead
Encrypt a String with the AES encryption standard. Private key must have a length of 16 bytesvalue - The String to encryptprivateKey - The key used to encryptpublic static String encryptAES(String value, byte[] privateKey)
value - The String to encryptprivateKey - The key used to encrypt@Deprecated public static String encryptAES(String value, String privateKey, String salt)
encryptAES(String, byte[]) instead
Encrypt a String with the AES encryption standard. Private key must have a length of 16 bytesvalue - The String to encryptprivateKey - The key used to encryptsalt - The saltpublic static String encryptAES(String value, byte[] privateKey, byte[] salt)
value - The String to encryptprivateKey - The key used to encryptsalt - The salt@Deprecated public static String decryptAES(String value, String privateKey)
decryptAES(String, byte[]) instead
Decrypt a String with the AES encryption standard. Private key must have a length of 16 bytesvalue - An hexadecimal encrypted stringprivateKey - The key used to encryptpublic static String decryptAES(String value, byte[] privateKey)
value - An hexadecimal encrypted stringprivateKey - The key used to encrypt@Deprecated public static String decryptAES(String value, String privateKey, String salt)
decryptAES(String, byte[], byte[]) instead
Decrypt a String with the AES encryption standard. Private key must have a length of 16 bytesvalue - An hexadecimal encrypted stringprivateKey - The key used to encryptsalt - the saltpublic static String decryptAES(String value, byte[] privateKey, byte[] salt)
value - An hexadecimal encrypted stringprivateKey - The key used to encryptsalt - the saltpublic static String genSecret(int len)
len - the number of bytes used to generate the secretpublic static String genSecret()
public static String genRandomDigits(int len)
SecureRandomlen - the number of digits in the string generatedpublic static String genRandomDigits()
genRandomDigits(int)public static String genRandomStr(int len)
SecureRandomlen - the size of the string returnedpublic static String genRandomStr()
genRandomStr(int)Copyright © 2017. All Rights Reserved.