Aktualizr
C++ SOTA Client
partialverificationsecondary.h
1 #ifndef UPTANE_PARTIALVRIFICATIONSECONDARY_H_
2 #define UPTANE_PARTIALVRIFICATIONSECONDARY_H_
3 
4 #include <string>
5 #include <vector>
6 
7 #include <boost/filesystem.hpp>
8 #include "json/json.h"
9 
10 #include "uptane/secondaryconfig.h"
11 #include "uptane/secondaryinterface.h"
12 #include "utilities/types.h"
13 
14 namespace Uptane {
15 
17  public:
18  explicit PartialVerificationSecondary(const SecondaryConfig& sconfig_in);
19 
20  EcuSerial getSerial() override {
21  if (!sconfig.ecu_serial.empty()) {
22  return Uptane::EcuSerial(sconfig.ecu_serial);
23  }
24  return Uptane::EcuSerial(public_key_.KeyId());
25  }
26  PublicKey getPublicKey() override { return public_key_; }
27 
28  bool putMetadata(const RawMetaPack& meta) override;
29  int getRootVersion(bool director) override;
30  bool putRoot(const std::string& root, bool director) override;
31 
32  bool sendFirmwareAsync(const std::shared_ptr<std::string>& data) override;
33  Json::Value getManifest() override;
34 
35  private:
36  void storeKeys(const std::string& public_key, const std::string& private_key);
37  bool loadKeys(std::string* public_key, std::string* private_key);
38 
39  Uptane::Root root_;
40  PublicKey public_key_;
41  std::string private_key_;
42 
43  std::string detected_attack_;
44  Uptane::Targets meta_targets_;
45 };
46 } // namespace Uptane
47 
48 #endif // UPTANE_PARTIALVRIFICATIONSECONDARY_H_
General data structures.
Definition: types.cc:6
Base data types that are used in The Update Framework (TUF), part of UPTANE.