Bluetooth-Devices / bthome-ble

Parser for BTHome BLE devices
https://bthome.io/
MIT License
67 stars 12 forks source link

Short payloads fail to decrypt #43

Closed MartinEssink closed 1 year ago

MartinEssink commented 1 year ago

Describe the bug Short payloads, only a temperature for example, cannot be decrypted. The minimum length of the payload is hardcoded. Since the payload can be only two bytes, plus 8 bytes for encryption, the minimum should probably be 10, not 14.

To Reproduce See the following payload for example: key = 231d39c1d7cc1ab1aee224cd096db932 (From documentation) mac = 383B26b5759a payload = D2FC414FA744D001000040A82091 (Does not work) payload = D2FC4125F8BF34F13613000000AFD6F10D (Works)

Ernst79 commented 1 year ago

Thanks for reporting. Fixed in #44