From 011f7069677c77ee3039d94aef7bc25030ab3309 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Thu, 31 Oct 2019 21:30:06 -0500 Subject: hscript: Implement Encrypt, add tests --- hscript/disk.hh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'hscript/disk.hh') diff --git a/hscript/disk.hh b/hscript/disk.hh index f3a8a4c..7722780 100644 --- a/hscript/disk.hh +++ b/hscript/disk.hh @@ -114,6 +114,21 @@ public: }; class Encrypt : public Key { +private: + const std::string _block; + const std::string _pw; + + Encrypt(int _line, const std::string &_b, const std::string &_p) : + Key(_line), _block(_b), _pw(_p) {} +public: + /*! Retrieve the block device that this key encrypts. */ + const std::string device() const { return this->_block; } + /*! Retrieve the passphrase used to encrypt the block device. */ + const std::string passphrase() const { return this->_pw; } + + static Key *parseFromData(const std::string &, int, int*, int*); + bool validate(ScriptOptions) const override; + bool execute(ScriptOptions) const override; }; class LVMPhysical : public StringKey { -- cgit v1.2.3-70-g09d2