python: module 'Crypto.Cipher.AES' has no attribute 'MODE_CCM' even though pycrypto installed

John picture John · May 15, 2017 · Viewed 8.9k times · Source

pycrypto is installed (when I run pip list one of the result is pycrypto (2.6.1))

and it works but when I would like to use the MODE_CCM it returns: module 'Crypto.Cipher.AES' has no attribute 'MODE_CCM'

My Python version: Python 3.5.2 :: Anaconda 4.2.0 (x86_64)

Answer

John picture John · May 15, 2017

according to https://gist.github.com/jbdatko/7425443 the newest version of pycrypto does not have the CCM mode.

I solved the problem by installing pip install pycryptodomex and replacing the Crypto package withCryptodome

after installing:

in your python code replace from Crypto.Cipher import AES with from Cryptodome.Cipher import AES