# Why is there an extra block when encrypting?

I am passing input data 20 bytes long and java AES-CBC returns 48 bytes instead of 32 which is what I think it should output because of padding. My key is 16 bytes long.

  byte[] ciphertext;

enc.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"), new IvParameterSpec(vector));
ciphertext = encrypt.doFinal(data.getbytes("UTF-8"));

-
Could you show the content of the data variable? –  Nova Nov 9 '14 at 11:17
In particular if data is String, it cannot be 20 bytes. Java String contains char and Java char is NOT a byte, although it SOMETIMES encodes as one. If you mean it has 20 chars, probably some of them are >=U+0080 and therefore encode to multiple bytes, enough to make the total at least 32 bytes. –  dave_thompson_085 Nov 9 '14 at 12:55
data is c6be25d903159d680d81f3d99bb702451e9f7158 and is stored as byte[] data= c6be25d903159d680d81f3d99bb702451e9f7158.get bytes() –  ds123456 Nov 9 '14 at 14:38
Identical question on SO: stackoverflow.com/questions/26824828/… –  Artjom B. Nov 9 '14 at 14:47