[pycrypto] pycryptodome

Martin Falatic martin at falatic.com
Thu Dec 8 13:49:07 UTC 2016


Followup: I ran the following tests - note that I did NOT have pycrypto
installed at any point in this process for either Python.

It's not necessary to install BOTH pycryptodome and pycryptodomex... this,
too, was simply for the sake of this test. Either pycryptodome instead of
pycrypto, or pycryptodomex and lots of code refactoring, will do the job.

# Installed Fedora 25 server in a VM, default options

# Logged in as admin user (or root)

sudo dnf install redhat-rpm-config gcc gmp python-devel python3-devel
# Fedora 25 already comes with python3.5
# `python-devel` above installs python2.7, which is desirable for this test


# Note: The following is for testing purposes - it's typically wise to
install packages locally lest you cause system-wide problems.

# Ignore `pip` version upgrade warnings

sudo pip3.5 install pycryptodome
sudo pip2.7 install pycryptodome

python2.7 -m Crypto.SelfTest
python3.5 -m Crypto.SelfTest

sudo pip3.5 install pycryptodomex
sudo pip2.7 install pycryptodomex

python2.7 -m Cryptodome.SelfTest
python3.5 -m Cryptodome.SelfTest

## All tests passed.

# Doublecheck:

pip3.5 list | grep pycrypt
#    pycryptodome (3.4.3)
#    pycryptodomex (3.4.3)

pip2.7 list | grep pycrypt
#    pycryptodome (3.4.3)
#    pycryptodomex (3.4.3)

# Note we do NOT see `pycrypto` anywhere!

 - Marty


On Thu, December 8, 2016 04:46, Martin Falatic 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.
>
> 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.
>
> - 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/installation.html#win
>> do 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/installation.html
>>>
>>>
>>>
>>> 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/examples.html
>>>
>>>
>>>
>>> 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
>
>




More information about the pycrypto mailing list