好吧,我从这里下载了 Rijndael 资源:http: //www.codeproject.com/Articles/1380/AC-Implementation-of-the-Rijndael-Encryption-Decr
我有以下代码:
int AutoUpdater::GetVersion()
{
std::ifstream file("ver.dat", std::ios::out );
if(file.fail())
return 0;
file.seekg(0,std::ios::end);
int len = (int)file.tellg();
file.seekg(0,std::ios::beg);
char* line = new char[len];
file.read(line,len);
file.close();
CRijndael crypt;
crypt.MakeKey("MIUJkHyHnjHyGtqO", "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16, 16);
char * decrypted = new char[len];
crypt.Decrypt(line,decrypted,len);
delete[] line;
delete [] decrypted;
return atoi(line);
}
但它给出了这个错误:“数据不是块大小的倍数”
我要加密的文件必须具有固定长度?