user1254844
user1254844

Reputation:

Identify AES Algorithm . Is it AES 128 or AES 256?

I am using AES Algorithm for Encryption & Decryption in c# .I am using AesCryptoServiceProvider class for Encryption & decryption.

Here is my settings in the code

AesCryptoServiceProvider result = new AesCryptoServiceProvider();
result.BlockSize = 128;
result.KeySize = 256;
result.Mode = CipherMode.CBC;
result.Padding = PaddingMode.PKCS7;

I am little confused whether the code i am using here is implementation of AES 128 or AES 256 .

Simple question is How to identify you are using AES 256 / AES 128 ?

I tried this link : http://social.msdn.microsoft.com/Forums/vstudio/en-US/ac5f4d30-343e-484e-b795-b214820a9327/aes-net-encryption-is-it-always-256-bit-aes

But i didn't got my answer.

Upvotes: 3

Views: 10397

Answers (2)

Maarten Bodewes
Maarten Bodewes

Reputation: 93988

The official specification of AES is FIPS-197. It contains the following text regarding the key size and block size.

1. Introduction

This standard specifies the Rijndael algorithm ([3] and [4]), a symmetric block cipher that can
process data blocks of 128 bits, using cipher keys with lengths of 128, 192, and 256 bits.
Rijndael was designed to handle additional block sizes and key lengths, however they are not
adopted in this standard.

Throughout the remainder of this standard, the algorithm specified herein will be referred to as
“the AES algorithm.” The algorithm may be used with the three different key lengths indicated
above, and therefore these different “flavors” may be referred to as “AES-128”, “AES-192”, and
“AES-256”.

As NIST choose Rijndael to be AES after a contest, you cannot get a more authoritative reference.

Note that although your code also contains CBC and PKCS#7 padding, those are not part of the specification of the AES. CBC is an approved block cipher mode of operation by NIST (see NIST SP 800-38A) though. That specification also mentions that padding schemes are not taken into account by NIST, probably because they should not be used as an algorithm providing any security (for block cipher modes, that is).

Upvotes: 4

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239714

It's AES 256. The number is the key size.

From Wikipedia:

Strictly speaking, the AES standard is a variant of Rijndael where the block size is restricted to 128 bits.

So the block size is always 128.


I can't point you to any official documentation because (so far as I'm aware) AES-<Number> has always been an unofficial shorthand. I can point you at a Bruce Schneier Blog Post which quotes a research paper:

AES is the best known and most widely used block cipher. Its three versions (AES-128, AES-192, and AES-256) differ in their key sizes (128 bits, 192 bits and 256 bits) and in their number of rounds (10, 12, and 14, respectively). In the case of ...

Although your client may not like the rest of that blog post since it's Schneier recommending AES-128 over AES-256.

Upvotes: 7

Related Questions