PLDM:OEM Pass service authorization credentials to PHYP

This commit implements a mechanism to pass the service agent's
credentials along with a request to invoke a PHYP macro. This is
known as Resource Dump with authentication.

-The setting for this is: the service agent is authenticated to
the BMC and is performing an operation to invoke a PHYP macro.
-The credentials that need to be passed into the request include
the ACF (Authentication Certificate File)
(which can be copied from the BMC's file system) and
the service account's password that goes with that ACF.
-The credentials are optionally provided.

Signed-off-by: Pavithra Barithaya <pavithra.b@ibm.com>
Change-Id: Ie05838cf717015684806d7fd11744ebdd16597a5
diff --git a/oem/ibm/requester/dbus_to_file_handler.cpp b/oem/ibm/requester/dbus_to_file_handler.cpp
index 7b4e83f..4091ac6 100644
--- a/oem/ibm/requester/dbus_to_file_handler.cpp
+++ b/oem/ibm/requester/dbus_to_file_handler.cpp
@@ -11,7 +11,6 @@
 {
 namespace oem_ibm
 {
-
 using namespace pldm::utils;
 using namespace sdbusplus::bus::match::rules;
 
@@ -156,12 +155,36 @@
     fileFunc(vspString);
     fileFunc(resDumpReqPass);
 
+    std::string str;
+    if (!resDumpReqPass.empty())
+    {
+        str = getAcfFileContent();
+    }
+
+    fileFunc(str);
+
     fileHandle.close();
     size_t fileSize = fs::file_size(resDumpFilePath);
 
     sendNewFileAvailableCmd(fileSize);
 }
 
+std::string DbusToFileHandler::getAcfFileContent()
+{
+    std::string str;
+    static constexpr auto acfDirPath = "/etc/acf/service.acf";
+    if (fs::exists(acfDirPath))
+    {
+        std::ifstream file;
+        file.open(acfDirPath);
+        std::stringstream acfBuf;
+        acfBuf << file.rdbuf();
+        str = acfBuf.str();
+        file.close();
+    }
+    return str;
+}
+
 void DbusToFileHandler::newCsrFileAvailable(const std::string& csr,
                                             const std::string fileHandle)
 {
diff --git a/oem/ibm/requester/dbus_to_file_handler.hpp b/oem/ibm/requester/dbus_to_file_handler.hpp
index d415d1d..f527f2c 100644
--- a/oem/ibm/requester/dbus_to_file_handler.hpp
+++ b/oem/ibm/requester/dbus_to_file_handler.hpp
@@ -15,7 +15,6 @@
 {
 namespace oem_ibm
 {
-
 /** @class DbusToFileHandler
  *  @brief This class can process resource dump parameters and send PLDM
  *         new file available cmd to the hypervisor. This class can be used
@@ -75,6 +74,9 @@
      */
     void reportResourceDumpFailure();
 
+    /** @brief method to get the acf file contents */
+    std::string getAcfFileContent();
+
     /** @brief fd of MCTP communications socket */
     int mctp_fd;