We have provided an API to our clinet, which they use to encrypt the string and they will send the encrypted string as request parameter to our end.
On receiving the string we will decrypt the string before processing further.
But while decrypting we receive the below error.
Client use JDK 1.6 to encrypt and we use JDK 1.5 at our end to decrypt
javax.crypto.BadPaddingException: Given final block not properly padded
Line 84 is byte  ciphertext=cipher.doFinal(results);
Either the base64 encoded ciphertext is getting corrupted in some way or more likely the wrong key is being used for decryption. For test purposes you should dump the bytes of the key after reading them.
P.S. Using the bytes of the key as the IV is not considered good practice.
P.P.S. your code
can be replaced by the single line
P.P.P.S. That exception handling is poor. If you fail to read the key then it is fatal and you cannot continue!
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com