Reputation: 117
I have no idea whats going wrong here. Everything works fine and it loads, but the 'encrypted' data is the same as the original data. No encryption had been done.
if (entry.type == stype.file)
{
aes.IV = aes.Key; //for now just testing..
byte[] startData = File.ReadAllBytes(baseDir + entries[i]);
aes.CreateEncryptor(aes.Key, aes.IV).TransformFinalBlock(startData,
0,
startData.Length);
entry.data = startData;
entry.data_size = (ulong)entry.data.LongLength;
ulong eSize = (ulong)(29 + (ulong)entry.name.Length + entry.data_size);
total_size += eSize;
entry.entry_size = eSize;
}
entry.data
is the same as the original startData. Is TransformFinalBlock
not encrypting the startData
?
Upvotes: 2
Views: 136
Reputation: 108790
TransformFinalBlock
returns the data, it doesn't encrypt the input inplace.
Upvotes: 3