Blowfish decryption problem
Edgar Marco Florensa <[email protected]>
| Newsgroups | gmane.comp.python.cryptography |
|---|---|
| Message-ID | <003601c7490a$49dadfd0$ab00a8c0@Edgar> |
Hi all, I have a problem trying to decrypt Blowfish-encrypted data. I'll try to explain as much as possible all the details, hoping anyone in this list can help me. I am doing some tests, and I encrypt data (actually a C struct) with Eric Young's implementation of Blowfish in C, using the cfb mode. I send this data over an Ethernet network, and I capture it on the wire using Wireshark. My problem is basically that when I try to decrypt this captured data using PyCrypto in Python 2.4, I don't get the expected results. For decrypting, I generate a Blowfish object, with the key and the IV used for encryption. I decrypt data, and after I unpack it using the function unpack included in the struct module. I've tried both with big endian and little endian modes. I'm quite new both in cryptography and in Python, so I guess I'm doing something wrong. I've detected something which makes no sense for me. Maybe it can help to detect my problem. When I encrypt the data (the struct), the first 8 bytes are two UINT 32. In the plain data the first one is changing, but the second one (bytes 5 to 8) is always the same. In the encrypted data, these bytes (5 to 8) are also always the same (I consider this normal, since the first 8 bytes use the key and the IV for being encrypted). However, if I encrypt the same plain data using PyCrypto, the bytes 5 to 8 of the encrypted data change if the first four bytes change. I'm always restarting the encrypting/decrypting object after encrypting/decrypting a struct. I guess this difference in encrypting the data has something to do with the fact of being unable to decrypt the data I capture. Any solutions or ideas why is this happening? Regards, Edgar Marco