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

byte[]decrypt(byte[] raw, byte[] encrypted)
decrypt
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decrypted = cipher.doFinal(encrypted);
return decrypted;
Stringdecrypt(Context context, String encrypted)
decrypt
SecretKey skeySpec = generateKey(getSeed(context),
        "edu.uoc.esquelet.app".getBytes());
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decordedValue = Base64.decode(encrypted.getBytes(),
        Base64.DEFAULT);
byte[] decValue = cipher.doFinal(decordedValue);
String decryptedValue = new String(decValue);
...
Stringdecrypt(Context context, String encrypted)
decrypt
SecretKey skeySpec = generateKey(getSeed(context),
        "edu.uoc.skeleton".getBytes());
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decordedValue = Base64.decode(encrypted.getBytes(),
        Base64.DEFAULT);
byte[] decValue = cipher.doFinal(decordedValue);
String decryptedValue = new String(decValue);
...
Stringdecode(String seed, String encrypted)
decode
byte[] rawKey = getRawKey(seed.getBytes());
byte[] enc = toByte(encrypted);
byte[] result = decrypt(rawKey, enc);
return new String(result);
byte[]decrypt(byte[] raw, byte[] encrypted)
decrypt
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decrypted = cipher.doFinal(encrypted);
return decrypted;
StringdecryptedData(String userkey, String encryptedData)
decrypted Data
String decryptedUserData = "";
try {
    String key = getAppPassCode(userkey);
    Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, aesKey);
    byte[] userData = cipher.doFinal(encryptedData
            .getBytes(ENCODING));
...
StringdecryptedPassword(String key, String encryptedData)
decrypted Password
String decryptedUserData = "";
try {
    Key aesKey = new SecretKeySpec(key.getBytes(), "AES");
    Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, aesKey);
    byte[] userData = cipher.doFinal(encryptedData
            .getBytes(ENCODING));
    decryptedUserData = new String(userData);
...