So when I say something like:
TripleDES tripledes = TripleDES.Create();
Rfc2898DeriveBytes pdb = new Rfc2898DeriveBytes(password, plain);
tripledes.Key = pdb.GetBytes(16);
tripledes.IV = pdb.GetBytes(16);
I get an error. The error used to be on the key, but its been fixed (I think - unless you spot something wrong). However, the error occurs when I set the IV:
tripledes.IV = pdb.GetBytes(16);
It says that its not a valid initialization vector.
How do I fix it?
The block size for TripleDES is 64 bits. You are trying to set 128 bits.
This should work:
tripledes.IV = pdb.GetBytes(8);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With