Storing the IV with the ciphertext Crypto++ CBC AES encryption
问题 I'm trying to encrypt(and decrypt after) a file using AES in CBC mode and Crypto++ library Here's what I already did: using namespace CryptoPP; AutoSeededRandomPool rnd; //generating the key and iv SecByteBlock key(AES::MAX_KEYLENGTH); rnd.GenerateBlock(key, key.size()); byte iv[AES::BLOCKSIZE]; rnd.GenerateBlock(iv, AES::BLOCKSIZE); To encrypt a file,I open it in binary mode,and dump the content to a string : std::ifstream fin(file_path, std::ios::binary); if (!fin) { std::cout << "error"; }