Aktualizr
C++ SOTA Client
All Classes Namespaces Files Functions Variables Enumerations Enumerator Pages
manifest.h
1 #ifndef AKTUALIZR_UPTANE_MANIFEST_H
2 #define AKTUALIZR_UPTANE_MANIFEST_H
3 
4 #include <memory>
5 
6 #include "json/json.h"
7 
8 #include "crypto/crypto.h"
9 #include "tuf.h"
10 
11 class KeyManager;
12 
13 namespace Uptane {
14 
15 class Manifest : public Json::Value {
16  public:
17  Manifest(const Json::Value &value = Json::Value()) : Json::Value(value) {}
18 
19  public:
20  std::string filepath() const;
21  Hash installedImageHash() const;
22  std::string signature() const;
23  std::string signedBody() const;
24  bool verifySignature(const PublicKey &pub_key) const;
25 };
26 
28  public:
29  using Ptr = std::shared_ptr<ManifestIssuer>;
30 
31  public:
32  ManifestIssuer(std::shared_ptr<KeyManager> &key_mngr, Uptane::EcuSerial ecu_serial)
33  : ecu_serial_(std::move(ecu_serial)), key_mngr_(key_mngr) {}
34 
35  static Manifest assembleManifest(const InstalledImageInfo &installed_image_info, const Uptane::EcuSerial &ecu_serial);
36  static Hash generateVersionHash(const std::string &data);
37  static std::string generateVersionHashStr(const std::string &data);
38 
39  Manifest sign(const Manifest &manifest, const std::string &report_counter = "") const;
40 
41  Manifest assembleManifest(const InstalledImageInfo &installed_image_info) const;
42  Manifest assembleManifest(const Uptane::Target &target) const;
43 
44  Manifest assembleAndSignManifest(const InstalledImageInfo &installed_image_info) const;
45 
46  private:
47  const Uptane::EcuSerial ecu_serial_;
48  std::shared_ptr<KeyManager> key_mngr_;
49 };
50 
51 } // namespace Uptane
52 
53 #endif // AKTUALIZR_UPTANE_MANIFEST_H
General data structures.
Definition: types.cc:55
The hash of a file or Uptane metadata.
Definition: crypto.h:65
Base data types that are used in The Update Framework (TUF), part of Uptane.