Skip to content

Vean/FansElectronics_License

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

FansElectronics_License

๐Ÿ‡ฎ๐Ÿ‡ฉ Bahasa Indonesia


Description ๐Ÿ“–

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

What's New in v2.0.0 ๐Ÿš€

Major update focused on memory stability and usability.

Breaking change (one-line migration)

// v1.x
FansElectronics_License license(HMAC);

// v2.0.0
StaticJsonDocument<1024> doc;   // ESP8266
DynamicJsonDocument doc(1024);  // ESP32
FansElectronics_License license(doc, HMAC);

Why this change?

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

Features โœจ

  • 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

Security Modes ๐Ÿ”’

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

ArduinoJson Requirement โš ๏ธ

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

How It Works โ“

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


License File Structure ๐Ÿ”‘

{
  "data": {
    "device_id": "ABC123",
    "product": "PRODUCT NAME",
    "serial": "SN001",
    "panel": 64
  },
  "signature": "BASE64_SIGNATURE"
}

ESP Performance Comparison (Estimated) ๐Ÿ“Š

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

Created By ๐Ÿ’ป

Author note: Feel free to develop and use this library for education, personal, religious, or commercial purposes.


Buy me a Coffee โ˜•


Thanks To ๐Ÿคฒ

  • Allah Subhanahu Wa Ta'ala
  • Arduino.cc
  • GitHub
  • Contributor
  • Everyone who gives me coffee

About

Offline License System for ESP32 & ESP8266 ๐Ÿ”

Resources

License

Stars

Watchers

Forks

Contributors