#pragma once #include #include #include #include #include "gateway_knx.hpp" namespace gateway::openknx { struct FactoryFdskInfo { bool available{false}; std::string serialNumber; std::string label; std::string qrCode; }; struct FactoryCertificatePayload { bool available{false}; std::string productIdentity; std::string manufacturerId; std::string applicationNumber; std::string applicationVersion; std::string serialNumber; std::string fdskLabel; std::string fdskQrCode; std::string storage; std::string createdAt; std::string checksum; }; struct IpSecureCredentialStatus { bool activated{false}; bool backboneKeyAvailable{false}; bool deviceAuthenticationKeyAvailable{false}; uint8_t tunnelUserCount{0}; uint64_t routingSequence{0}; }; bool LoadFactoryFdsk(uint8_t* data, size_t len); FactoryFdskInfo LoadFactoryFdskInfo(); bool LoadFactoryFdskForInstance(uint32_t instance_id, uint8_t* data, size_t len); FactoryFdskInfo LoadFactoryFdskInfoForInstance(uint32_t instance_id); bool GenerateFactoryFdsk(FactoryFdskInfo* info = nullptr); bool WriteFactoryFdskHex(const std::string& hex_key, FactoryFdskInfo* info = nullptr); bool ResetFactoryFdskCache(FactoryFdskInfo* info = nullptr); bool ResetFactorySecurityForInstance(uint32_t instance_id, FactoryFdskInfo* info = nullptr); FactoryCertificatePayload BuildFactoryCertificatePayload(); FactoryCertificatePayload BuildFactoryCertificatePayloadForInstance(uint32_t instance_id); bool LoadOamFactoryFdsk(uint8_t* data, size_t len); FactoryFdskInfo LoadOamFactoryFdskInfo(); bool GenerateOamFactoryFdsk(FactoryFdskInfo* info = nullptr); bool WriteOamFactoryFdskHex(const std::string& hex_key, FactoryFdskInfo* info = nullptr); bool ResetOamFactoryFdskCache(FactoryFdskInfo* info = nullptr); FactoryCertificatePayload BuildOamFactoryCertificatePayload(); IpSecureCredentialStatus LoadOamIpSecureCredentialStatus(); ::gateway::GatewayKnxIpSecureCredentialMaterial LoadOamIpSecureCredentialMaterial(); bool WriteOamIpSecureKeyringHex(const std::string& backbone_key_hex, const std::vector& tunnel_user_key_hex, const std::string& device_auth_key_hex, bool activated); bool StoreOamIpSecureRoutingSequence(uint64_t sequence); bool ClearOamIpSecureKeyring(); } // namespace gateway::openknx