"javax.crypto.BadPaddingException: Given final block not properly padded" is a vague message. more often than not, a bad key or password is responsible for the exception. We should hint at this in the exception message. See also : http://stackoverflow.com/questions/8049872/given-final-block-not-properly-padded