public final class AESCrypt
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG_LOG_ENABLED |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decrypt(javax.crypto.spec.SecretKeySpec key,
byte[] iv,
byte[] decodedCipherText)
More flexible AES decrypt that doesn't encode
|
static java.lang.String |
decrypt(java.lang.String password,
java.lang.String base64EncodedCipherText)
Decrypt and decode ciphertext using 256-bit AES with key generated from password
|
static byte[] |
encrypt(javax.crypto.spec.SecretKeySpec key,
byte[] iv,
byte[] message)
More flexible AES encrypt that doesn't encode
|
static java.lang.String |
encrypt(java.lang.String password,
java.lang.String message)
Encrypt and encode message using 256-bit AES with key generated from password.
|
public static java.lang.String encrypt(java.lang.String password,
java.lang.String message)
throws java.security.GeneralSecurityException
password - used to generated keymessage - the thing you want to encrypt assumed String UTF-8java.security.GeneralSecurityException - if problems occur during encryptionpublic static byte[] encrypt(javax.crypto.spec.SecretKeySpec key,
byte[] iv,
byte[] message)
throws java.security.GeneralSecurityException
key - AES key typically 128, 192 or 256 bitiv - Initiation Vectormessage - in bytes (assumed it's already been decoded)java.security.GeneralSecurityException - if something goes wrong during encryptionpublic static java.lang.String decrypt(java.lang.String password,
java.lang.String base64EncodedCipherText)
throws java.security.GeneralSecurityException
password - used to generated keybase64EncodedCipherText - the encrpyted message encoded with base64java.security.GeneralSecurityException - if there's an issue decryptingpublic static byte[] decrypt(javax.crypto.spec.SecretKeySpec key,
byte[] iv,
byte[] decodedCipherText)
throws java.security.GeneralSecurityException
key - AES key typically 128, 192 or 256 bitiv - Initiation VectordecodedCipherText - in bytes (assumed it's already been decoded)java.security.GeneralSecurityException - if something goes wrong during encryption