public class AesUtil extends Object
| Constructor and Description |
|---|
AesUtil() |
| Modifier and Type | Method and Description |
|---|---|
static Key |
convertSecretKey(byte[] keyBytes)
转换encoded key
|
static byte[] |
decrypt(byte[] content,
byte[] secret,
int length) |
static byte[] |
encrypt(byte[] content,
byte[] secret,
int length) |
static Cipher |
getCipher()
get aes cipher
|
public static Key convertSecretKey(byte[] keyBytes) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException
keyBytes - xxxInvalidKeyException - xxxNoSuchAlgorithmException - xxxInvalidKeySpecException - xxxpublic static Cipher getCipher() throws NoSuchPaddingException, NoSuchAlgorithmException
NoSuchPaddingException - xxxNoSuchAlgorithmException - xxxpublic static byte[] encrypt(byte[] content,
byte[] secret,
int length)
throws NoSuchProviderException,
NoSuchAlgorithmException,
InvalidKeySpecException,
InvalidKeyException,
BadPaddingException,
IllegalBlockSizeException,
NoSuchPaddingException
public static byte[] decrypt(byte[] content,
byte[] secret,
int length)
throws NoSuchProviderException,
NoSuchAlgorithmException,
InvalidKeySpecException,
InvalidKeyException,
BadPaddingException,
IllegalBlockSizeException,
NoSuchPaddingException
Copyright © 2019. All rights reserved.