aspose file tools*
The moose likes Java in General and the fly likes Blowfish on Windows and Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Blowfish on Windows and Linux" Watch "Blowfish on Windows and Linux" New topic
Author

Blowfish on Windows and Linux

robert dumond
Greenhorn

Joined: Aug 07, 2003
Posts: 2
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
robert dumond
Greenhorn

Joined: Aug 07, 2003
Posts: 2
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.

Thanks,
rwd
 
 
subject: Blowfish on Windows and Linux