AES decrypt byte array - Android java.security

Android examples for java.security:AES

Description

AES decrypt byte array

Demo Code


//package com.java2s;

import javax.crypto.Cipher;

import javax.crypto.spec.SecretKeySpec;

public class Main {
    private static byte[] decrypt(byte[] key, byte[] src) throws Exception {
        SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
        cipher.init(Cipher.DECRYPT_MODE, skeySpec);
        return cipher.doFinal(src);
    }/*from  w w  w  .  j  a  va  2  s  . c om*/
}

Related Tutorials