-
Notifications
You must be signed in to change notification settings - Fork 140
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
Incomplete string when some encrypted buffer is received [Solution found, please update and release] #101
Comments
This is an open source project. Others wont just do the work for you. Do tests and suggest one :) Strings in C/C++ assume the 0 byte as end of string. Does the encrypted data contain the 0 byte? If so, its probably the reason why this happens. Its probably not a good idea to keep the data as data type String then. |
Sorry for that, I mean please suggest me if there's a better implementation to the code, because I don't know if using a for-loop like that will affect the efficiency/performance or not, or is there a way to prevent the 0 byte data to terminating the string. |
Description of the problem
I encrypt a JSON string from node.js using AES-128 ECB mode and send the encrypted buffer to my esp32 via Mqtt, and decrypt on my esp32 using esp32-Encrypt, however, the encryption process seems to work fine but when receiving the buffer, sometimes it only receives a partial buffer when sending a specific string.
for example:
this is an example of a complete buffer, and it's always complete if the origin string is the one in the picture
this is from mqttx which is also subscribed to the same topic, the buffer is complete as same as the received one
but when the origin string data is changed from
https://app.binance.com/qr/dplkff1d79e287474989a576f5b33064a7a7
tohttps://app.binance.com/qr/dplk3568fe48d0d24fe083c53efdd066c18b
or some other different strings, the received buffer becomes incomplete, it only received a partial of the encrypted buffer, and is always reproducibleso I checked the mqttx, the encrypted buffer is complete but the highlighted part is the only part received by esp32
Versions
Hardware
C++ code
Mqtt code is the same as in the readme example
The text was updated successfully, but these errors were encountered: