horcrux/test/test.h

48 lines
1.6 KiB
C
Raw Normal View History

2020-12-12 14:36:38 +00:00
#ifndef HORCRUX_TEST_TEST_H
#define HORCRUX_TEST_TEST_H
#include <filesystem>
2020-12-12 21:19:10 +00:00
#include <algorithm>
2020-12-12 14:36:38 +00:00
#include "io.h"
#include "crypto.h"
2020-12-13 23:56:07 +00:00
#include "utils.h"
2020-12-12 14:36:38 +00:00
/* IO Test utils */
#ifndef TEST_WORK_DIR
#error Please define TEST_WORK_DIR
#endif
const std::string folder{TEST_WORK_DIR};
const std::string noexist{TEST_WORK_DIR "/nope"};
const std::string empty{TEST_WORK_DIR "/empty"};
const std::string text{TEST_WORK_DIR "/test.txt"};
const std::string image{TEST_WORK_DIR "/mangoni.jpg"};
2020-12-13 23:56:07 +00:00
horcrux::raw_data generic_read_file(const std::string& filename);
2020-12-12 21:19:10 +00:00
std::vector<std::string> get_created_filenames(const horcrux::FsCryptoOutput& out);
void delete_created_files(const horcrux::FsCryptoOutput& out);
std::vector<std::string> get_encrypted_files(const std::string& folder, const std::string& basename);
2020-12-12 14:36:38 +00:00
/* Crypto Test utils */
/* test command:
echo "ditemi perche' se la mucca fa mu il merlo non fa me" |
2020-12-12 23:56:18 +00:00
scripts/aes256.sh -k 0123456789ABCDEF0123456789ABCDEF -i 0123456789ABCDEF |
xxd -i
2020-12-12 14:36:38 +00:00
*/
const std::string test1_str = "ditemi perche' se la mucca fa mu il merlo non fa me";
const std::string test1_key = "0123456789ABCDEF0123456789ABCDEF";
const std::string test1_iv = "0123456789ABCDEF";
2020-12-13 23:56:07 +00:00
const horcrux::raw_data test1_enc {
2020-12-12 14:36:38 +00:00
0x4c, 0x17, 0x6e, 0x6d, 0xd2, 0x83, 0x51, 0x52, 0xfc, 0x5d, 0xbe, 0x0f,
0x1b, 0xcf, 0x86, 0xef, 0x73, 0x91, 0x58, 0xc4, 0xdd, 0x1b, 0x09, 0x3d,
0x77, 0xe0, 0x78, 0x5d, 0x21, 0xfe, 0x59, 0x9c, 0xb2, 0x12, 0xa6, 0x81,
0x12, 0x96, 0x50, 0xd6, 0x5c, 0xe2, 0xc1, 0x99, 0xe3, 0x38, 0x39, 0x8e,
0x55, 0xd2, 0x04, 0x73, 0x16, 0x39, 0xc7, 0x6a, 0xd3, 0x61, 0x2c, 0x22,
0x59, 0x25, 0xa6, 0x20 };
#endif //HORCRUX_TEST_TEST_H