Marri Devender Rao | f4d6348 | 2019-05-02 06:35:34 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | #include <xyz/openbmc_project/Certs/CSR/server.hpp> |
| 3 | |
Nan Zhou | e1289ad | 2021-12-28 11:02:56 -0800 | [diff] [blame] | 4 | namespace phosphor::certs |
Marri Devender Rao | f4d6348 | 2019-05-02 06:35:34 -0500 | [diff] [blame] | 5 | { |
| 6 | using CSRRead = sdbusplus::xyz::openbmc_project::Certs::server::CSR; |
| 7 | using CSRIface = sdbusplus::server::object::object<CSRRead>; |
| 8 | |
| 9 | enum class Status |
| 10 | { |
| 11 | SUCCESS, |
| 12 | FAILURE, |
| 13 | }; |
| 14 | |
| 15 | using CertInstallPath = std::string; |
| 16 | |
| 17 | /** @class CSR |
| 18 | * @brief To read CSR certificate |
| 19 | */ |
| 20 | class CSR : public CSRIface |
| 21 | { |
| 22 | public: |
| 23 | CSR() = delete; |
| 24 | ~CSR() = default; |
| 25 | CSR(const CSR&) = delete; |
| 26 | CSR& operator=(const CSR&) = delete; |
| 27 | CSR(CSR&&) = default; |
| 28 | CSR& operator=(CSR&&) = default; |
| 29 | |
| 30 | /** @brief Constructor to put object onto bus at a D-Bus path. |
| 31 | * @param[in] bus - Bus to attach to. |
| 32 | * @param[in] path - The D-Bus object path to attach at. |
| 33 | * @param[in] installPath - Certificate installation path. |
| 34 | * @param[in] status - Status of Generate CSR request |
| 35 | */ |
| 36 | CSR(sdbusplus::bus::bus& bus, const char* path, |
| 37 | CertInstallPath&& installPath, const Status& status); |
| 38 | /** @brief Return CSR |
| 39 | */ |
Patrick Williams | e129be3 | 2021-04-30 20:35:19 -0500 | [diff] [blame] | 40 | std::string csr() override; |
Marri Devender Rao | f4d6348 | 2019-05-02 06:35:34 -0500 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | /** @brief sdbusplus handler */ |
| 44 | sdbusplus::bus::bus& bus; |
| 45 | |
| 46 | /** @brief object path */ |
| 47 | std::string objectPath; |
| 48 | |
| 49 | /** @brief Certificate file installation path **/ |
| 50 | CertInstallPath certInstallPath; |
| 51 | |
| 52 | /** @brief Status of GenerateCSR request */ |
| 53 | Status csrStatus; |
| 54 | }; |
Nan Zhou | e1289ad | 2021-12-28 11:02:56 -0800 | [diff] [blame] | 55 | } // namespace phosphor::certs |