Android examples for java.security:AES
decrypt AES/ECB/PKCS5Padding
import android.annotation.SuppressLint; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Main{ //from w ww . ja v a2 s . com private static String decrypt(String input, int index) { byte[] output = null; try { SecretKeySpec skey = new SecretKeySpec( DynamicEncryptUtil.findkeyBySortNum(index), "AES"); Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, skey); output = cipher.doFinal(Base64.decode(input)); // output = CryptionUtil.decrypt(Base64.decode(input), index, PayApp.pay); return new String(output, "UTF-8"); } catch (Exception e) { } return ""; } }