-
Notifications
You must be signed in to change notification settings - Fork 11
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
Value Error: Invalid data #16
Comments
@gakar06 Hello, did you use this lib to encrypt and decrypt? This xxtea lib may not be compatible with other ones. |
key needs to be 16-byte long, data can be of any length. |
What is the purpose of doing the PKCS#7 padding and removal in the XXTEA code? Just curious. The issue seems to occurring within xxtea.c in the xxtea_decrypt function. At the bottom, the ELSE of if (rc >= 0) { If I comment out the ELSE, the decrypt works. Any ideas why? What is the PKCS used for? Thanks! |
It's because XXTEA algorithm works on two or more 32-bit integers. |
xxtea 0.1.5 doesn't add paddings, let's see the problem: pip install xxtea==0.1.5 >>> import os
>>> import xxtea
>>> key = os.urandom(16)
>>> xxtea.encrypt('\0'*3, key)
'1aa3918940169fe3'
>>> xxtea.decrypt(_, key)
'' |
Going to close this right now. Feel free to reopen it if there are any problems |
When I try to use this script on data I get the following error:
ValueError : Invalid data, illegal PKCS#7 padding. Could be using a wrong key.
What does the format need to be of the key and data coming into the xxtea.decrypt function? As of right now, the key is 16 bytes and the data is 256 bytes.
Thanks,
Chris
The text was updated successfully, but these errors were encountered: