FansElectronics License is an Arduino library designed to implement an offline licensing system for ESP32 and ESP8266 devices.
This library helps IoT developers and hardware manufacturers to:
- Lock firmware to specific hardware
- Enable features based on license
- Prevent device cloning
- Verify licenses without internet connection
Major update focused on memory stability and usability.
// v1.x
FansElectronics_License license(HMAC);
// v2.0.0
StaticJsonDocument<1024> doc; // ESP8266
DynamicJsonDocument doc(1024); // ESP32
FansElectronics_License license(doc, HMAC);Previously the JSON memory size was fixed inside the library.
Now users control the memory size, making the library stable for production projects.
Benefits:
- No need to edit library source anymore
- Safer for ESP8266 heap
- Scalable for large projects
- Unique hardware-based Device ID
- Offline license verification
- Multiple encryption modes (LIGHT, HMAC, ECDSA)
- Supports ESP32 & ESP8266
- JSON-based license format
- License generator tools (CLI & Web)
- Production-ready architecture
| Mode | Platform | Security | Description | Status |
|---|---|---|---|---|
| LIGHT | ESP32 & ESP8266 | โญ | Device binding only | โ Implemented |
| HMAC | ESP32 & ESP8266 | โญโญโญ | Secret-key signature | โ Implemented |
| ECDSA | ESP32 | โญโญโญโญโญ | Public-key cryptography | โ Implemented |
| AES | ESP32 & ESP8266 | โญโญโญโญ | Encrypted license file (confidentiality) | ๐ง Next Update |
| Ed25519 | ESP32 & ESP8266 | โญโญโญโญโญ | Modern public-key signature | ๐ง Next Update |
Perfect for:
- Commercial IoT products
- LED controller / display systems
- 24/7 offline devices
- OEM / mass production hardware
This library uses ArduinoJson v6.21.5.
Why not ArduinoJson v7?
- ESP8266 requires deterministic memory allocation
- v7 uses dynamic heap allocation
- v6 fixed memory pool is more stable for long-running IoT devices
1๏ธโฃ Device generates a unique Device ID
2๏ธโฃ Developer creates license.json using generator tool
3๏ธโฃ License is stored in LittleFS
4๏ธโฃ Firmware verifies license at boot
Valid license โ features enabled
Invalid license โ device locked
{
"data": {
"device_id": "ABC123",
"product": "PRODUCT NAME",
"serial": "SN001",
"panel": 64
},
"signature": "BASE64_SIGNATURE"
}| Mode | ESP8266 RAM Usage | ESP32 RAM Usage | Verify Speed ESP8266 | Verify Speed ESP32 | License Size |
|---|---|---|---|---|---|
| LIGHT | ~1 KB | ~1 KB | < 1 ms | < 1 ms | Tiny |
| HMAC-SHA256 | ~4โ6 KB | ~3โ4 KB | ~5โ10 ms | ~2โ4 ms | Small |
| ECDSA-P256 | Unsupport | ~12โ16 KB | Unsupport | ~20โ40 ms | Medium |
| AES-256 (decrypt) | ~4โ6 KB | ~2โ3 KB (HW accel) | ~8โ15 ms | ~1โ2 ms | Encrypted |
| Ed25519 | ~10โ14 KB | ~8โ12 KB | ~40โ80 ms | ~8โ15 ms | Small |
- Writer : Irfan Indra Kurniawan, ST
- Organization : Fans Electronics
- Website : www.fanselectronics.com
- Email : info@fanselectronics.com
Author note: Feel free to develop and use this library for education, personal, religious, or commercial purposes.
- info@fanselectronics.com
- www.facebook.com/FansElectronicsCom
- www.instagram.com/fanselectronics
- www.saweria.co/fanselectronics
- Allah Subhanahu Wa Ta'ala
- Arduino.cc
- GitHub
- Contributor
- Everyone who gives me coffee