1 #ifndef PRIMARY_MANAGEDSECONDARY_H_
2 #define PRIMARY_MANAGEDSECONDARY_H_
8 #include <boost/filesystem.hpp>
11 #include "primary/secondary_config.h"
12 #include "uptane/secondaryinterface.h"
22 constexpr
static const char*
const Type =
"managed";
25 bool partial_verifying{
false};
26 std::string ecu_serial;
27 std::string ecu_hardware_id;
28 boost::filesystem::path full_client_dir;
29 std::string ecu_private_key;
30 std::string ecu_public_key;
31 boost::filesystem::path firmware_path;
32 boost::filesystem::path target_name_path;
33 boost::filesystem::path metadata_path;
34 KeyType key_type{KeyType::kRSA2048};
49 if (!sconfig.ecu_serial.empty()) {
55 PublicKey getPublicKey()
const override {
return public_key_; }
57 int getRootVersion(
bool director)
const override;
58 bool putRoot(
const std::string& root,
bool director)
override;
60 bool sendFirmware(
const std::string&
data)
override;
65 bool loadKeys(std::string* pub_key, std::string* priv_key);
69 std::string detected_attack;
70 std::string expected_target_name;
71 std::vector<Uptane::Hash> expected_target_hashes;
72 uint64_t expected_target_length{};
73 std::mutex install_mutex;
75 virtual bool storeFirmware(
const std::string& target_name,
const std::string& content) = 0;
80 std::string private_key;
84 void storeKeys(
const std::string& pub_key,
const std::string& priv_key);
94 #endif // PRIMARY_MANAGEDSECONDARY_H_