[pycrypto] pycryptodome

Martin Falatic martin at falatic.com
Sun Dec 11 15:11:05 UTC 2016


Looks like you got it working!

 - Marty

On Sun, December 11, 2016 05:41, Dave Pawson wrote:
> On 11 December 2016 at 13:22, Martin Falatic <martin at falatic.com> wrote:
>
>
>> As for how to check for exactly what pycrypto you have installed and
>> where, and how to remove them, refer to my previous email. I went into
>> great detail on exactly how to do that properly. Doesn't look like
>> you've done those steps yet.
>
>
> Not helpful?
> print(Crypto.version_info) (3, 4, 3)
>
>
> print(Crypto.version_info) (3, 4, 3)
>
>>>> Crypto.__package__
>>>>
> 'Crypto'
>
>>>> Crypto.__path__
>>>>
> ['/usr/lib64/python3.5/site-packages/Crypto']
>
>
> is more helpful, though since this is pycryptodome, that name would be
> more useful don't you think?
>
> regards
>
>
>>
>> On Sun, December 11, 2016 02:56, Dave Pawson wrote:
>>
>>> On 8 December 2016 at 20:29, Martin Falatic <martin at falatic.com>
>>> wrote:
>>>
>>>
>>>> This is beyond the scope of pycrypto for the moment - you have
>>>> system problems because you've upgraded pip yourself.
>>>
>>> Python rather than Operating system, yes I might agree.
>>> Though why the tool used makes a problem I'm less sure?
>>>
>>>
>>>
>>>
>>>>
>>>> This looks familiar because I did the same exact thing myself in
>>>> the process of testing this (and it didn't go smoothly - same
>>>> problem you're having - so I rolled that back to get pip2 and pip3
>>>> working properly). Let's get you back on track.
>>>>
>>>>
>>>
>>>
>>> So to get the desired output, which versions of pip are required?
>>>
>>>
>>>
>>> One difficulty I'm seeing is that I am quite unable to determine
>>> which version of Crypto I have? Surely it's not asking too much to
>>> identify at least those versions for which you have some control?
>>> Either by name,
>>> version, docstring or some such?
>>>
>>>
>>>>
>>>> # At this point let's get back to the system default pips and go
>>>> from there. IF you upgraded the system pip to 9.0.1 as it appears,
>>>> here's how to fix them:
>>>
>>> Which (versions) do you define as system defaults please?
>>> Default for Python 2.7 and 3.5?
>>>
>>>
>>>
>>>>
>>>> sudo dnf reinstall python-pip python3-pip
>>>>
>>>> # Now, with that done, run these:
>>>> sudo pip3.5 uninstall pycrypto sudo pip2.7 uninstall pycrypto
>>>
>>> Reinstalling:
>>> python-pip    noarch    8.1.2-2.fc25       fedora    1.7 M
>>>
>>> Reinstalling:
>>> python3-pip    noarch    8.1.2-2.fc25      fedora    1.7 M
>>>
>>>
>>>>
>>>> # Once that's done, list them as per my earlier email:
>>>> pip3.5 list | grep pycrypt pip2.7 list | grep pycrypt
>>>
>>> # pip2.7 list | grep pycrypt
>>> pycryptodomex (3.4.3)
>>>
>>> # pip3.5 list | grep pycrypt
>>> (no output)
>>>
>>>
>>>
>>>>
>>>> Shouldn't see `pycrypto` there now. If you do... you installed it
>>>> some other way (perhaps as a dnf package?) Uninstall it via the same
>>>>  mechanism you installed it and try again.
>>>
>>> # locate Crypto shows
>>> /usr/lib64/python3.5/site-packages/Crypto
>>>
>>>
>>>
>>> and
>>>
>>> /usr/lib64/python2.7/site-packages/Crypto
>>> /usr/lib64/python2.7/site-packages/Cryptodome
>>>
>>>
>>>
>>>
>>> which would seem to be a mix. In the /usr/lib/python3.5/site-packages
>>> I
>>> have Crypto within which __init__.py I see # Written in 2008 by Dwayne
>>> C. Litzenberger <dlitz at dlitz.net>
>>>
>>>
>>>
>>> So it is possibly pycrypto original.
>>> Renamed this dir and my code fails, so this is where it's coming from.
>>>
>>>
>>>
>>> pip3.5 install pycryptodomex (my code still fails)
>>>
>>>
>>> pip3.5 install pycryptodome and my code runs.
>>>
>>> Unless I get further problems, I'm quite prepared to leave it at
>>> that. Seems I'm running pycryptodome (how to tell!) which is working.
>>>
>>>
>>>
>>> Are you recommending staying with pip2.7 (8.1.2) and
>>> pip3.5 (8.1.2) ?
>>>
>>> Again, thanks for the help Marty.
>>>
>>>
>>>
>>> regards
>>>
>>>
>>>
>>>
>>>>
>>>> Now go through the steps in my previous email to install
>>>> pycryptodome and pycryptodomex for the purpose of this test, and
>>>> report the results.
>>>>
>>>> - Marty
>>>>
>>>>
>>>>
>>>>
>>>> On Thu, December 8, 2016 08:51, Dave Pawson wrote:
>>>>
>>>>
>>>>> Subtle. Seems access to pip 3 is via
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> # python3 -m pip list | grep crypto
>>>>> DEPRECATION: The default format will switch to columns in the
>>>>> future. You can use --format=(legacy|columns) (or define a
>>>>> format=(legacy|columns) in your pip.conf under the [list] section)
>>>>> to disable this warning. pycrypto (2.6.1)
>>>>>
>>>>>
>>>>> So 3 seems to have pycrypto 2.6.1... maybe.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> regards
>>>>>
>>>>>
>>>>>
>>>>> On 8 December 2016 at 16:47, Dave Pawson <dave.pawson at gmail.com>
>>>>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> On 8 December 2016 at 12:46, Martin Falatic
>>>>>> <martin at falatic.com>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>> When you run `pip2.7 list` (pretty sure that's what you need
>>>>>>> for python2, or `pip list` may be the defacto python2 pip on
>>>>>>> Fedora)
>>>>>>> and `pip3.5 list` (for python3), what are you seeing in the
>>>>>>> area of "pycrypto*" for each of these? I'm hopeful that once
>>>>>>> you have the proper libs installed for python3 via pip3.5
>>>>>>> things should work better.
>>>>>>
>>>>>> pip2 list | grep crypt pycryptodomex (3.4.3)
>>>>>>
>>>>>>
>>>>>> No such thing as pip3.x
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> dnf install python3-pip Last metadata expiration check: 0:00:48
>>>>>> ago on Thu Dec  8 16:40:04 2016. Package
>>>>>> python3-pip-8.1.2-2.fc25.noarch is already installed, skipping.
>>>>>> Dependencies resolved.
>>>>>> Nothing to do.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> dnf info python3-pip Last metadata expiration check: 0:03:38
>>>>>> ago on Thu
>>>>>> Dec  8 16:40:04 2016.
>>>>>> Installed Packages
>>>>>> Name        : python3-pip
>>>>>> Arch        : noarch
>>>>>> Epoch       : 0
>>>>>> Version     : 8.1.2
>>>>>> Release     : 2.fc25
>>>>>> Size        : 8.6 M
>>>>>> Repo        : @System
>>>>>> From repo   : fedora
>>>>>> Summary     : A tool for installing and managing Python3
>>>>>> packages URL         : http://www.pip-installer.org
>>>>>> License     : MIT
>>>>>> Description : Pip is a replacement for `easy_install
>>>>>> : <http://peak.telecommunity.com/DevCenter/EasyInstall>`_.
>>>>>> It uses mostly the
>>>>>> : same techniques for finding packages, so packages that were
>>>>>> made : easy_installable should be pip-installable as well.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Looks like python3-pip is pip?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Yet
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> # pip -V
>>>>>> pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)
>>>>>>
>>>>>>
>>>>>> So (possibly?) there is a pip looking at python3.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Normally you'd use the pip variant for python3 (e.g., pip3.5)
>>>>>>> to install packages for python3. Can you give that a look and
>>>>>>> retry?
>>>>>>>
>>>>>>> Note that I'm not an expert on pycryptodome - my
>>>>>>> understanding is that pycryptodome can be used instead of
>>>>>>> pycrypto, and it seems to work fine on Windows (and I don't
>>>>>>> have reason to think it'd be any different on Linux). I have
>>>>>>> no experience with pycryptodomex currently. I have
>>>>>>> pycryptodome installed on python 2.7 and 3.5 on my Windows box
>>>>>>> (and pycrypto NOT
>>>>>>> installed on either) and the test you described ran fine for
>>>>>>> both.
>>>>>>>
>>>>>>>
>>>>>>> That said, if this continues, what version of Fedora are you
>>>>>>> running? I can stand up a VM and see for myself.
>>>>>>
>>>>>> Latest - Fedora 25.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Is there a separate mailing list for pycryptodome?
>>>>>> Perhaps I should ask there?
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Tks. Dave
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> - M
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Thu, December 8, 2016 01:44, Dave Pawson wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Additional information.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> pip install pycryptodomex Requirement already satisfied:
>>>>>>>> pycryptodomex in /usr/lib64/python2.7/site-packages
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Yet...
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> File
>>>>>>>> "/usr/lib64/python3.5/site-packages/Crypto/Cipher/blockalgo.
>>>>>>>> py", line 141, in __init__ self._cipher = factory.new(key,
>>>>>>>> *args,
>>>>>>>> **kwargs)
>>>>>>>> ValueError: IV must be 16 bytes long
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> So (since I'm using python3) it's picking up the Crypto
>>>>>>>> library from python 3.5 and pip is installing it in python
>>>>>>>> 2.7
>>>>>>>>
>>>>>>>>
>>>>>>>> https://pycryptodome.readthedocs.io/en/latest/src/installat
>>>>>>>> ion. html #windo ws-from-sources-python-3-5-and-newer
>>>>>>>>
>>>>>>>> (aside. Yum no longer used in Fedora, just replace with
>>>>>>>> dnf)
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> python3 -m Cryptodome.Selftest /usr/bin/python3: Error
>>>>>>>> while finding spec for 'Cryptodome.Selftest' (ImportError:
>>>>>>>> No module
>>>>>>>> named 'Cryptodome')
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> regards Dave
>>>>>>>>
>>>>>>>>
>>>>>>>> On 8 December 2016 at 09:20, Dave Pawson
>>>>>>>> <dave.pawson at gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>> https://pycryptodome.readthedocs.io/en/latest/src/install
>>>>>>>>> atio n.ht ml
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> python3 -m Cryptodome.SelfTest /usr/bin/python3: Error
>>>>>>>>> while finding spec for 'Cryptodome.SelfTest' (ImportError:
>>>>>>>>> No
>>>>>>>>> module named 'Cryptodome')
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> https://pycryptodome.readthedocs.io/en/latest/src/example
>>>>>>>>> s.ht ml
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> example
>>>>>>>>>
>>>>>>>>> python3 exp1.py Traceback (most recent call last): File
>>>>>>>>> "exp1.py",
>>>>>>>>> line 12, in <module> cipher = AES.new(key, AES.MODE_EAX)
>>>>>>>>> AttributeError: module
>>>>>>>>> 'Crypto.Cipher.AES' has no attribute 'MODE_EAX'
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> which seems to be true
>>>>>>>>>
>>>>>>>>> dir(AES) ['AESCipher', 'MODE_CBC', 'MODE_CFB',
>>>>>>>>> 'MODE_CTR',
>>>>>>>>> 'MODE_ECB',
>>>>>>>>> 'MODE_OFB', 'MODE_OPENPGP', 'MODE_PGP', '_AES',
>>>>>>>>> '__builtins__',
>>>>>>>>> '__cached__', '__doc__', '__file__', '__loader__',
>>>>>>>>> '__name__',
>>>>>>>>> '__package__', '__revision__', '__spec__', 'block_size',
>>>>>>>>> 'blockalgo',
>>>>>>>>> 'key_size', 'new']
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Bugs in docs? Library?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Suggestions please.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> regards
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Dave Pawson
>>>>>>>>> XSLT XSL-FO FAQ.
>>>>>>>>> Docbook FAQ.
>>>>>>>>> http://www.dpawson.co.uk
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Dave Pawson
>>>>>>>> XSLT XSL-FO FAQ.
>>>>>>>> Docbook FAQ.
>>>>>>>> http://www.dpawson.co.uk
>>>>>>>> _______________________________________________
>>>>>>>> pycrypto mailing list pycrypto at lists.dlitz.net
>>>>>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> pycrypto mailing list pycrypto at lists.dlitz.net
>>>>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Dave Pawson
>>>>>> XSLT XSL-FO FAQ.
>>>>>> Docbook FAQ.
>>>>>> http://www.dpawson.co.uk
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Dave Pawson
>>>>> XSLT XSL-FO FAQ.
>>>>> Docbook FAQ.
>>>>> http://www.dpawson.co.uk
>>>>> _______________________________________________
>>>>> pycrypto mailing list pycrypto at lists.dlitz.net
>>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> pycrypto mailing list pycrypto at lists.dlitz.net
>>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Dave Pawson
>>> XSLT XSL-FO FAQ.
>>> Docbook FAQ.
>>> http://www.dpawson.co.uk
>>> _______________________________________________
>>> pycrypto mailing list pycrypto at lists.dlitz.net
>>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> pycrypto mailing list pycrypto at lists.dlitz.net
>> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>>
>
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
> _______________________________________________
> pycrypto mailing list pycrypto at lists.dlitz.net
> http://lists.dlitz.net/cgi-bin/mailman/listinfo/pycrypto
>
>




More information about the pycrypto mailing list