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