Search code examples
c#encryptionaesencryption-symmetricinitialization-vector

What is the length in bytes of AesCryptoServiceProvider GenerateIV()?


AesCryptoServiceProvider aesAlg = new AesCryptoServiceProvider()
var iv = aesAlg.GenerateIV();

Do you know what the length of iv? Is it fixed with byte[16]?

Another question is: what is the length requirement of initialization vector of AesCryptoServiceProvider?


Solution

  • The iv for AES is the same as the block size which is 128-bits/16-bytes.

    AES has one fixed block size, and three key sizes: 128-bits, 192-bits and 256-bits.