Skip to content

Commit

Permalink
Add names as string to the keystore classes
Browse files Browse the repository at this point in the history
Allow checking which one is selected by name.
  • Loading branch information
ffesti committed Jan 29, 2025
1 parent 96c2c2d commit 3ae75f1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/keystore.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@ namespace rpm {

class keystore {
public:
const std::string name;
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring) = 0;
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0) = 0;
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key) = 0;

virtual ~keystore() = default;
keystore(std::string n): name(n) {};
};

class keystore_fs : public keystore {
public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0);
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key);

keystore_fs(): keystore("fs") {};
private:
rpmRC delete_key(rpmtxn txn, const std::string & keyid, const std::string & newname = "");
};
Expand All @@ -32,7 +34,7 @@ public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0);
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key);

keystore_rpmdb(): keystore("rpmdb") {};
private:
rpmRC delete_key(rpmtxn txn, const std::string & keyid, unsigned int newinstance = 0);
};
Expand All @@ -42,6 +44,7 @@ public:
virtual rpmRC load_keys(rpmtxn txn, rpmKeyring keyring);
virtual rpmRC import_key(rpmtxn txn, rpmPubkey key, int replace = 1, rpmFlags flags = 0);
virtual rpmRC delete_key(rpmtxn txn, rpmPubkey key);
keystore_openpgp_cert_d(): keystore("openpgp") {};
};

}; /* namespace */
Expand Down

0 comments on commit 3ae75f1

Please sign in to comment.