summaryrefslogtreecommitdiff
path: root/hscript/disk.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 21:30:06 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-10-31 21:30:06 -0500
commit011f7069677c77ee3039d94aef7bc25030ab3309 (patch)
tree0ac1ae8a99d8f8d58ebb47efb6481289aa570f79 /hscript/disk.hh
parent1342fe0f855d72642c250c7c4be3509fb2257d7b (diff)
downloadhorizon-011f7069677c77ee3039d94aef7bc25030ab3309.tar.gz
horizon-011f7069677c77ee3039d94aef7bc25030ab3309.tar.bz2
horizon-011f7069677c77ee3039d94aef7bc25030ab3309.tar.xz
horizon-011f7069677c77ee3039d94aef7bc25030ab3309.zip
hscript: Implement Encrypt, add tests
Diffstat (limited to 'hscript/disk.hh')
-rw-r--r--hscript/disk.hh15
1 files changed, 15 insertions, 0 deletions
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 {