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: the length of the provided data is not a multiple of the block lengt #48

Closed
jodewee opened this issue Jun 2, 2022 · 4 comments
Closed

Comments

@jodewee
Copy link

jodewee commented Jun 2, 2022

image
Any suggestions on this one?

@MotiGross
Copy link

i'm not sure where or what you're trying to do, but 1st you have to decode with Base64, and than you can decode the AES128.
I hope this info helps.
Moti

@tomikaa87
Copy link
Owner

It's possible that the response from this specific unit it not recognized by the script, maybe it has a different format. @jodewee can you please try it with --verbose?

@marius-nicolae
Copy link

I'm hit by the same issue, as well. It should be the same issue as #52. As described in the other issue, my Cooper&Hunter unit works OK but the newer Gree Soyal units display this error.

The --verbose doesn't add that much extra info:

python3 ./gree.py search --broadcast 10.0.5.255 --verbose
Searching for devices using broadcast address: 10.0.5.255
Traceback (most recent call last):
  File "./gree.py", line 245, in <module>
    search_devices()
  File "./gree.py", line 109, in search_devices
    pack = json.loads(decrypt_generic(resp['pack']))
  File "./gree.py", line 73, in decrypt_generic
    return decrypt(pack_encoded, GENERIC_KEY)
  File "./gree.py", line 66, in decrypt
    pack_decrypted = decryptor.update(pack_decoded) + decryptor.finalize()
  File "/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py", line 159, in finalize
    data = self._ctx.finalize()
  File "/usr/lib/python3/dist-packages/cryptography/hazmat/backends/openssl/ciphers.py", line 178, in finalize
    raise ValueError(
ValueError: The length of the provided data is not a multiple of the block length.

@tomikaa87
Copy link
Owner

Duplicate of #52, closing this.

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

No branches or pull requests

4 participants