|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
"Recover System Key" (key extraction) — device-role responder collaborator. More...
#include "key_extraction_responder.h"#include "hub_internal.h"#include "device_registry.h"#include "pairing_responder.h"#include "proto_commands.h"#include "proto_crypto.h"#include "radio_interface.h"#include "tuning_config.h"#include <esp_random.h>#include <cinttypes>#include <cstdio>#include <cstring>Go to the source code of this file.
Namespaces | |
| namespace | esphome |
| namespace | esphome::home_io_control |
"Recover System Key" (key extraction) — device-role responder collaborator.
Owns the impure side of the key-extraction feature: arming/disarming, throwaway node-ID generation, the 10-minute auto-off timer, the post-extraction grace window, transmitting device-role replies, and the security-sensitive result log block. The pure state-transition decisions live in pairing_responder.h/.cpp; the six RX branches (0x28/0x2C/0x31/0x32/0x36/0x3C) dispatch through try_handle_frame(), called from process_received_packet_() (hub_status.cpp).
The device-role builders (create_discover_resp(), create_challenge_req_device_role(), create_key_confirm(), create_discover_confirm_ack()) are each pinned against a real device's captured framing by tests/corpus_device_role_builder_test.cpp, including create_discover_resp()'s flags/timestamp bytes, which mirror a real Somfy Izymo dimmer's captured values (see KEY_EXTRACTION_DISCOVER_RESP_FLAGS/_TIMESTAMP in proto_commands.cpp for the derivation) but remain unconfirmed against a real hub like every device-role field here.
recover_system_key_from_transfer()'s IV-derivation formula itself is independently pinned against two externally-captured known-answer key transfers (ProtoCrypto.CryptKeyMatchesDocumented*Capture in proto_crypto_test.cpp), so that formula does not rest on this codebase's own conventions — though both captures are short requests and don't exercise construct_iv()'s 8-byte truncation window, so a real hub sending a longer request is an open question. Treat a recovered key as unconfirmed until it has been verified against a real hub, or by successfully controlling a device with it.
Definition in file key_extraction_responder.cpp.