I am able to encrypt data however when decrypting it i am getting the following error:
Error
HTTP Status 500 - Request processing failed
The problem is with the way you are creating String
instances out of the raw encrypted byte[]
data. You need to either use binhex encoding like that provided by javax.xml.bind.DatatypeConverter via the parseHexBinary
and printHexBinary
methods or base 64 using the parseBase64Binary
and printBase64Binary
methods of the same object.
One other word of advice, never rely on the default mode and padding, always be explicit. Use something like Cipher.getInstance("Blowfish/CBC/PKCS5Padding")
depending on what your needs are.