Jinto Jose
Jinto Jose

Reputation: 21

Crypto++ : CFB_Mode_ExternalCipher not working

This is how the code look likes. Is there anything wrong with this. The recover text does not match.

AES::Encryption aes1(key, key.size());
CFB_Mode_ExternalCipher::Encryption cfbEncryption(aes1, iv);
AES::Decryption aes2(key, key.size());
CFB_Mode_ExternalCipher::Decryption cfbDecryption(aes2, iv);

ArraySink cipherSink(cipher, data_size);
ArraySource ss1(plain, data_size, true, new StreamTransformationFilter(cfbEncryption, new Redirector(cipherSink)));

ArraySink recoverSink(recover, data_size);
ArraySource ss2(cipher, data_size, true, new StreamTransformationFilter(cfbDecryption, new Redirector(recoverSink)));

Upvotes: 1

Views: 152

Answers (1)

Jinto Jose
Jinto Jose

Reputation: 21

When using CTR Mode External Cipher in transformation, encryption is used for decryption as well.

https://www.codeproject.com/Articles/21877/Applied-Crypto-Block-Ciphers

Upvotes: 1

Related Questions