On one side I have a texts encrypted/decrypted with Perl's Crypt::CBC
my $key = 'key to the gates';
my $cipher = Crypt::CBC->new(
-key => $key,
-cipher => 'Blowfish',
-salt => '12341234'
);
On the other side I have Python's PyCrypto that I need to decode the data from Perl, but also send text that the Perl cipher can read given the encryption.
I have the key from the Perl program, and encrypt_hex:ed passphrases from Perl sent to the Python system.
But Python seems to absolutely want to have the IV to do its job
cipher = Blowfish.new( self.key, Blowfish.MODE_CBC, self.iv )
return hexlify(cipher.encrypt(raw))
However, the Crypt::CBC
documnetation seems to indicate that the IV is there already
"salt" -- Combine the passphrase with an 8-byte random value to generate both the block cipher key and the IV from the provided passphrase. The salt will be appended to the beginning of the data stream allowing decryption to regenerate both the key and IV given the correct passphrase.
Is there any way to extract the IV from the key/passphrase via PyCrypto? Or does IV have to be sent separately in some way?
This might be a naive question but I don't work with this every day.
I know I can get the IV from the Perl side, but I really want to extract it on Python side if possible.