John Edward Broadbent | 59dffa6 | 2022-01-13 17:41:32 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "cryptsetupInterface.hpp" |
| 4 | #include "erase.hpp" |
| 5 | |
| 6 | #include <libcryptsetup.h> |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <string_view> |
| 10 | |
| 11 | namespace estoraged |
| 12 | { |
| 13 | |
| 14 | class CryptErase : public Erase |
| 15 | { |
| 16 | public: |
| 17 | /** @brief Creates a CryptErase erase object. |
| 18 | * |
| 19 | * @param[in] inDevPath - the linux device path for the block device. |
| 20 | * @param[in](optional) cryptIface - a unique pointer to an cryptsetup |
| 21 | * Interface object. |
| 22 | */ |
| 23 | CryptErase(std::string_view devPath, |
| 24 | std::unique_ptr<estoraged::CryptsetupInterface> inCryptIface = |
| 25 | std::make_unique<Cryptsetup>()); |
| 26 | |
| 27 | /** @brief searches and deletes all cryptographic keyslot |
| 28 | * and throws errors accordingly. |
| 29 | */ |
| 30 | void doErase(); |
| 31 | |
| 32 | private: |
| 33 | std::unique_ptr<estoraged::CryptsetupInterface> cryptIface; |
| 34 | }; |
| 35 | |
| 36 | } // namespace estoraged |