Encryption and Decryption using Blowfish Error - Input length must be multiple of 8 when decrypting with padded cipher

后端 未结 3 1122
囚心锁ツ
囚心锁ツ 2021-02-06 19:59

I am able to encrypt data however when decrypting it i am getting the following error:

Error

HTTP Status 500 - Request processing failed         


        
3条回答
  •  一生所求
    2021-02-06 20:08

    You can't create a String out of random (in this case encrypted) bytes like you're doing in the last line of your encrypt method - you need to create a Base64 encoded string instead (which you then need to decode back to a byte array in the decrypt method). Alternatively, just have your encrypt method return a byte array and have your decrypt method accept a byte array as its parameter.

提交回复
热议问题