I'm trying to learn a bit about cryptography and am trying to use AES decryption with the crypto++ library in c++. I have a ciphertext string and a key string. Using these two, I'd like to decrypt this ciphertext. Here is my code:
#include "mycrypto.h"
#include <stdio.h>
#include <cstdlib>
#include <string>
#include <aes.h>
#include <config.h>
#include <hex.h>
#include <files.h>
#include <cryptlib.h>
#include <modes.h>
#include <osrng.h>
#include <filters.h>
#include <sha.h>
#include <rijndael.h>
using namespace std;
using namespace CryptoPP;
int main()
{
string myPlainText;
string myKey = "140b41";
string myCipherText = "4ca00f";
byte key[AES::DEFAULT_KEYLENGTH];
byte iv[AES::BLOCKSIZE];
CryptoPP::CBC_Mode<AES>::DECRYPTION decryptor;
decryptor.SetKeyWithIV(key, sizeof(key), iv);
StringSource(myCipherText, true, new StreamTransformationFilter( decryptor, new StringSink(myPlainText)));
return 0;
}
I get a number of errors with this code. The most immediate is this one:
'DECRYPTION' is not a member of 'CryptoPP::CBC_Mode'
Can anyone straighten me out with this code. I've been all over the crypto++ documentation, but I don't see what I am doing wrong.
Thank you!