diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ffc955..694e27d 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -95,3 +95,67 @@
      ${PROJECT_SOURCE_DIR}/service_files/xyz.openbmc_project.cpuinfo.service
      ${PROJECT_SOURCE_DIR}/service_files/smbios-mdrv2.service)
 install (FILES ${SERVICE_FILES} DESTINATION /lib/systemd/system/)
+
+option (IPMI_BLOB "Add IPMI Blobs" ON)
+
+if (IPMI_BLOB)
+    include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src/smbios-ipmi-blobs)
+    add_library (smbiosstore SHARED src/smbios-ipmi-blobs/handler.cpp
+                 src/smbios-ipmi-blobs/main.cpp)
+    set_target_properties (smbiosstore PROPERTIES VERSION "0.0.0")
+    set_target_properties (smbiosstore PROPERTIES SOVERSION "0")
+    target_link_libraries (smbiosstore sdbusplus)
+    target_link_libraries (smbiosstore phosphor_logging)
+    install (TARGETS smbiosstore DESTINATION lib/ipmid-providers)
+
+    if (NOT YOCTO)
+        add_dependencies (smbiosstore phosphor-host-ipmid phosphor-ipmi-blobs)
+
+        file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/prefix)
+        externalproject_add (
+            phosphor-host-ipmid PREFIX ${CMAKE_BINARY_DIR}/phosphor-host-ipmid
+            GIT_REPOSITORY https://github.com/openbmc/phosphor-host-ipmid
+            SOURCE_DIR ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src
+            CONFIGURE_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src &&
+            ./bootstrap.sh && ./configure --prefix=${CMAKE_BINARY_DIR}/prefix
+            BUILD_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src && make
+            INSTALL_COMMAND cd ${CMAKE_BINARY_DIR}/phosphor-host-ipmid-src &&
+            make install LOG_DOWNLOAD ON)
+        include_directories (${CMAKE_BINARY_DIR}/prefix/include)
+        link_directories (${CMAKE_BINARY_DIR}/prefix/lib)
+
+        externalproject_add (
+            phosphor-ipmi-blobs PREFIX ${CMAKE_BINARY_DIR}/phosphor-ipmi-blobs
+            GIT_REPOSITORY https://github.com/openbmc/phosphor-ipmi-blobs
+            SOURCE_DIR ${CMAKE_BINARY_DIR}/phosphor-ipmi-blobs-src
+            CONFIGURE_COMMAND "" BUILD_COMMAND "" INSTALL_COMMAND "")
+        include_directories (${CMAKE_BINARY_DIR}/phosphor-ipmi-blobs-src)
+
+        # unit tests
+        set (BLOB_TEST_SRC src/smbios-ipmi-blobs/test)
+
+        find_package (GTest REQUIRED)
+
+        enable_testing ()
+
+        add_executable (runBlobBasic ${BLOB_TEST_SRC}/handler_unittest.cpp)
+        add_test (NAME test_blobbasic COMMAND runBlobBasic)
+        target_link_libraries (runBlobBasic smbiosstore ${GTEST_BOTH_LIBRARIES})
+
+        add_executable (runBlobOpen ${BLOB_TEST_SRC}/handler_open_unittest.cpp)
+        add_test (NAME test_blobopen COMMAND runBlobOpen)
+        target_link_libraries (runBlobOpen smbiosstore ${GTEST_BOTH_LIBRARIES})
+
+        add_executable (runBlobReadWrite
+                        ${BLOB_TEST_SRC}/handler_readwrite_unittest.cpp)
+        add_test (NAME test_blobreadwrite COMMAND runBlobReadWrite)
+        target_link_libraries (runBlobReadWrite
+            smbiosstore -lgmock -lgmock_main ${GTEST_BOTH_LIBRARIES})
+
+        add_executable (runBlobStatClose
+                        ${BLOB_TEST_SRC}/handler_statclose_unittest.cpp)
+        add_test (NAME test_blobStatClose COMMAND runBlobStatClose)
+        target_link_libraries (runBlobStatClose smbiosstore
+                               ${GTEST_BOTH_LIBRARIES})
+    endif ()
+endif ()
diff --git a/src/smbios-ipmi-blobs/handler.cpp b/src/smbios-ipmi-blobs/handler.cpp
new file mode 100644
index 0000000..51d9d95
--- /dev/null
+++ b/src/smbios-ipmi-blobs/handler.cpp
@@ -0,0 +1,280 @@
+#include "handler.hpp"
+
+#include "mdrv2.hpp"
+#include "smbios_mdrv2.hpp"
+
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <ipmid/api.hpp>
+#include <phosphor-logging/log.hpp>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/exception.hpp>
+#include <sdbusplus/message.hpp>
+
+#include <algorithm>
+#include <cstdint>
+#include <ctime>
+#include <fstream>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace blobs
+{
+
+namespace internal
+{
+
+constexpr const char* mdrV2Service = "xyz.openbmc_project.Smbios.MDR_V2";
+constexpr const char* mdrV2Interface = "xyz.openbmc_project.Smbios.MDR_V2";
+
+bool syncSmbiosData()
+{
+    bool status = false;
+    sdbusplus::bus::bus bus =
+        sdbusplus::bus::bus(ipmid_get_sd_bus_connection());
+    sdbusplus::message::message method =
+        bus.new_method_call(mdrV2Service, phosphor::smbios::mdrV2Path,
+                            mdrV2Interface, "AgentSynchronizeData");
+
+    try
+    {
+        sdbusplus::message::message reply = bus.call(method);
+        reply.read(status);
+    }
+    catch (sdbusplus::exception_t& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Error Sync data with service",
+            phosphor::logging::entry("ERROR=%s", e.what()),
+            phosphor::logging::entry("SERVICE=%s", mdrV2Service),
+            phosphor::logging::entry("PATH=%s", phosphor::smbios::mdrV2Path));
+        return false;
+    }
+
+    if (!status)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Sync data with service failure");
+        return false;
+    }
+
+    return true;
+}
+
+} // namespace internal
+
+bool SmbiosBlobHandler::canHandleBlob(const std::string& path)
+{
+    return path == blobId;
+}
+
+std::vector<std::string> SmbiosBlobHandler::getBlobIds()
+{
+    return std::vector<std::string>(1, blobId);
+}
+
+bool SmbiosBlobHandler::deleteBlob(const std::string& path)
+{
+    return false;
+}
+
+bool SmbiosBlobHandler::stat(const std::string& path, struct BlobMeta* meta)
+{
+    if (!blobPtr || blobPtr->blobId != path)
+    {
+        return false;
+    }
+
+    meta->size = blobPtr->buffer.size();
+    meta->blobState = blobPtr->state;
+    return true;
+}
+
+bool SmbiosBlobHandler::open(uint16_t session, uint16_t flags,
+                             const std::string& path)
+{
+    if (flags & blobs::OpenFlags::read)
+    {
+        /* Disable the read operation. */
+        return false;
+    }
+
+    /* The handler only allows one session. If an open blob exists, return
+     * false directly.
+     */
+    if (blobPtr)
+    {
+        return false;
+    }
+    blobPtr = std::make_unique<SmbiosBlob>(session, path, flags);
+    return true;
+}
+
+std::vector<uint8_t> SmbiosBlobHandler::read(uint16_t session, uint32_t offset,
+                                             uint32_t requestedSize)
+{
+    /* SMBIOS blob handler does not support read. */
+    return std::vector<uint8_t>();
+}
+
+bool SmbiosBlobHandler::write(uint16_t session, uint32_t offset,
+                              const std::vector<uint8_t>& data)
+{
+    if (!blobPtr || blobPtr->sessionId != session)
+    {
+        return false;
+    }
+
+    if (!(blobPtr->state & blobs::StateFlags::open_write))
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "No open blob to write");
+        return false;
+    }
+
+    /* Is the offset beyond the array? */
+    if (offset >= maxBufferSize)
+    {
+        return false;
+    }
+
+    /* Determine whether all their bytes will fit. */
+    uint32_t remain = maxBufferSize - offset;
+    if (data.size() > remain)
+    {
+        return false;
+    }
+
+    /* Resize the buffer if what we're writing will go over the size */
+    uint32_t newBufferSize = data.size() + offset;
+    if (newBufferSize > blobPtr->buffer.size())
+    {
+        blobPtr->buffer.resize(newBufferSize);
+    }
+
+    std::memcpy(blobPtr->buffer.data() + offset, data.data(), data.size());
+    return true;
+}
+
+bool SmbiosBlobHandler::writeMeta(uint16_t session, uint32_t offset,
+                                  const std::vector<uint8_t>& data)
+{
+    return false;
+}
+
+bool SmbiosBlobHandler::commit(uint16_t session,
+                               const std::vector<uint8_t>& data)
+{
+    if (!data.empty())
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Unexpected data provided to commit call");
+        return false;
+    }
+
+    if (!blobPtr || blobPtr->sessionId != session)
+    {
+        return false;
+    }
+
+    /* If a blob is committing or commited, return true directly. But if last
+     * commit fails, may try to commit again.
+     */
+    if (blobPtr->state &
+        (blobs::StateFlags::committing | blobs::StateFlags::committed))
+    {
+        return true;
+    }
+
+    /* Clear the commit_error bit. */
+    blobPtr->state &= ~blobs::StateFlags::commit_error;
+
+    MDRSMBIOSHeader mdrHdr;
+    mdrHdr.mdrType = mdrTypeII;
+    mdrHdr.timestamp = std::time(nullptr);
+    mdrHdr.dataSize = blobPtr->buffer.size();
+    if (access(smbiosPath, F_OK) == -1)
+    {
+        int flag = mkdir(smbiosPath, S_IRWXU);
+        if (flag != 0)
+        {
+            phosphor::logging::log<phosphor::logging::level::ERR>(
+                "create folder failed for writting smbios file");
+            blobPtr->state |= blobs::StateFlags::commit_error;
+            return false;
+        }
+    }
+
+    std::ofstream smbiosFile(mdrType2File,
+                             std::ios_base::binary | std::ios_base::trunc);
+    if (!smbiosFile.good())
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Write data from flash error - Open SMBIOS table file failure");
+        blobPtr->state |= blobs::StateFlags::commit_error;
+        return false;
+    }
+
+    smbiosFile.exceptions(std::ofstream::badbit | std::ofstream::failbit);
+    try
+    {
+        smbiosFile.write(reinterpret_cast<char*>(&mdrHdr),
+                         sizeof(MDRSMBIOSHeader));
+        smbiosFile.write(reinterpret_cast<char*>(blobPtr->buffer.data()),
+                         mdrHdr.dataSize);
+        blobPtr->state |= blobs::StateFlags::committing;
+    }
+    catch (std::ofstream::failure& e)
+    {
+        phosphor::logging::log<phosphor::logging::level::ERR>(
+            "Write data from flash error - write data error",
+            phosphor::logging::entry("ERROR=%s", e.what()));
+        blobPtr->state |= blobs::StateFlags::commit_error;
+        return false;
+    }
+
+    if (!internal::syncSmbiosData())
+    {
+        blobPtr->state &= ~blobs::StateFlags::committing;
+        blobPtr->state |= blobs::StateFlags::commit_error;
+        return false;
+    }
+
+    // Unset committing state and set committed state
+    blobPtr->state &= ~blobs::StateFlags::committing;
+    blobPtr->state |= blobs::StateFlags::committed;
+
+    return true;
+}
+
+bool SmbiosBlobHandler::close(uint16_t session)
+{
+    if (!blobPtr || blobPtr->sessionId != session)
+    {
+        return false;
+    }
+
+    blobPtr = nullptr;
+    return true;
+}
+
+bool SmbiosBlobHandler::stat(uint16_t session, struct BlobMeta* meta)
+{
+    if (!blobPtr || blobPtr->sessionId != session)
+    {
+        return false;
+    }
+
+    meta->size = blobPtr->buffer.size();
+    meta->blobState = blobPtr->state;
+    return true;
+}
+
+bool SmbiosBlobHandler::expire(uint16_t session)
+{
+    return close(session);
+}
+
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/handler.hpp b/src/smbios-ipmi-blobs/handler.hpp
new file mode 100644
index 0000000..d97618a
--- /dev/null
+++ b/src/smbios-ipmi-blobs/handler.hpp
@@ -0,0 +1,77 @@
+#pragma once
+
+#include <blobs-ipmid/blobs.hpp>
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace blobs
+{
+
+class SmbiosBlobHandler : public GenericBlobInterface
+{
+  public:
+    SmbiosBlobHandler() = default;
+    ~SmbiosBlobHandler() = default;
+    SmbiosBlobHandler(const SmbiosBlobHandler&) = delete;
+    SmbiosBlobHandler& operator=(const SmbiosBlobHandler&) = delete;
+    SmbiosBlobHandler(SmbiosBlobHandler&&) = default;
+    SmbiosBlobHandler& operator=(SmbiosBlobHandler&&) = default;
+
+    struct SmbiosBlob
+    {
+        SmbiosBlob(uint16_t id, const std::string& path, uint16_t flags) :
+            sessionId(id), blobId(path), state(0)
+        {
+            if (flags & blobs::OpenFlags::write)
+            {
+                state |= blobs::StateFlags::open_write;
+            }
+
+            /* Pre-allocate the buffer.capacity() with maxBufferSize */
+            buffer.reserve(maxBufferSize);
+        }
+
+        /* The blob handler session id. */
+        uint16_t sessionId;
+
+        /* The identifier for the blob */
+        std::string blobId;
+
+        /* The current state. */
+        uint16_t state;
+
+        /* The staging buffer. */
+        std::vector<uint8_t> buffer;
+    };
+
+    bool canHandleBlob(const std::string& path) override;
+    std::vector<std::string> getBlobIds() override;
+    bool deleteBlob(const std::string& path) override;
+    bool stat(const std::string& path, struct BlobMeta* meta) override;
+    bool open(uint16_t session, uint16_t flags,
+              const std::string& path) override;
+    std::vector<uint8_t> read(uint16_t session, uint32_t offset,
+                              uint32_t requestedSize) override;
+    bool write(uint16_t session, uint32_t offset,
+               const std::vector<uint8_t>& data) override;
+    bool writeMeta(uint16_t session, uint32_t offset,
+                   const std::vector<uint8_t>& data) override;
+    bool commit(uint16_t session, const std::vector<uint8_t>& data) override;
+    bool close(uint16_t session) override;
+    bool stat(uint16_t session, struct BlobMeta* meta) override;
+    bool expire(uint16_t session) override;
+
+  private:
+    static constexpr char blobId[] = "/smbios";
+
+    /* SMBIOS table storage size */
+    static constexpr uint32_t maxBufferSize = 64 * 1024;
+
+    /* The handler only allows one open blob. */
+    std::unique_ptr<SmbiosBlob> blobPtr = nullptr;
+};
+
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/main.cpp b/src/smbios-ipmi-blobs/main.cpp
new file mode 100644
index 0000000..5f031dd
--- /dev/null
+++ b/src/smbios-ipmi-blobs/main.cpp
@@ -0,0 +1,10 @@
+#include "handler.hpp"
+
+#include <blobs-ipmid/blobs.hpp>
+
+#include <memory>
+
+extern "C" std::unique_ptr<blobs::GenericBlobInterface> createHandler()
+{
+    return std::make_unique<blobs::SmbiosBlobHandler>();
+}
diff --git a/src/smbios-ipmi-blobs/test/handler_open_unittest.cpp b/src/smbios-ipmi-blobs/test/handler_open_unittest.cpp
new file mode 100644
index 0000000..22223cc
--- /dev/null
+++ b/src/smbios-ipmi-blobs/test/handler_open_unittest.cpp
@@ -0,0 +1,32 @@
+#include "handler_unittest.hpp"
+
+#include <blobs-ipmid/blobs.hpp>
+
+#include <cstdint>
+
+namespace blobs
+{
+
+class SmbiosBlobHandlerOpenTest : public SmbiosBlobHandlerTest
+{};
+
+TEST_F(SmbiosBlobHandlerOpenTest, OpenWithBadFlagsFails)
+{
+    // SMBIOS blob handler disables read flag
+
+    EXPECT_FALSE(handler.open(session, blobs::OpenFlags::read, expectedBlobId));
+}
+
+TEST_F(SmbiosBlobHandlerOpenTest, OpenEverythingSucceeds)
+{
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+}
+
+TEST_F(SmbiosBlobHandlerOpenTest, CannotOpenSameSessionTwice)
+{
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_FALSE(
+        handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+}
+
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/test/handler_readwrite_unittest.cpp b/src/smbios-ipmi-blobs/test/handler_readwrite_unittest.cpp
new file mode 100644
index 0000000..5cd3abc
--- /dev/null
+++ b/src/smbios-ipmi-blobs/test/handler_readwrite_unittest.cpp
@@ -0,0 +1,102 @@
+#include "handler_unittest.hpp"
+
+#include <blobs-ipmid/blobs.hpp>
+
+#include <cstdint>
+#include <vector>
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+using ::testing::IsEmpty;
+
+namespace blobs
+{
+
+class SmbiosBlobHandlerReadWriteTest : public SmbiosBlobHandlerTest
+{};
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, InvalidSessionWriteIsRejected)
+{
+    // Verify the handler checks for a valid session.
+
+    std::vector<uint8_t> data = {0x1, 0x2};
+    EXPECT_FALSE(handler.write(session, 0, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, NoWriteFlagRejected)
+{
+    // Verify the handler checks the write flag;
+
+    EXPECT_TRUE(handler.open(session, 0, expectedBlobId));
+
+    std::vector<uint8_t> data = {0x1, 0x2};
+    EXPECT_FALSE(handler.write(session, 0, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingTooMuchByOneByteFails)
+{
+    int bytes = handlerMaxBufferSize + 1;
+    std::vector<uint8_t> data(bytes, 0x11);
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_FALSE(handler.write(session, 0, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingTooMuchByOffsetOfOne)
+{
+    std::vector<uint8_t> data(handlerMaxBufferSize, 0x11);
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_FALSE(handler.write(session, 1, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingOneByteBeyondEndFromOffsetFails)
+{
+    std::vector<uint8_t> data = {0x01, 0x02};
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_FALSE(handler.write(session, handlerMaxBufferSize - 1, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingOneByteAtOffsetBeyondEndFails)
+{
+    std::vector<uint8_t> data = {0x01};
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_FALSE(handler.write(session, handlerMaxBufferSize, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingFullBufferAtOffsetZeroSucceeds)
+{
+    std::vector<uint8_t> data(handlerMaxBufferSize, 0x01);
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_TRUE(handler.write(session, 0, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, WritingOneByteToTheLastOffsetSucceeds)
+{
+    std::vector<uint8_t> data = {0x01};
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_TRUE(handler.write(session, handlerMaxBufferSize - 1, data));
+}
+
+TEST_F(SmbiosBlobHandlerReadWriteTest, ReadAlwaysReturnsEmpty)
+{
+    const uint32_t testOffset = 0;
+    const std::vector<uint8_t> testData = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_TRUE(handler.write(session, testOffset, testData));
+
+    EXPECT_THAT(handler.read(session, testOffset, testData.size()), IsEmpty());
+
+    for (size_t i = 0; i < testData.size(); ++i)
+    {
+        EXPECT_THAT(handler.read(session, i, 1), IsEmpty());
+    }
+}
+
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/test/handler_statclose_unittest.cpp b/src/smbios-ipmi-blobs/test/handler_statclose_unittest.cpp
new file mode 100644
index 0000000..b8d32cd
--- /dev/null
+++ b/src/smbios-ipmi-blobs/test/handler_statclose_unittest.cpp
@@ -0,0 +1,78 @@
+#include "handler_unittest.hpp"
+
+#include <blobs-ipmid/blobs.hpp>
+
+#include <cstdint>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+
+class SmbiosBlobHandlerStatCloseTest : public SmbiosBlobHandlerTest
+{
+  protected:
+    blobs::BlobMeta meta;
+
+    // Initialize expected_meta_ with empty members
+    blobs::BlobMeta expected_meta_session = {};
+    blobs::BlobMeta expected_meta_path = {};
+};
+
+TEST_F(SmbiosBlobHandlerStatCloseTest, InvalidSessionStatIsRejected)
+{
+    EXPECT_FALSE(handler.stat(session, &meta));
+}
+
+TEST_F(SmbiosBlobHandlerStatCloseTest, SessionStatAlwaysInitialReadAndWrite)
+{
+    // Verify the session stat returns the information for a session.
+
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+
+    EXPECT_TRUE(handler.stat(session, &meta));
+    expected_meta_session.blobState = blobs::StateFlags::open_write;
+    EXPECT_EQ(meta, expected_meta_session);
+
+    EXPECT_TRUE(handler.stat(expectedBlobId, &meta));
+    expected_meta_path.blobState = blobs::StateFlags::open_write;
+    EXPECT_EQ(meta, expected_meta_path);
+}
+
+TEST_F(SmbiosBlobHandlerStatCloseTest, AfterWriteMetadataLengthMatches)
+{
+    // Verify that after writes, the length returned matches.
+
+    std::vector<uint8_t> data = {0x01};
+    EXPECT_TRUE(handler.open(session, blobs::OpenFlags::write, expectedBlobId));
+    EXPECT_TRUE(handler.write(session, handlerMaxBufferSize - 1, data));
+
+    // We wrote one byte to the last index, making the length the buffer size.
+    EXPECT_TRUE(handler.stat(session, &meta));
+    expected_meta_session.size = handlerMaxBufferSize;
+    expected_meta_session.blobState = blobs::StateFlags::open_write;
+    EXPECT_EQ(meta, expected_meta_session);
+
+    EXPECT_TRUE(handler.stat(expectedBlobId, &meta));
+    expected_meta_path.size = handlerMaxBufferSize;
+    expected_meta_path.blobState = blobs::StateFlags::open_write;
+    EXPECT_EQ(meta, expected_meta_path);
+}
+
+TEST_F(SmbiosBlobHandlerStatCloseTest, CloseWithInvalidSessionFails)
+{
+    // Verify you cannot close an invalid session.
+
+    EXPECT_FALSE(handler.close(session));
+}
+
+TEST_F(SmbiosBlobHandlerStatCloseTest, CloseWithValidSessionSuccess)
+{
+    // Verify you can close a valid session.
+
+    EXPECT_TRUE(handler.open(session, 0, expectedBlobId));
+
+    EXPECT_TRUE(handler.close(session));
+}
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/test/handler_unittest.cpp b/src/smbios-ipmi-blobs/test/handler_unittest.cpp
new file mode 100644
index 0000000..9395e23
--- /dev/null
+++ b/src/smbios-ipmi-blobs/test/handler_unittest.cpp
@@ -0,0 +1,38 @@
+#include "handler_unittest.hpp"
+
+#include <string>
+#include <vector>
+
+#include <gtest/gtest.h>
+
+namespace blobs
+{
+
+class SmbiosBlobHandlerBasicTest : public SmbiosBlobHandlerTest
+{};
+
+TEST_F(SmbiosBlobHandlerBasicTest, CanHandleBlobChecksNameInvalid)
+{
+    // Verify canHandleBlob checks and returns false on an invalid name.
+
+    EXPECT_FALSE(handler.canHandleBlob("asdf"));
+    EXPECT_FALSE(handler.canHandleBlob("smbios"));
+    EXPECT_FALSE(handler.canHandleBlob("/smbios0"));
+    EXPECT_FALSE(handler.canHandleBlob("/smbios/0"));
+}
+
+TEST_F(SmbiosBlobHandlerBasicTest, CanHandleBlobChecksNameVaild)
+{
+    // Verify canHandleBlob checks and returns true on the valid name.
+
+    EXPECT_TRUE(handler.canHandleBlob(expectedBlobId));
+}
+
+TEST_F(SmbiosBlobHandlerBasicTest, GetblobIdsAsExpected)
+{
+    // Verify getBlobIds returns the expected blob list.
+
+    EXPECT_EQ(handler.getBlobIds(), expectedBlobIdList);
+}
+
+} // namespace blobs
diff --git a/src/smbios-ipmi-blobs/test/handler_unittest.hpp b/src/smbios-ipmi-blobs/test/handler_unittest.hpp
new file mode 100644
index 0000000..0b02a79
--- /dev/null
+++ b/src/smbios-ipmi-blobs/test/handler_unittest.hpp
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "handler.hpp"
+
+#include <ipmid/api.h>
+#include <systemd/sd-bus.h>
+
+#include <gtest/gtest.h>
+
+sd_bus* ipmid_get_sd_bus_connection()
+{
+    return nullptr;
+}
+
+namespace blobs
+{
+
+class SmbiosBlobHandlerTest : public ::testing::Test
+{
+  protected:
+    SmbiosBlobHandlerTest() = default;
+
+    SmbiosBlobHandler handler;
+
+    const uint16_t session = 0;
+    const std::string expectedBlobId = "/smbios";
+    const std::vector<std::string> expectedBlobIdList = {"/smbios"};
+    const uint32_t handlerMaxBufferSize = 64 * 1024;
+};
+} // namespace blobs
