public final class AESCrypto
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 appToken,
java.lang.String jsonFile)
Decrypt and decode ciphertext using 256-bit AES with key generated from appToken
|
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 token,
java.lang.String json)
Encrypt and encode json using 256-bit AES with key generated from token.
|
public static final boolean DEBUG_LOG_ENABLED
public static java.lang.String encrypt(java.lang.String token,
java.lang.String json)
throws java.security.GeneralSecurityException
token - used to generated keyjson - 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 appToken,
java.lang.String jsonFile)
throws java.security.GeneralSecurityException
appToken - used to generated keyjsonFile - 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