1cfbc8dc8SJayanth Othayoth #include "certs_manager.hpp" 2cfbc8dc8SJayanth Othayoth 3*6ceec40bSMarri Devender Rao #include <phosphor-logging/elog-errors.hpp> 4*6ceec40bSMarri Devender Rao #include <xyz/openbmc_project/Certs/Install/error.hpp> 5cfbc8dc8SJayanth Othayoth #include <xyz/openbmc_project/Common/error.hpp> 6cfbc8dc8SJayanth Othayoth 7cfbc8dc8SJayanth Othayoth namespace phosphor 8cfbc8dc8SJayanth Othayoth { 9cfbc8dc8SJayanth Othayoth namespace certs 10cfbc8dc8SJayanth Othayoth { 11cfbc8dc8SJayanth Othayoth 12cfbc8dc8SJayanth Othayoth using InternalFailure = 13cfbc8dc8SJayanth Othayoth sdbusplus::xyz::openbmc_project::Common::Error::InternalFailure; 14*6ceec40bSMarri Devender Rao using Reason = xyz::openbmc_project::Certs::Install::InvalidCertificate::REASON; 15cfbc8dc8SJayanth Othayoth 16*6ceec40bSMarri Devender Rao /** @brief Constructor to put object onto bus at a dbus path. 17*6ceec40bSMarri Devender Rao * @param[in] bus - Bus to attach to. 18*6ceec40bSMarri Devender Rao * @param[in] path - Path to attach at. 19*6ceec40bSMarri Devender Rao * @param[in] type - Type of the certificate. 20*6ceec40bSMarri Devender Rao * @param[in] unit - Unit consumed by this certificate. 21*6ceec40bSMarri Devender Rao * @param[in] installPath - Certificate installation path. 22*6ceec40bSMarri Devender Rao */ 23*6ceec40bSMarri Devender Rao Manager::Manager(sdbusplus::bus::bus& bus, const char* path, 24*6ceec40bSMarri Devender Rao const CertificateType& type, UnitsToRestart&& unit, 25*6ceec40bSMarri Devender Rao CertInstallPath&& installPath) : 26*6ceec40bSMarri Devender Rao Ifaces(bus, path), 27*6ceec40bSMarri Devender Rao bus(bus), objectPath(path), certType(type), unitToRestart(std::move(unit)), 28*6ceec40bSMarri Devender Rao certInstallPath(std::move(installPath)) 29cfbc8dc8SJayanth Othayoth { 30dd74bd20SJayanth Othayoth } 31589159f2SJayanth Othayoth 32*6ceec40bSMarri Devender Rao void Manager::install(const std::string filePath) 33cfbc8dc8SJayanth Othayoth { 34589159f2SJayanth Othayoth } 35ae70b3daSDeepak Kodihalli 36ae70b3daSDeepak Kodihalli void Manager::delete_() 37ae70b3daSDeepak Kodihalli { 38*6ceec40bSMarri Devender Rao // TODO: #Issue 4 when a certificate is deleted system auto generates 39*6ceec40bSMarri Devender Rao // certificate file. At present we are not supporting creation of 40*6ceec40bSMarri Devender Rao // certificate object for the auto-generated certificate file as 41*6ceec40bSMarri Devender Rao // deletion if only applicable for REST server and Bmcweb does not allow 42*6ceec40bSMarri Devender Rao // deletion of certificates 43*6ceec40bSMarri Devender Rao if (certificatePtr != nullptr) 44ae70b3daSDeepak Kodihalli { 45*6ceec40bSMarri Devender Rao certificatePtr.reset(nullptr); 46ae70b3daSDeepak Kodihalli } 47ae70b3daSDeepak Kodihalli } 48cfbc8dc8SJayanth Othayoth } // namespace certs 49cfbc8dc8SJayanth Othayoth } // namespace phosphor 50