From d374c4d3d98d70a9116bc15b0372962139584d4c Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Tue, 10 Dec 2024 13:52:25 +0100 Subject: [PATCH] Add names as string to the keystore classes Allow checking which one is selected by name. --- lib/keystore.hh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/keystore.hh b/lib/keystore.hh index 53fd53530a..6139004c0f 100644 --- a/lib/keystore.hh +++ b/lib/keystore.hh @@ -10,11 +10,13 @@ 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 { @@ -22,7 +24,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_fs(): keystore("fs") {}; private: rpmRC delete_key(rpmtxn txn, const std::string & keyid, const std::string & newname = ""); }; @@ -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); }; @@ -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 */