This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Hallo alls! I am using blowfish in a program in two different instances. In the first, I encrypt sensitive data in a database. In the second, I am ecrypting a batch file for transfer to a third party server. The data coming from a Linux machine is not decrypted/encrypted the same as the data coming from a Windows machine. Thus, if I transfer a database from a Linux machine to a Windows machine, or vice-versa, the program is unable to decrypt the data correctly.
In the case of the third party server, it is a Windows machine, so if I create the batch file and encrypt it on a Linux machine and send the file to the server, they are unable to decrypt it. When I get a response back from the server, my program is unable to decrypt it correctly. I don't get any error's in the Blowfish routine's themselves; it is just the output that is incorrect.
I have searched online for a solution to this problem, but so far, I have come up empty handed.
Has anyone else come across this problem? I would really appreciate any help that I can get on this issue.
I am running Java 1.4.2_05, and I am using the BlowfishJ library. In each instance, I am using CBC mode with a 64 byte key.
TIA, robert w. dumond
Joined: Aug 07, 2003
Just in case someone runs across this same problem, here is what needs to be done for blowfish to work properly across platforms.
Before you encrypt the string, you will need to first Base64 Encode the string and the URLEncode that string.
To decrypt, first decrypt the string, URLDecode the decrypted string, and then Base64 decode that string.