1 #pragma once 2 3 #include "xyz/openbmc_project/Certs/Entry/server.hpp" 4 #include "xyz/openbmc_project/Object/Delete/server.hpp" 5 #include "xyz/openbmc_project/PLDM/Provider/Certs/Authority/CSR/server.hpp" 6 7 #include <sdbusplus/bus.hpp> 8 #include <sdbusplus/server/object.hpp> 9 10 namespace ca 11 { 12 namespace cert 13 { 14 15 namespace internal 16 { 17 using EntryInterface = sdbusplus::server::object_t< 18 sdbusplus::xyz::openbmc_project::PLDM::Provider::Certs::Authority::server:: 19 CSR, 20 sdbusplus::xyz::openbmc_project::Certs::server::Entry, 21 sdbusplus::xyz::openbmc_project::Object::server::Delete>; 22 } 23 24 class CACertMgr; 25 26 /** @class Entry 27 * @brief CA authority certificate Entry implementation. 28 * @details A concrete implementation for the 29 * xyz.openbmc_project.Certs.Entry DBus API 30 */ 31 class Entry : public internal::EntryInterface 32 { 33 public: 34 Entry() = delete; 35 Entry(const Entry&) = delete; 36 Entry& operator=(const Entry&) = delete; 37 Entry(Entry&&) = delete; 38 Entry& operator=(Entry&&) = delete; 39 ~Entry() = default; 40 41 /** @brief Constructor to put object onto bus at a D-Bus path. 42 * @param[in] bus - Bus to attach to. 43 * @param[in] objPath - The D-Bus object path to attach at. 44 * @param[in] entryId - Entry id 45 * @param[in] csr - csr string 46 * @param[in] cert - client certificate 47 */ Entry(sdbusplus::bus_t & bus,const std::string & objPath,uint32_t entryId,std::string & csr,std::string & cert,CACertMgr & manager)48 Entry(sdbusplus::bus_t& bus, const std::string& objPath, uint32_t entryId, 49 std::string& csr, std::string& cert, CACertMgr& manager) : 50 internal::EntryInterface(bus, objPath.c_str(), 51 internal::EntryInterface::action::defer_emit), 52 bus(bus), id(entryId), manager(manager) 53 54 { 55 this->csr(csr); 56 clientCertificate(cert); 57 58 // Emit deferred signal. 59 this->emit_object_added(); 60 }; 61 62 void delete_() override; 63 64 protected: 65 /** @brief sdbusplus handler */ 66 sdbusplus::bus_t& bus; 67 uint32_t id; 68 /** @brief object path */ 69 std::string objectPath; 70 /** @brief Reference to Certificate Manager */ 71 CACertMgr& manager; 72 }; 73 } // namespace cert 74 } // namespace ca 75