@ThreadSafe public final class AES extends BaseSecuritySupport
| 构造器和说明 |
|---|
AES() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decrypt(String cipherText,
String aesKey)
解密
|
static String |
decryptSilently(String cipherText,
String aesKey) |
static String |
encrypt(String plainText,
String aesKey)
加密
|
static String |
encryptSilently(String content,
String aesKey) |
static String |
generateKey()
获取AES密钥
|
static String |
generateKeySilently() |
static String |
simpleDecrypt(String cipherText,
String aesKey)
解密
|
static String |
simpleDecryptSilently(String cipherText,
String aesKey) |
static String |
simpleEncrypt(String plainText,
String aesKey)
加密
|
static String |
simpleEncryptSilently(String content,
String aesKey) |
public static String generateKeySilently()
generateKey()public static String generateKey() throws NoSuchAlgorithmException
NoSuchAlgorithmException - 当算法不存在时抛出public static String encryptSilently(String content, String aesKey)
encrypt(String, String)public static String encrypt(String plainText, String aesKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
plainText - 明文aesKey - 密钥NoSuchAlgorithmException - 当算法不存在时抛出NoSuchPaddingException - 当填充模式不存在时抛出InvalidKeyException - 当密钥不合法时抛出IllegalBlockSizeException - IllegalBlockSizeExceptionBadPaddingException - BadPaddingExceptionpublic static String decryptSilently(String cipherText, String aesKey)
encrypt(String, String)public static String decrypt(String cipherText, String aesKey) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException
cipherText - 密文aesKey - 密钥NoSuchAlgorithmException - 当算法不存在时抛出NoSuchPaddingException - 当填充模式不存在时抛出InvalidKeyException - 当密钥不合法时抛出InvalidAlgorithmParameterException - 当算法参数不合法时抛出IllegalBlockSizeException - IllegalBlockSizeExceptionBadPaddingException - BadPaddingExceptionpublic static String simpleEncrypt(String plainText, String aesKey) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
plainText - 明文aesKey - 密钥NoSuchAlgorithmException - 当算法不存在时抛出NoSuchPaddingException - 当填充模式不存在时抛出InvalidKeyException - 当密钥不合法时抛出IllegalBlockSizeException - IllegalBlockSizeExceptionBadPaddingException - BadPaddingExceptionpublic static String simpleDecrypt(String cipherText, String aesKey) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException
cipherText - 密文aesKey - 密钥NoSuchAlgorithmException - 当算法不存在时抛出NoSuchPaddingException - 当填充模式不存在时抛出InvalidKeyException - 当密钥不合法时抛出IllegalBlockSizeException - IllegalBlockSizeExceptionBadPaddingException - BadPaddingExceptionCopyright © 2023. All rights reserved.