This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am trying to encrypt and decrypt a message(String) using a given key string. For that, two seperate methods (one for encrypt and the other for decrypt) were called and when these methods are called from my applicaion. I am getting the below exception while decrypting. The encryption and decryption operations are working properly for the first time.Again if I call the methods with different message and key value it is throwing the below exception.
javax.crypto.BadPaddingException: Given final block not properly padded
I don't think that, there is a problem with data. Because using the same data (key and message) when I try to call the encrypt/decrypt methods it is working properly. Also if I call the methods from my application for the first time, it will work fine. Please help me to solve the issue......