public class AesUtil extends Object
参考自:jFinal AESKit,优化,方便使用
| Constructor and Description |
|---|
AesUtil() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decrypt(byte[] encrypted,
byte[] aesKey) |
static byte[] |
decrypt(byte[] content,
String aesTextKey) |
static byte[] |
decryptFormBase64(byte[] content,
String aesTextKey) |
static byte[] |
decryptFormBase64(String content,
String aesTextKey) |
static String |
decryptFormBase64ToString(String content,
String aesTextKey) |
static byte[] |
decryptFormHex(byte[] content,
String aesTextKey) |
static byte[] |
decryptFormHex(String content,
String aesTextKey) |
static String |
decryptFormHexToString(String content,
String aesTextKey) |
static byte[] |
decryptMysql(String input,
Function<String,byte[]> inputMapper,
String aesKey)
兼容 mysql 的 aes 加密
|
static byte[] |
decryptMysql(String input,
String aesKey)
兼容 mysql 的 aes 加密
|
static String |
decryptMysqlToString(String input,
Function<String,byte[]> inputMapper,
String aesKey)
兼容 mysql 的 aes 加密
|
static String |
decryptMysqlToString(String input,
String aesKey)
兼容 mysql 的 aes 加密
|
static String |
decryptToString(byte[] content,
String aesTextKey) |
static byte[] |
encrypt(byte[] content,
byte[] aesKey) |
static byte[] |
encrypt(byte[] content,
String aesTextKey) |
static byte[] |
encrypt(String content,
Charset charset,
String aesTextKey) |
static byte[] |
encrypt(String content,
String aesTextKey) |
static byte[] |
encryptMysql(String input,
String aesKey)
兼容 mysql 的 aes 加密
|
static <T> T |
encryptMysql(String input,
String aesKey,
Function<byte[],T> mapper)
兼容 mysql 的 aes 加密
|
static String |
encryptToBase64(byte[] content,
String aesTextKey) |
static String |
encryptToBase64(String content,
String aesTextKey) |
static String |
encryptToHex(byte[] content,
String aesTextKey) |
static String |
encryptToHex(String content,
String aesTextKey) |
static String |
genAesKey() |
static SecretKeySpec |
genMySqlAesKey(byte[] key)
转换成mysql aes
|
static SecretKeySpec |
genMySqlAesKey(String key)
转换成mysql aes
|
public static String genAesKey()
public static SecretKeySpec genMySqlAesKey(byte[] key)
key - keypublic static SecretKeySpec genMySqlAesKey(String key)
key - keypublic static byte[] encrypt(byte[] content,
String aesTextKey)
@Nullable public static String decryptFormHexToString(@Nullable String content, String aesTextKey)
@Nullable
public static byte[] decryptFormHex(@Nullable
String content,
String aesTextKey)
public static byte[] decryptFormHex(byte[] content,
String aesTextKey)
@Nullable public static String decryptFormBase64ToString(@Nullable String content, String aesTextKey)
@Nullable
public static byte[] decryptFormBase64(@Nullable
String content,
String aesTextKey)
public static byte[] decryptFormBase64(byte[] content,
String aesTextKey)
public static byte[] decrypt(byte[] content,
String aesTextKey)
public static byte[] encrypt(byte[] content,
byte[] aesKey)
public static byte[] decrypt(byte[] encrypted,
byte[] aesKey)
public static byte[] encryptMysql(String input, String aesKey)
input - inputaesKey - aesKeypublic static <T> T encryptMysql(String input, String aesKey, Function<byte[],T> mapper)
T - 泛型标记input - inputaesKey - aesKeypublic static byte[] decryptMysql(String input, String aesKey)
input - inputaesKey - aesKeypublic static byte[] decryptMysql(String input, Function<String,byte[]> inputMapper, String aesKey)
input - inputaesKey - aesKeypublic static String decryptMysqlToString(String input, Function<String,byte[]> inputMapper, String aesKey)
input - inputinputMapper - FunctionaesKey - aesKeyCopyright © 2024. All rights reserved.