public class AESUtil extends Object
| 构造器和说明 |
|---|
AESUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
bytesToHex(byte[] bytes)
byte数组转16进制字符串
|
static String |
decrypt(byte[] content,
String decryptKey)
解密
|
static String |
decryptWithBase64(String encryptStr,
String decryptKey)
解密Base64 code AES密文
|
static String |
decryptWithHex(String encryptStr,
String decryptKey)
解密 16进制code AES密文
|
static byte[] |
encrypt(String content,
String encryptKey)
加密
|
static String |
encryptWithBase64(String content,
String encryptKey)
AES加密为base 64 code
|
static String |
encryptWithHex(String content,
String encryptKey)
AES加密为16进制 code字符串
|
static byte[] |
hexToByteArray(String inHex)
hex字符串转byte数组
|
public static String encryptWithBase64(String content, String encryptKey) throws Exception
content - 待加密的内容encryptKey - 加密密钥Exception - 异常信息public static String decryptWithBase64(String encryptStr, String decryptKey) throws Exception
encryptStr - 待解密的base 64 codedecryptKey - 解密密钥Exception - 异常信息public static String encryptWithHex(String content, String encryptKey) throws Exception
content - 待加密的内容encryptKey - 加密密钥Exception - 异常信息public static String decryptWithHex(String encryptStr, String decryptKey) throws Exception
encryptStr - 待解密的16进制code AES字符串decryptKey - 解密密钥Exception - 异常信息public static byte[] encrypt(String content, String encryptKey) throws Exception
content - 待加密的内容encryptKey - 加密密钥Exception - 异常信息public static String decrypt(byte[] content, String decryptKey) throws Exception
content - 待解密的内容字节数组decryptKey - 解密密钥Exception - 异常信息public static String bytesToHex(byte[] bytes)
bytes - byte数组public static byte[] hexToByteArray(String inHex)
inHex - 16进制字符串Copyright © 2019. All rights reserved.