#include "gtest/gtest.h" #include "test.h" TEST(IntegrationTest, EndToEndEncryptDecrypt){ auto buf = generic_read_file(image); //Prepare encrypt operation auto in = horcrux::FsPlainInput(image); auto cipher = horcrux::AES256_CBC(); auto out = horcrux::FsCryptoOutput(folder, 3); // Perform encrypt operation out.write(cipher.encrypt(in.read())); //Prepare decrypt operation auto in2 = horcrux::FsCryptoInput(get_created_filenames(out)); //Perform decrypt operation auto buf2 = cipher.decrypt(in2.read()); //check outcome EXPECT_EQ(buf, buf2); auto out2 = horcrux::FsPlainOutput(noexist); out2.write(cipher.decrypt(in2.read())); auto buf3 = generic_read_file(noexist); EXPECT_EQ(buf, buf3); delete_created_files(out); std::filesystem::remove(noexist); }