I used AES with AES/CBC/PKCS5Padding with the following encryption and decryption code sections in Android:
cipher.init(Cipher.ENCRYPT_MODE, keySpec, new IvParameterSpec(IV1));
cipher.init(Cipher.DECRYPT_MODE, keySpec, new IvParameterSpec(IV2));
where IV1 and IV2 are randomly generated 16-byte initialization vectors. I did this to check if the original and decrypted texts will be different using different IVs in encryption and decryption parties. This leads the bytes of the decrypted text to be same as that of the original text after the first 16 bytes. For example if the original text is:
Enter your message here...
The decrypted text is:
*****************ge here...
where * denotes a wrongly decrypted byte as it should be as IV1 and IV2 are different.
My question is: What to do to encrypt and decrypt text with length greater than 16 bytes using AES with initialization vector?