-
Notifications
You must be signed in to change notification settings - Fork 7
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
Sending encrypted ESP-NOW #1
Comments
Receiving encrypted ESP-NOW messages is now supported, but sending is not yet. Possibly related to needing AAD/MIC calculation. AAD/MIC may also benefit validating received encrypted messages. |
If the issue is the 8 byte MIC validation, it is made worse by the failing the validation check of received messages. def callback(from_mac, to_mac, msg):
packet = espnow.packet
nonce = b'\x00'+bytes.fromhex(from_mac.replace(':',''))+struct.pack("BBBBBB",packet.PN5,packet.PN4,packet.PN3,packet.PN2,packet.PN1,packet.PN0)
cipher = AES.new(espnow.key, AES.MODE_CCM, nonce, mac_len=8)
try:
data = cipher.decrypt_and_verify(packet.data[:-8], packet.data[-8:]) # does not validate
print("success")
except Exception as e:
print("Error decrypting:",e) If a solution is found to calculate MIC and validate correctly for receiving encrypted messages, it will be a big help for generating the MIC for sending encrypted messages. CCMP documentation suggests the MIC is calculated/validated with AES CBC apart from the message itself encrypted with CCM |
Compiled ESP-IDF from source with modified debug and ccmp.c to track through AAD and MIC. |
ESPythoNOW does not currently support the encryption method optionally used with ESP-NOW.According to the documentation
The text was updated successfully, but these errors were encountered: