Android Utililty Methods AES Decrypt

List of utility methods to do AES Decrypt

Description

The list of methods to do AES Decrypt are organized into topic(s).

Method

Stringdecrypt(String src)
decrypt
return decrypt(DEFAULT_KEY, src);
byte[]decrypt(byte[] content, String key)
decrypt
try {
    Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
    IvParameterSpec ivs = new IvParameterSpec(defaultIV);
    cipher.init(Cipher.DECRYPT_MODE, getSecretKey(key), ivs);
    return cipher.doFinal(content);
} catch (Exception e) {
    e.printStackTrace();
return null;
byte[]decrypt(byte[] content, String password)
decrypt
try {
    SecretKeySpec key = createKey(password);
    Cipher cipher = Cipher.getInstance(CipherMode);
    cipher.init(Cipher.DECRYPT_MODE, key);
    byte[] result = cipher.doFinal(content);
    return result;
} catch (Exception e) {
    e.printStackTrace();
...
byte[]decrypt(byte[] content, String password)
decrypt
try {
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    kgen.init(128, new SecureRandom(password.getBytes()));
    SecretKey secretKey = kgen.generateKey();
    byte[] enCodeFormat = secretKey.getEncoded();
    SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, key);
...
byte[]decrypt(byte[] content, String password)
decrypt
try {
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    kgen.init(128, new SecureRandom(password.getBytes()));
    SecretKey secretKey = kgen.generateKey();
    byte[] enCodeFormat = secretKey.getEncoded();
    SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, key);
...
byte[]decrypt(byte[] content, String password)
decrypt
byte[] result = null;
try {
    SecretKeySpec key = new SecretKeySpec(
            getRawKey(password.getBytes()), "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, key);
    result = cipher.doFinal(content);
} catch (Exception e) {
...
byte[]decrypt(byte[] content, String password)
decrypt
try {
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    kgen.init(128, new SecureRandom(password.getBytes()));
    SecretKey secretKey = kgen.generateKey();
    byte[] enCodeFormat = secretKey.getEncoded();
    SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, key);
...
byte[]decrypt(byte[] data, Key key)
decrypt
return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);
byte[]decrypt(byte[] data, Key key, String cipherAlgorithm)
decrypt
Cipher cipher = Cipher.getInstance(cipherAlgorithm);
cipher.init(Cipher.DECRYPT_MODE, key);
return cipher.doFinal(data);
byte[]decrypt(byte[] data, byte[] key)
decrypt
return decrypt(data, key, DEFAULT_CIPHER_ALGORITHM);