加密 ++:CFB_Mode_ExternalCipher 不工作

Crypto++ : CFB_Mode_ExternalCipher not working

这就是代码的样子。这有什么问题吗? 恢复文本不匹配。

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)));

在转换中使用CTR模式外密码时,加密也用于解密。

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