Add Ed25519 challenge-response authentication#296
Open
oetiker wants to merge 2 commits intousetrmnl:mainfrom
Open
Add Ed25519 challenge-response authentication#296oetiker wants to merge 2 commits intousetrmnl:mainfrom
oetiker wants to merge 2 commits intousetrmnl:mainfrom
Conversation
- Ed25519 keypair generation and NVS storage for device identity - Challenge-response signing: timestamp_ms || public_key - Server-controlled auth_mode (api_key or ed25519) via /api/setup - Reject malleable signatures (S >= L) in crypto_sign_open - VLA stack guard (TWEETNACL_MAX_MSG_LEN) in detached sign/verify - Move key generation after WiFi for RF-based esp_random() entropy - Extract shared bytesToHex into hex_utils.h Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Collaborator
|
Hey, thanks for helping improve the firmware! This feature adds quite a bit to review, so it’ll take me some time to dig into it. I’ll post an update once I start working on it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Ed25519 challenge-response authentication as an alternative to API key auth, giving each device a unique cryptographic identity.
Why this matters
API keys are shared secrets — if one is intercepted, an attacker can impersonate the device indefinitely. Ed25519 authentication eliminates this class of attack:
/api/timebefore signing. This ensures clock-independent replay protection.auth_modeper device via/api/setup, so existing devices continue working unchanged.What changed
device_identity.cpp)sign(timestamp_ms || public_key)(auth_signature.cpp)esp_random()entropyX-Public-Key,X-Signature,X-Timestampheaders when in ed25519 modebytesToHexextracted tohex_utils.hTest plan
pio runbuilds cleanlyX-Public-Key,X-Signature,X-Timestampheaders sent whenauth_mode: "ed25519"auth_mode: "api_key"🤖 Generated with Claude Code