blob: 05d5ba66acca5de0faec60e3c6b2a3a255e3d296 [file] [log] [blame]
Marri Devender Raof4d63482019-05-02 06:35:34 -05001#pragma once
Nan Zhou014be0b2021-12-28 18:00:14 -08002#include <sdbusplus/server/object.hpp>
Nan Zhoucf06ccd2021-12-28 16:25:45 -08003#include <string>
Marri Devender Raof4d63482019-05-02 06:35:34 -05004#include <xyz/openbmc_project/Certs/CSR/server.hpp>
5
Nan Zhoue1289ad2021-12-28 11:02:56 -08006namespace phosphor::certs
Marri Devender Raof4d63482019-05-02 06:35:34 -05007{
Marri Devender Raof4d63482019-05-02 06:35:34 -05008
9enum class Status
10{
11 SUCCESS,
12 FAILURE,
13};
14
Nan Zhoucf06ccd2021-12-28 16:25:45 -080015namespace internal
16{
17using CSRInterface = sdbusplus::server::object_t<
18 sdbusplus::xyz::openbmc_project::Certs::server::CSR>;
19}
Marri Devender Raof4d63482019-05-02 06:35:34 -050020
21/** @class CSR
22 * @brief To read CSR certificate
23 */
Nan Zhoucf06ccd2021-12-28 16:25:45 -080024class CSR : public internal::CSRInterface
Marri Devender Raof4d63482019-05-02 06:35:34 -050025{
26 public:
27 CSR() = delete;
28 ~CSR() = default;
29 CSR(const CSR&) = delete;
30 CSR& operator=(const CSR&) = delete;
Nan Zhoucf06ccd2021-12-28 16:25:45 -080031 CSR(CSR&&) = delete;
32 CSR& operator=(CSR&&) = delete;
Marri Devender Raof4d63482019-05-02 06:35:34 -050033
34 /** @brief Constructor to put object onto bus at a D-Bus path.
35 * @param[in] bus - Bus to attach to.
36 * @param[in] path - The D-Bus object path to attach at.
37 * @param[in] installPath - Certificate installation path.
38 * @param[in] status - Status of Generate CSR request
39 */
Patrick Williamsb3dbfb32022-07-22 19:26:57 -050040 CSR(sdbusplus::bus_t& bus, const char* path, std::string&& installPath,
Nan Zhoucf06ccd2021-12-28 16:25:45 -080041 const Status& status);
Marri Devender Raof4d63482019-05-02 06:35:34 -050042 /** @brief Return CSR
43 */
Patrick Williamse129be32021-04-30 20:35:19 -050044 std::string csr() override;
Marri Devender Raof4d63482019-05-02 06:35:34 -050045
46 private:
Marri Devender Raof4d63482019-05-02 06:35:34 -050047 /** @brief object path */
48 std::string objectPath;
49
50 /** @brief Certificate file installation path **/
Nan Zhoucf06ccd2021-12-28 16:25:45 -080051 std::string certInstallPath;
Marri Devender Raof4d63482019-05-02 06:35:34 -050052
53 /** @brief Status of GenerateCSR request */
54 Status csrStatus;
55};
Nan Zhoue1289ad2021-12-28 11:02:56 -080056} // namespace phosphor::certs