| 799 | |
| 800 | public: |
| 801 | AESCipherTCP(const std::string& key_str) { |
| 802 | key = std::vector<uint8_t>(key_str.begin(), key_str.end()); |
| 803 | if (key.size() != 16 && key.size() != 24 && key.size() != 32) { |
| 804 | throw std::runtime_error("Key must be 16, 24, or 32 bytes long"); |
| 805 | } |
| 806 | AES_init_ctx(&ctx, key.data()); |
| 807 | } |
| 808 | |
| 809 | std::vector<uint8_t> encrypt(const std::string& raw) { |
| 810 | std::vector<uint8_t> data(raw.begin(), raw.end()); |
nothing calls this directly
no test coverage detected