public class AesEncryptUtil extends Object
Description:
| 构造器和说明 |
|---|
AesEncryptUtil() |
| 限定符和类型 | 方法和说明 |
|---|---|
static byte[] |
decrypt(byte[] content,
byte[] key,
byte[] iv)
进行解密运算
content: 由AES 和key ,iv 加密运算的加密串
key: 加密时的key
iv: 加密时的iv
|
static String |
decrypt(String content,
String key,
String iv)
解密运算
content 由key,iv 加密后经过base64处理的字符串
|
static byte[] |
encrypt(byte[] content,
byte[] key,
byte[] iv)
加密
content 需要加密的byte数组
key 需要加密时的密钥, 自定义
iv 加密时的向量, 可自定义 但必须为16位
|
static String |
encrypt(String content,
String key,
String iv)
加密字符串
|
public static String encrypt(String content, String key, String iv) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, UnsupportedEncodingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
content - 需要加密的内容key - 加密密钥 keyiv - 加密向量 16位InvalidKeyExceptionNoSuchAlgorithmExceptionNoSuchPaddingExceptionUnsupportedEncodingExceptionInvalidAlgorithmParameterExceptionIllegalBlockSizeExceptionBadPaddingExceptionpublic static byte[] encrypt(byte[] content,
byte[] key,
byte[] iv)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchPaddingException,
UnsupportedEncodingException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException
public static String decrypt(String content, String key, String iv) throws InvalidKeyException, NoSuchAlgorithmException, NoSuchPaddingException, UnsupportedEncodingException, InvalidAlgorithmParameterException, IllegalBlockSizeException, BadPaddingException
public static byte[] decrypt(byte[] content,
byte[] key,
byte[] iv)
throws InvalidKeyException,
NoSuchAlgorithmException,
NoSuchPaddingException,
UnsupportedEncodingException,
InvalidAlgorithmParameterException,
IllegalBlockSizeException,
BadPaddingException
Copyright © 2020. All rights reserved.