List of utility methods to do AES Decrypt
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; |
String | decrypt(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); ... |
String | decrypt(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); ... |
String | decode(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; |
String | decryptedData(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)); ... |
String | decryptedPassword(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); ... |