public class AesAlgorithm extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BLOCK_SIZE |
| Constructor and Description |
|---|
AesAlgorithm() |
| Modifier and Type | Method and Description |
|---|---|
static Blob |
decrypt(Blob keyBits,
Blob encryptedData,
EncryptParams params)
Decrypt the encryptedData using the keyBits according the encrypt params.
|
static EncryptKey |
deriveEncryptKey(Blob keyBits)
Derive a new encrypt key from the given decrypt key value.
|
static Blob |
encrypt(Blob keyBits,
Blob plainData,
EncryptParams params)
Encrypt the plainData using the keyBits according the encrypt params.
|
static DecryptKey |
generateKey(AesKeyParams params)
Generate a new random decrypt key for AES based on the given params.
|
public static final int BLOCK_SIZE
public static DecryptKey generateKey(AesKeyParams params)
params - The key params with the key size (in bits).public static EncryptKey deriveEncryptKey(Blob keyBits)
keyBits - The key value of the decrypt key.public static Blob decrypt(Blob keyBits, Blob encryptedData, EncryptParams params) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException
keyBits - The key value.encryptedData - The data to decrypt.params - This decrypts according to params.getAlgorithmType() and
other params as needed such as params.getInitialVector().NoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionInvalidAlgorithmParameterExceptionpublic static Blob encrypt(Blob keyBits, Blob plainData, EncryptParams params) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException, InvalidAlgorithmParameterException
keyBits - The key value.plainData - The data to encrypt.params - This encrypts according to params.getAlgorithmType() and
other params as needed such as params.getInitialVector().NoSuchAlgorithmExceptionNoSuchPaddingExceptionInvalidKeyExceptionIllegalBlockSizeExceptionBadPaddingExceptionInvalidAlgorithmParameterExceptionCopyright © 2019. All rights reserved.