-1
我有一個簡單的控制檯程序,應該使用來自Crypto ++庫的AES CFB算法加密文件。由於某種原因,它不起作用。編碼部分:使用Crypto ++/AES CFB加密的加密
byte data[16] = { 0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44 };
byte result[16] = { 0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44 };
//Sample key
byte key[16] = { 0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44,
0x88, 0x44, 0x88, 0x44 };
//Generate random Initialization Vector
byte iv[16];
CryptoPP::AutoSeededRandomPool rnd;
rnd.GenerateBlock(iv, CryptoPP::AES::BLOCKSIZE /*16*/);
//Through VisualStudio debug/watch functionality I have found out that
//Crypto++ randomizer works properly so at this point "iv" contains random values
CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption tmp(key, 16, iv, 1);
tmp.ProcessData(data, result, 16);
的問題是,當這個代碼完成result
應該充滿密文,但它只是仍然充滿了px88
和0x44
。
我遵循了這個官方教程:https://www.cryptopp.com/wiki/Advanced_Encryption_Standard
[加密與Crypto ++不能正常工作]的可能重複(http://stackoverflow.com/questions/43352882/aes-encryption-with-crypto-not-working) – jww
原諒我的無知...這是怎麼回事比引用的重複? – jww
@jww。他們沒有區別。我做到了,因爲我沒有回答這個問題。 – Serid