Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when login: "Data must be padded to 16 byte boundary in CBC mode" #118

Open
artem78 opened this issue Dec 3, 2024 · 0 comments
Open

Comments

@artem78
Copy link

artem78 commented Dec 3, 2024

Hello.

When I try to login to Mega I got error:

user@pc:~$ python3
Python 3.8.10 (default, Nov  7 2024, 13:10:47) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from mega import Mega
>>> mega = Mega()
>>> m = mega.login('xxxxxx', 'yyyyyyy')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/.local/lib/python3.8/site-packages/mega/mega.py", line 49, in login
    self._trash_folder_node_id = self.get_node_by_type(4)[0]
  File "/home/user/.local/lib/python3.8/site-packages/mega/mega.py", line 429, in get_node_by_type
    nodes = self.get_files()
  File "/home/user/.local/lib/python3.8/site-packages/mega/mega.py", line 355, in get_files
    processed_file = self._process_file(file, shared_keys)
  File "/home/user/.local/lib/python3.8/site-packages/mega/mega.py", line 217, in _process_file
    key = decrypt_key(base64_to_a32(keys[uid]), self.master_key)
  File "/home/user/.local/lib/python3.8/site-packages/mega/crypto.py", line 73, in decrypt_key
    return sum((aes_cbc_decrypt_a32(a[i:i + 4], key)
  File "/home/user/.local/lib/python3.8/site-packages/mega/crypto.py", line 73, in <genexpr>
    return sum((aes_cbc_decrypt_a32(a[i:i + 4], key)
  File "/home/user/.local/lib/python3.8/site-packages/mega/crypto.py", line 42, in aes_cbc_decrypt_a32
    return str_to_a32(aes_cbc_decrypt(a32_to_str(data), a32_to_str(key)))
  File "/home/user/.local/lib/python3.8/site-packages/mega/crypto.py", line 34, in aes_cbc_decrypt
    return aes_cipher.decrypt(data)
  File "/home/user/.local/lib/python3.8/site-packages/Crypto/Cipher/_mode_cbc.py", line 246, in decrypt
    raise ValueError("Data must be padded to %d byte boundary in CBC mode" % self.block_size)
ValueError: Data must be padded to 16 byte boundary in CBC mode
>>> 

With empty credentials mega.login() it logins success and uploading/downloading seems works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant