| 71 | } |
| 72 | |
| 73 | static void TestAES256(const std::string &hexkey, const std::string &hexin, const std::string &hexout) |
| 74 | { |
| 75 | std::vector<unsigned char> key = ParseHex(hexkey); |
| 76 | std::vector<unsigned char> in = ParseHex(hexin); |
| 77 | std::vector<unsigned char> correctout = ParseHex(hexout); |
| 78 | std::vector<unsigned char> buf; |
| 79 | |
| 80 | assert(key.size() == 32); |
| 81 | assert(in.size() == 16); |
| 82 | assert(correctout.size() == 16); |
| 83 | AES256Encrypt enc(key.data()); |
| 84 | buf.resize(correctout.size()); |
| 85 | enc.Encrypt(buf.data(), in.data()); |
| 86 | BOOST_CHECK(buf == correctout); |
| 87 | AES256Decrypt dec(key.data()); |
| 88 | dec.Decrypt(buf.data(), buf.data()); |
| 89 | BOOST_CHECK(buf == in); |
| 90 | } |
| 91 | |
| 92 | static void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout) |
| 93 | { |