using System.Security.Cryptography; RijndaelManaged aes = new RijndaelManaged(); aes.GenerateIV(); byte[] iv = aes.IV;
using System.Security.Cryptography; RijndaelManaged aes = new RijndaelManaged(); aes.BlockSize = 256; aes.GenerateIV(); byte[] iv = aes.IV;In this example, the block size of the RijndaelManaged object is set to 256 bits before calling GenerateIV. The resulting IV is stored in a byte array. This example shows you how to use the RijndaelManaged package library in C# to generate a new random initialization vector that can be used in conjunction with a key to encrypt data.