Hi,

I am trying something like the following code first for encrypting
some data then decrypting it back in the 4 modes CBC, ECB, OFB and CFB
(with AES).

CBC mode with IV works fine but CFB and OFB modes decrypt into junk
and ECB throws an exception (but my app disables exceptions)...

pCipher = new CBC_Mode_ExternalCipher::Encryption(*pAES, pIV);
or
pCipher = new CFB_Mode_ExternalCipher::Encryption(*pAES, pIV);
or
pCipher = new ECB_Mode_ExternalCipher::Encryption(*pAES, pIV);
or
pCipher = new OFB_Mode_ExternalCipher::Encryption(*pAES, pIV);

(or the above similarly for decryption)

(pAES is object ptr of 'AESEncryption' or 'AESDecryption' and pIV is a
Win32 BYTE array, unsigned char)

then

pFilter = new StreamTransformationFilter(*pCipher);
pFilter->Put(in_data, in_len);
pFilter->MessageEnd();

pResult = pFilter->Get(out_data, out_len);

What needs to be done differently for ECB, OFB and CFB? CBC is working
fine for me...

I am using MS VC++ 6 SP6 with CryptoPP 5.0.4 (with FIPS DLL as well as
the non-FIPS lib)

Thanks,
Vishal

-- 
"Thou shalt not follow the null pointer for at its end madness and chaos lie."

Reply via email to