mqtt_udp
mqtt_udp copied to clipboard
digital signature
- [x] java
- [x] python3
- [x] c
- [ ] go
- [ ] lua
- [ ] codesys
HMAC-MD5
https://github.com/mygityf/cipher/blob/master/cipher/hmac.c
https://github.com/gityf/ngx_cipher/tree/master/lualib/cipher/c
https://github.com/ElMostafaIdrassi/MiDHmacLib_Static/blob/master/MiDHmacLib_Static/HMACLib.cpp
I was told that Blake2 or SHA-256 is much better than MD-5...
python:
import hashlib import hmac
signature_computed = 'sha1=' + hmac.new(
key=secret.encode('utf-8'),
msg=data.encode('utf-8'),
digestmod=hashlib.sha1
).hexdigest()
if not hmac.compare_digest(signature, signature_computed):
log("Invalid payload")
Need #69 to implement this. Both done in Java send code. Other code checked to ignore extra packet data.