6 #include <crypto/crypto.h>
7 #include <boost/filesystem.hpp>
9 #include "uptane/tuf.h"
14 : public_key(std::move(public_key_in)), private_key(std::move(private_key_in)) {}
16 std::string private_key;
21 Delegation(
const boost::filesystem::path &repo_path, std::string delegation_name);
22 bool isMatched(
const boost::filesystem::path &image_path)
const {
23 return (fnmatch(pattern.c_str(), image_path.c_str(), 0) == 0);
25 operator bool()
const {
return (!name.empty() && !pattern.empty()); }
30 static std::string findPatternInTree(
const boost::filesystem::path &repo_path,
const std::string &name,
31 const Json::Value &targets_json);
37 std::string correlation_id);
38 void generateRepo(KeyType key_type = KeyType::kRSA2048);
39 Json::Value getTarget(
const std::string &target_name);
40 Json::Value signTuf(
const Uptane::Role &role,
const Json::Value &json);
41 void generateCampaigns()
const;
45 void generateRepoKeys(KeyType key_type);
46 void generateKeyPair(KeyType key_type,
const Uptane::Role &key_name);
47 static std::string getExpirationTime(
const std::string &expires);
51 boost::filesystem::path path_;
52 boost::filesystem::path repo_dir_;
53 std::string correlation_id_;
54 std::string expiration_time_;
55 std::map<Uptane::Role, KeyPair> keys_;
58 void addDelegationToSnapshot(Json::Value *snapshot,
const Uptane::Role &role);