Crypto headaches.

S

SamG

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".

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.

Pls help.

SamG
 
M

M.-A. Lemburg

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)________________________________________________________________________

::: 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/
 
S

SamG

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



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/

________________________________________________________________________

::: 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/

That must be it...

But given a password how do i generate a (key, IV) pair???

SamG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top