SyncY icon indicating copy to clipboard operation
SyncY copied to clipboard

Errors when using AES encryption

Open mo-han opened this issue 8 years ago • 1 comments

Traceback (most recent call last):
Traceback (most recent call last):
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1638, in __read_data
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1638, in __read_data
        cipher = self.__init_cipher(SyncY.encryption, SyncY.encryptkey)
cipher = self.__init_cipher(SyncY.encryption, SyncY.encryptkey)
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1604, in __init_cipher
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1604, in __init_cipher
        return AES.new(key.ljust(32, '.')[0:32], AES.MODE_CFB, segment_size=8)
return AES.new(key.ljust(32, '.')[0:32], AES.MODE_CFB, segment_size=8)
  File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new
  File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new
Traceback (most recent call last):
          File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1638, in __read_data
return AESCipher(key, *args, **kwargs)
return AESCipher(key, *args, **kwargs)
      File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 59, in __init__
  File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 59, in __init__
cipher = self.__init_cipher(SyncY.encryption, SyncY.encryptkey)
          File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1604, in __init_cipher
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
      File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in __init__
  File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in __init__
return AES.new(key.ljust(32, '.')[0:32], AES.MODE_CFB, segment_size=8)
          File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 95, in new
self._cipher = factory.new(key, *args, **kwargs)
self._cipher = factory.new(key, *args, **kwargs)
    ValueErrorValueErrorreturn AESCipher(key, *args, **kwargs)
: :   File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\AES.py", line 59, in __init__
IV must be 16 bytes longIV must be 16 bytes long    

blockalgo.BlockAlgo.__init__(self, _AES, key, *args, **kwargs)
  File "D:\Environment\Python27\lib\site-packages\Crypto\Cipher\blockalgo.py", line 141, in __init__
    self._cipher = factory.new(key, *args, **kwargs)
ValueError: IV must be 16 bytes long
2016-02-09 22:07:33 ERROR: Transfer task exception error occurred: Invalid \escape: line 1 column 77 (char 76) .
Traceback (most recent call last):
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1774, in run
    ret = self.__upload_file()
  File "D:\Application\_Data_Web\SyncY-Python\syncy.py", line 1870, in __upload_file
    responses = json.loads(responses)
  File "D:\Environment\Python27\lib\json\__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "D:\Environment\Python27\lib\json\decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\Environment\Python27\lib\json\decoder.py", line 380, in raw_decode
    obj, end = self.scan_once(s, idx)
ValueError: Invalid \escape: line 1 column 77 (char 76)

The printed info above is from my Windows laptop a long time ago, when running a python version of SyncY v2.x. I got the same errors nowdays, still.

Similar problems when using Blowfish cipher. However the ARC4 is good. SyncY version is Python v2.5.3

mo-han avatar Jun 24 '16 10:06 mo-han

I fix it from this : https://bugs.launchpad.net/pycrypto/+bug/1018283 on syncy.py line 1604: add 16bytes sth, Modif like this:
return AES.new(key.ljust(32, '.')[0:32], AES.MODE_CFB,'0123456789012345',segment_size=8)

siyiys avatar Jul 22 '16 18:07 siyiys