| 87 | } |
| 88 | |
| 89 | static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) |
| 90 | { |
| 91 | std::vector<unsigned char> key = ParseHex(hexkey); |
| 92 | std::vector<unsigned char> in = ParseHex(hexin); |
| 93 | std::vector<unsigned char> correctout = ParseHex(hexout); |
| 94 | std::vector<unsigned char> buf; |
| 95 | |
| 96 | assert(key.size() == 32); |
| 97 | assert(in.size() == 16); |
| 98 | assert(correctout.size() == 16); |
| 99 | AES256Encrypt enc(key.data()); |
| 100 | buf.resize(correctout.size()); |
| 101 | enc.Encrypt(buf.data(), in.data()); |
| 102 | BOOST_CHECK(buf == correctout); |
| 103 | AES256Decrypt dec(key.data()); |
| 104 | dec.Decrypt(buf.data(), buf.data()); |
| 105 | BOOST_CHECK(buf == in); |
| 106 | } |
| 107 | |
| 108 | static void TestAES128CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) |
| 109 | { |