# SecurePair beta 0.5 enables encrypted pairing for ESP32 via optical and wireless links

> **Key takeaway:** SecurePair provides a library for ESP32 microcontrollers to establish encrypted communication using X25519 and AES-256-GCM via LED-based optical signals or wireless protocols.

**Published:** 2026-11-24T21:51:44+00:00 
**Source:** Adafruit Electronics 
**Category:** open-hardware 
**Canonical URL:** https://fosswire.org/news/securepair-beta-05-enables-encrypted-pairing-for-esp32-via-o.html 

## Summary
The SecurePair library has entered beta 0.5, offering a method for two ESP32 boards to establish a secure, encrypted link through physical user confirmation. The system uses a single LED and a button on each device to facilitate a 20-bit confirmation code, which is displayed via synchronized light flashes to prevent man-in-the-middle attacks.

This implementation is designed for the entire ESP32 family, including the C3, S3, and P4 variants. While the primary demonstration uses optical pairing within a 2-meter range, the protocol is compatible with ESP-NOW for medium distances and LoRa for long-range connectivity.

## Technical implementation of SecurePair
- **Cryptographic Stack:** The library utilizes X25519 for generating fresh keys during the handshake and employs AES-256-GCM for authenticated message encryption in both directions.
- **Hardware Compatibility:** It is built to run on all ESP32 series chips and relies on the Mbed TLS library provided within the standard ESP32 core.
- **Authentication Mechanism:** Users confirm the connection via a 20-bit code represented by 20 synchronized short and long LED flashes, providing a 1 in 1,048,576 chance of a successful brute-force guess.
- **Storage and Connectivity:** Each board maintains a permanent identity and can store between 8 and 16 peer identities; the protocol supports optical (via PacketLED), ESP-NOW, and LoRa physical layers.

## Why it matters
This development provides embedded developers with a standardized, high-security pairing workflow for IoT devices using common ESP32 hardware. By leveraging existing Mbed TLS implementations, it lowers the barrier for adding robust, authenticated communication to open-source hardware projects.