java.lang.Object
develop.toolkit.base.utils.CryptAdvice.AES
- Enclosing class:
- CryptAdvice
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateSecretKeyAndIv(CryptAdvice.AES.KeyLength keyLength) 创建密钥和ivcreateSecretKeyAndIvByPassword(CryptAdvice.AES.KeyLength keyLength, String password, String salt) 根据密码创建密钥和ivstatic String解密static String加密
-
Constructor Details
-
AES
public AES()
-
-
Method Details
-
createSecretKeyAndIv
创建密钥和iv- Parameters:
keyLength- 密钥长度- Returns:
- 密钥
-
createSecretKeyAndIvByPassword
public static TwoValues<String,String> createSecretKeyAndIvByPassword(CryptAdvice.AES.KeyLength keyLength, String password, String salt) 根据密码创建密钥和iv- Parameters:
keyLength- 密钥长度password- 密码salt- 盐- Returns:
- 密钥
-
encrypt
public static String encrypt(String original, String secretKeyBase64, String ivBase64) throws CryptException 加密- Parameters:
original- 原文secretKeyBase64- base64密钥ivBase64- base64 iv- Returns:
- 密文
- Throws:
CryptException
-
decrypt
public static String decrypt(String cipherText, String secretKeyBase64, String ivBase64) throws CryptException 解密- Parameters:
cipherText- 密文secretKeyBase64- base64密钥ivBase64- base64 iv- Returns:
- 原文
- Throws:
CryptException
-