Crypto headaches.

M.-A. Lemburg mal at
Wed Feb 18 15:10:42 CET 2009

On 2009-02-18 14:23, SamG wrote:
> Hi,
> Using the python's Crypto.Cipher.Blowfish is create and encrypted file
> in the CBC mode. Now... when try to decrypt it with OpenSSL i get an
> error stating "bad magic number".

Are you getting the error message from openssl ? It looks a lot
like an error message from Python.

> I tried
> $ cat encr-file | openssl bf-cbc -d -pass pass:sam > org-file
> or
> $ openssl bf-cbc -d -pass pass:sam -in encr-file -out org-file
> BTW, decryption using a python code works well. But i m of the
> impression a file encry with one program should/can be decrypt with
> another program (in my case openssl) using the same parameters.

Ideally, that should work, but you also have to make sure that
the following two details are the same for both applications:

 1. the way padding is done (Blowfish is a block cipher)

 2. the way the initialization vector is set

Otherwise the two won't interoperate properly.

Marc-Andre Lemburg

Professional Python Services directly from the Source  (#1, Feb 18 2009)
>>> Python/Zope Consulting and Support ...
>>> mxODBC.Zope.Database.Adapter ...   
>>> mxODBC, mxDateTime, mxTextTools ...

::: Try our new mxODBC.Connect Python Database Interface for free ! :::: Software, Skills and Services GmbH  Pastor-Loeh-Str.48
    D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
           Registered at Amtsgericht Duesseldorf: HRB 46611

More information about the Python-list mailing list