blob: aa47cf61d6d13ab476aba6408790b29ac1069fb1 [file] [log] [blame]
Marri Devender Raof4d63482019-05-02 06:35:34 -05001#pragma once
Nan Zhoucf06ccd2021-12-28 16:25:45 -08002#include <string>
Marri Devender Raof4d63482019-05-02 06:35:34 -05003#include <xyz/openbmc_project/Certs/CSR/server.hpp>
4
Nan Zhoue1289ad2021-12-28 11:02:56 -08005namespace phosphor::certs
Marri Devender Raof4d63482019-05-02 06:35:34 -05006{
Marri Devender Raof4d63482019-05-02 06:35:34 -05007
8enum class Status
9{
10 SUCCESS,
11 FAILURE,
12};
13
Nan Zhoucf06ccd2021-12-28 16:25:45 -080014namespace internal
15{
16using CSRInterface = sdbusplus::server::object_t<
17 sdbusplus::xyz::openbmc_project::Certs::server::CSR>;
18}
Marri Devender Raof4d63482019-05-02 06:35:34 -050019
20/** @class CSR
21 * @brief To read CSR certificate
22 */
Nan Zhoucf06ccd2021-12-28 16:25:45 -080023class CSR : public internal::CSRInterface
Marri Devender Raof4d63482019-05-02 06:35:34 -050024{
25 public:
26 CSR() = delete;
27 ~CSR() = default;
28 CSR(const CSR&) = delete;
29 CSR& operator=(const CSR&) = delete;
Nan Zhoucf06ccd2021-12-28 16:25:45 -080030 CSR(CSR&&) = delete;
31 CSR& operator=(CSR&&) = delete;
Marri Devender Raof4d63482019-05-02 06:35:34 -050032
33 /** @brief Constructor to put object onto bus at a D-Bus path.
34 * @param[in] bus - Bus to attach to.
35 * @param[in] path - The D-Bus object path to attach at.
36 * @param[in] installPath - Certificate installation path.
37 * @param[in] status - Status of Generate CSR request
38 */
Nan Zhoucf06ccd2021-12-28 16:25:45 -080039 CSR(sdbusplus::bus::bus& bus, const char* path, std::string&& installPath,
40 const Status& status);
Marri Devender Raof4d63482019-05-02 06:35:34 -050041 /** @brief Return CSR
42 */
Patrick Williamse129be32021-04-30 20:35:19 -050043 std::string csr() override;
Marri Devender Raof4d63482019-05-02 06:35:34 -050044
45 private:
Marri Devender Raof4d63482019-05-02 06:35:34 -050046 /** @brief object path */
47 std::string objectPath;
48
49 /** @brief Certificate file installation path **/
Nan Zhoucf06ccd2021-12-28 16:25:45 -080050 std::string certInstallPath;
Marri Devender Raof4d63482019-05-02 06:35:34 -050051
52 /** @brief Status of GenerateCSR request */
53 Status csrStatus;
54};
Nan Zhoue1289ad2021-12-28 11:02:56 -080055} // namespace phosphor::certs