I searched this forum and couldn't find anything that explained my exact situation so here it is....
I am trying to decrypt some data and I end up with 0 bytes padded at the end. Any idea what I am doing wrong? Here is my decrypt() method:
protected final byte[] decrypt( final byte[] key, final byte[] value )
throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec( key, "AES" );
Cipher cipher = Cipher.getInstance( "AES/ECB/NoPadding" );
cipher.init( Cipher.DECRYPT_MODE, skeySpec );
byte[] buffer = new byte[cipher.getOutputSize( value.length )];
int size = cipher.update( value, 0, value.length, buffer, 0 );
size += cipher.doFinal( buffer, size );
byte[] trimmed = new byte[size];
System.arraycopy( buffer, 0, trimmed, 0, size );
return trimmed;
}