diff --git a/src/crypto.h b/src/crypto.h index 7aefd23..039771c 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -11,7 +11,7 @@ namespace horcrux { enum class Mode { kEncrypt, kDecrypt }; class Cipher { -protected: +public: Cipher() = delete; explicit Cipher(Mode m) : mode(m) { } Cipher(Mode m, const std::vector& key) : @@ -20,6 +20,9 @@ protected: Cipher(Mode m, std::vector&& key) : mode(m), encryption_key(key) {} + virtual ~Cipher() = default; + +protected: std::vector encryption_key; public: @@ -58,6 +61,8 @@ public: throw std::invalid_argument("Invalid key size"); } + virtual ~AES256_CBC() = default; + std::vector process( const std::vector& inputdata) override; std::vector encrypt( diff --git a/src/io.h b/src/io.h index d355a58..096d850 100644 --- a/src/io.h +++ b/src/io.h @@ -10,16 +10,14 @@ namespace horcrux { class Input { public: + virtual ~Input() = default; virtual std::vector read() = 0; }; class Output { public: + virtual ~Output() = default; virtual size_t write(const std::vector& data) = 0; }; -class PlainInput : public Input {}; -class CryptoInput : public Input {}; -class PlainOutput : public Output {}; -class CryptoOutput : public Output {}; class FsPlainInput : public Input { std::filesystem::path file_path; @@ -29,6 +27,7 @@ class FsPlainInput : public Input { public: explicit FsPlainInput(const std::string& path); + virtual ~FsPlainInput() = default; std::vector read() override; }; @@ -39,6 +38,7 @@ class FsCryptoInput : public Input{ public: explicit FsCryptoInput(const std::vector& filenames); + virtual ~FsCryptoInput() = default; std::vector read() override; }; @@ -48,6 +48,7 @@ class FsPlainOutput : public Output { public: explicit FsPlainOutput(const std::string& filename); + virtual ~FsPlainOutput() = default; size_t write(const std::vector& to_write) override; }; @@ -64,6 +65,7 @@ public: FsCryptoOutput(const std::string& folder, const int horcrux_num, const std::string& filename = "horcrux", const size_t horcrux_size = 0); + virtual ~FsCryptoOutput() = default; size_t write(const std::vector& to_write) override; }; }; // namespace horcrux