Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)

like image 984
John Avatar asked May 15 '17 19:05

John


2 Answers

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

like image 161
John Avatar answered Sep 18 '22 15:09

John


By using python 3, i solved it by installing pycryptodome (pip3 install pycryptodome). No need to replace Crypto by Cryptodome

like image 21
ivan .B Avatar answered Sep 19 '22 15:09

ivan .B