python-tikteck icon indicating copy to clipboard operation
python-tikteck copied to clipboard

ValueError: AES key must be either 16, 24, or 32 bytes long

Open david78rs opened this issue 7 years ago • 2 comments

Hi I have tried to use the sample script for this fantastic library, and I am getting an error. I was wondering if you can check it and le the know what is wrong

here is the output I'm getting

pi@raspbian:~/python $ ./tikteck_script.py Traceback (most recent call last): File "./tikteck_script.py", line 6, in bulb.connect() File "/usr/local/lib/python2.7/dist-packages/tikteck-0.4-py2.7.egg/tikteck/init.py", line 76, in connect enc_data = key_encrypt(self.name, self.password, data) File "/usr/local/lib/python2.7/dist-packages/tikteck-0.4-py2.7.egg/tikteck/init.py", line 35, in key_encrypt return encrypt(data, key) File "/usr/local/lib/python2.7/dist-packages/tikteck-0.4-py2.7.egg/tikteck/init.py", line 16, in encrypt k = AES.new(bytes(reversed(key)), AES.MODE_ECB) File "/usr/local/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 95, in new return AESCipher(key, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/Crypto/Cipher/AES.py", line 59, in init blockalgo.BlockAlgo.init(self, _AES, key, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py", line 141, in init self._cipher = factory.new(key, *args, **kwargs) ValueError: AES key must be either 16, 24, or 32 bytes long

david78rs avatar Jun 21 '17 03:06 david78rs

i have this very same issue. i thought perhaps it was a change in pycrypto, but that seems not to have been updated for 3 years.

chee avatar Jul 06 '17 01:07 chee

oh. @david78rs try using python3

chee avatar Jul 06 '17 02:07 chee