Code Monkey home page Code Monkey logo

Comments (2)

yoursunny avatar yoursunny commented on September 22, 2024

WifiEspNow.addPeer has an key parameter that accepts an encryption key.
Fair warning: I’ve never used it and don’t know how strong the encryption scheme is.

from wifiespnow.

coelner avatar coelner commented on September 22, 2024

https://www.espressif.com/sites/default/files/documentation/esp-now_user_guide_en.pdf pg.4 (but maybe this is outdated)

Limited encrypted peers. 10 encrypted peers at the most are supported in Station mode; 6 at the most in SoftAP or SoftAP + Station mode. Multiple unencrypted peers are supported, however, their total number should be less than 20, including encrypted peers.

https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/network/esp_now.html#security

ESP-NOW uses the CCMP method, which is described in IEEE Std. 802.11-2012, to protect the vendor-specific action frame. The Wi-Fi device maintains a Primary Master Key (PMK) and several Local Master Keys (LMK). The lengths of both PMK and LMk are 16 bytes.
PMK is used to encrypt LMK with the AES-128 algorithm. Call esp_now_set_pmk() to set PMK. If PMK is not set, a default PMK will be used.
LMK of the paired device is used to encrypt the vendor-specific action frame with the CCMP method. The maximum number of different LMKs is six. If the LMK of the paired device is not set, the vendor-specific action frame will not be encrypted.
Encrypting multicast vendor-specific action frame is not supported.

This library does not pass any key (this would be a LMK):

FOREACH_AP([&](const uint8_t* bssid, uint8_t channel) { WifiEspNow.addPeer(bssid, channel); });

I suggest a function to pass through a user defined PMK (aka KOK) to reach this call:
https://github.com/esp8266/Arduino/blob/74819a763bfb6e9890a57411dcea4aba221a778d/tools/sdk/include/espnow.h#L76
or/and this:
https://github.com/espressif/arduino-esp32/blob/8d0e68db4f73c6243be4e9c5955ef1eb842dd95b/tools/sdk/include/esp32/esp_now.h#L303
and add a setLMK function for the broadcast implementation.

I'm not sure if I sum it up right:

  • max 20 peers at all for ESPNOW
  • max 6 different LMK , which would allow 20 encrypted peers with a single LMK?
  • at least one LMK is needed

related

espressif/ESP8266_NONOS_SDK#114
espressif/ESP8266_NONOS_SDK#8
esp8266/Arduino#6174

from wifiespnow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.