2#ifndef ZT_ENCRYPTION_UTILS_H
3#define ZT_ENCRYPTION_UTILS_H
6#include <cryptopp/aes.h>
7#include <cryptopp/modes.h>
8#include <cryptopp/filters.h>
9#include <cryptopp/osrng.h>
10#include <cryptopp/hex.h>
11#include <cryptopp/secblock.h>
12#include <cryptopp/config.h>
24std::string
EncryptPayload(
const std::string& data,
const CryptoPP::byte* key, std::string& ivOut);
33std::string
DecryptPayload(
const std::string& cipher,
const CryptoPP::byte* key);
41CryptoPP::SecByteBlock
HexDecodeKey(
const std::string& hex);
49std::vector<CryptoPP::byte>
HexToBytes(
const std::string& hex);
std::string EncryptPayload(const std::string &data, const byte *key, std::string &ivOut)
Encrypts a plaintext string using AES-CBC mode with a randomly generated IV.
std::vector< CryptoPP::byte > HexToBytes(const std::string &hex)
Converts a hexadecimal string into a byte vector.
std::string DecryptPayload(const std::string &cipher, const byte *key)
Decrypts a ciphertext string encrypted with EncryptPayload.
SecByteBlock HexDecodeKey(const std::string &hex)
Decodes a hex-encoded AES key string into a raw key byte block.