Bardh Mehmeti
Bardh Mehmeti

Reputation: 95

AES object key size

I'm doing a project which involves creating an application to encrypt data using AES algorithm. In the main function I create an AES object like this;

Aes objAes = Aes.Create();
byte[] key = objAes.Key;
byte[] IV = objAes.IV;

As far as I've understood AES.Create() function automatically generates a key and an IV. Knowing that AES is a symmetric algorithm which uses 3 different key sizes:128 bit, 192 bit and 256 bit keys, in this case which kind of key it is creating? I mean what is the size of the key that the AES.Create() function is generating? Thanks!

Upvotes: 5

Views: 3196

Answers (1)

You almost have the answer right under your nose! You already have a byte array for key from objAes.Key. If I am not mistaken, it should have a length of 32. So a 32 byte array is 256 bits. You can also check objAes.KeySize.

Upvotes: 7

Related Questions