Hello,
I am currently working at symmetric e- and decryption with the aes -
stuff. When I tried to ?verify? The Key with my generated Initalisation
Vector I get some exceptions. (key Size about 1024 and IV-Size =
AES::BLOCKSIZE, should be 16 at the Moment). When I reduce the key-size
to 32 everything works. Everything above doesnt work. It compiles but
throws exceptions.
This is my current code:
td::string CCryptoBase::SymmEncryptByte( const byte* data, const
unsigned int data_size, const char * key ){
std::string output;
const unsigned int block_size=CryptoPP::AES::BLOCKSIZE;
bytestring out;
// Generate IV
byte iv[block_size];
AutoSeededRandomPool rng;
rng.GenerateBlock(/*(byte*)&*/iv,block_size);
// Extract the key
StringSource keyString(key,true,new HexDecoder);
SecByteBlock keyByte(keyString.MaxRetrievable());
keyString.Get(keyByte,keyByte.size());
// Create encryptor
CFB_Mode<AES>::Encryption
cfbEncryption(keyByte.data(),keyByte.size(),iv); <------ zhis throws the
exception
StringSource encryptor(data,data_size,true,new Gzip(new
StreamTransformationFilter(cfbEncryption, new
StringSinkTemplate<bytestring>(out) )));
out.append(iv,block_size);
out.append((byte*)&block_size,sizeof(block_size));
HexEncoder he(new StringSink(output));
he.Put(out.c_str(),out.size(),true);
he.MessageEnd();
return output;
}
Has someone any hint for me? Thanks,
Meike