C# System.Security.Cryptography - why specify key and IV twice?

Viewed 376

Most of the examples that show how to encrypt using the AES code in System.Security.Cryptography look like this:

using (Aes aes = Aes.Create())
{
   aes.Key = Key;
   aes.IV = IV;
   ICryptoTransform encryptor = aes.CreateEncryptor(aes.Key, aes.IV);

Is it necessary to specify the key and IV twice - once to the Aes object and once to the CreateEncryptor() function? Or in this case, since I've already specified the key and IV, can I call the form of CreateEncryptor() that takes no arguments?

2 Answers
Related