pointeman
asked on
Rijndael BlockSize vs GetBytes?
What's the difference between using BlockSize or GetBytes?
var keyGen = new Rfc2898DeriveBytes(pass, 8)
var aes = Rijndael.Create(); //Rijndael
aes.Padding = PaddingMode.PKCS7;
aes.IV = keyGen.GetBytes(aes.BlockS ize / 8);
aes.Key = keyGen.GetBytes(aes.KeySiz e / 8);
- VS -
aes.IV = keyGen.GetBytes(16);
aes.Key = keyGen.GetBytes(32);
var keyGen = new Rfc2898DeriveBytes(pass, 8)
var aes = Rijndael.Create(); //Rijndael
aes.Padding = PaddingMode.PKCS7;
aes.IV = keyGen.GetBytes(aes.BlockS
aes.Key = keyGen.GetBytes(aes.KeySiz
- VS -
aes.IV = keyGen.GetBytes(16);
aes.Key = keyGen.GetBytes(32);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks :)
ASKER
[IV]
aes.IV = keyGen.GetBytes(aes.BlockS
- OR -
aes.IV = keyGen.GetBytes(16);
[Key]
aes.Key = keyGen.GetBytes(aes.KeySiz
- OR -
aes.Key = keyGen.GetBytes(32);
Note: I experimented by encrypting a string message using aes.KeySize/8 and successfully decrypted using GetBytes(32)...
I wasn't sure if there is an advantage....