4 #include "config/config.h"
5 #include "crypto/keymanager.h"
6 #include "http/httpinterface.h"
7 #include "uptane/secondaryinterface.h"
9 const int MaxInitializationAttempts = 3;
14 std::shared_ptr<HttpInterface> http_client_in,
KeyManager& keys_in,
15 const std::map<
Uptane::EcuSerial, std::shared_ptr<Uptane::SecondaryInterface> >& secondaries_in);
17 class Error :
public std::runtime_error {
19 Error(
const std::string& what) : std::runtime_error(std::string(
"Initializer error: ") + what) {}
23 KeyGenerationError(
const std::string& what) :
Error(std::string(
"Could not generate uptane key pair: ") + what) {}
27 StorageError(
const std::string& what) :
Error(std::string(
"Storage error: ") + what) {}
31 ServerError(
const std::string& what) :
Error(std::string(
"Server error: ") + what) {}
40 std::shared_ptr<INvStorage> storage_;
41 std::shared_ptr<HttpInterface> http_client_;
43 const std::map<Uptane::EcuSerial, Uptane::SecondaryInterface::Ptr>& secondaries_;
47 void initEcuSerials();
48 void resetEcuSerials();
49 void initPrimaryEcuKeys();
53 void initEcuRegister();
54 bool loadSetTlsCreds();
55 void initEcuReportCounter();
58 #endif // INITIALIZER_H_