More Binary when Decrypt binary by AES in Java

i want to decrypt binary ciphertext, but when i'm try to decrypt , it was failed.

i'm check the binary and convert to HEX, it was padding 00 in Hex.

here is my code

private final byte[] key;

private static final String ALGORITHM = "AES";

public AES_Algorithm(byte[] key)

{

this.key = key;

}

/**

* Encrypts the given plain text

*

* @param plainText The plain text to encrypt

* @return

* @throws java.lang.Exception

*/

public byte[] encrypt(byte[] plainText) throws Exception

{

SecretKeySpec secretKey = new SecretKeySpec(key, ALGORITHM);

Cipher cipher = Cipher.getInstance(ALGORITHM);

cipher.init(Cipher.ENCRYPT_MODE, secretKey);

return cipher.doFinal(plainText);

}

/**

* Decrypts the given byte array

*

* @param cipherText The data to decrypt

* @return

*...

Read More »

By: StackOverFlow - Wednesday, 14 March

Related Posts