2b779d5532
- Implement secure transport mechanisms in `gateway_knx_secure_transport.cpp` for handling secure sessions, including AES encryption, session key generation, and secure packet wrapping and unwrapping. - Introduce `OamRouterRuntime` in `oam_router_runtime.cpp` to manage OAM router identity, individual addresses, and tunnel frame handling. - Enhance secure session management with functions for session allocation, authentication, and secure packet processing. - Ensure compatibility with existing KNXnet/IP protocols while adding support for secure communications. Signed-off-by: Tony <tonylu@tony-cloud.com>
66 lines
2.1 KiB
C++
66 lines
2.1 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#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 GenerateFactoryFdsk(FactoryFdskInfo* info = nullptr);
|
|
bool WriteFactoryFdskHex(const std::string& hex_key, FactoryFdskInfo* info = nullptr);
|
|
bool ResetFactoryFdskCache(FactoryFdskInfo* info = nullptr);
|
|
FactoryCertificatePayload BuildFactoryCertificatePayload();
|
|
|
|
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<std::string>& tunnel_user_key_hex,
|
|
const std::string& device_auth_key_hex,
|
|
bool activated);
|
|
bool StoreOamIpSecureRoutingSequence(uint64_t sequence);
|
|
bool ClearOamIpSecureKeyring();
|
|
|
|
} // namespace gateway::openknx
|