Crypto headaches.

Discussion in 'Python' started by SamG, Feb 18, 2009.

  1. SamG

    SamG Guest

    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
     
    SamG, Feb 18, 2009
    #1
    1. Advertising

  2. 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/
     
    M.-A. Lemburg, Feb 18, 2009
    #2
    1. Advertising

  3. SamG

    SamG Guest

    On Feb 18, 7:10 pm, "M.-A. Lemburg" <> wrote:
    > 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/


    That must be it...

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

    SamG
     
    SamG, Feb 18, 2009
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dano

    Oh those Transaction Headaches!

    Dano, Nov 17, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,652
    bruce barker
    Nov 17, 2003
  2. Stephajn Craig

    Impersonation headaches

    Stephajn Craig, Dec 16, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    488
    bruce barker
    Dec 17, 2003
  3. Eric
    Replies:
    5
    Views:
    907
  4. Alex Greenberg

    Publish Web Site Headaches

    Alex Greenberg, Jan 29, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    572
    gerry
    Jan 31, 2006
  5. D. Shane Fowlkes

    repost: headaches with formatting in VWD

    D. Shane Fowlkes, Mar 16, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    402
    Juan T. Llibre
    Mar 17, 2006
Loading...

Share This Page