Crypto headaches.

M.-A. Lemburg mal at egenix.com
Wed Feb 18 09:10:42 EST 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
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 18 2009)
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
________________________________________________________________________

::: Try our new mxODBC.Connect Python Database Interface for free ! ::::


   eGenix.com 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
               http://www.egenix.com/company/contact/



More information about the Python-list mailing list