Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When would I choose AesCryptoServiceProvider over AesManaged or RijndaelManaged?

I think the distinguishing factors are

  • AesCryptoServiceProvider is FIPS compliant
  • AesManaged is cross-platform, requires .NET 3.0
  • RijndaelManaged runs on .NET 2.0, requires restricting the blocksize

is that about right?

like image 333
Cheeso Avatar asked Aug 04 '09 16:08

Cheeso


People also ask

Is rijndael obsolete?

The Rijndael and RijndaelManaged types are obsolete.

What is AesManaged?

AesManaged class is a managed implementation of AES algorithm. This article demonstrates how to use AesManaged class to apply AES algorithm to encrypt and decrypt data in . NET and C#. . NET provides high level classes for various encryption algorithms, both symmetric and asymmetric.

Is rijndael same as AES?

Rijndael and AES differ only in the range of supported values for the block length and cipher key length. For Rijndael, the block length and the key length can be independently specified to any multiple of 32 bits, with a minimum of 128 bits, and a maximum of 256 bits.

What is RijndaelManaged encryption C#?

Rijndael is a block cipher that uses a symmetric key encryption technique. It employs three discrete and invertible layers: Linear Mix Transform , Non-linear Transform , and Key Addition Transform . In C#, Rijndael Key supports key lengths of 128, 192, and 256 bits and blocks of 128 (default), 192, and 256 bits.


1 Answers

AesManaged documentation states that

"The AES algorithm is essentially the Rijndael symmetric algorithm with a fixed block size and iteration count. This class functions the same way as the RijndaelManaged class but limits blocks to 128 bits and does not allow feedback modes."

That would suggest its using ECB (Electronic Codebook) mode. This can be a significant weakness to the encrypted data as it means identical blocks of plain text data will result in identical blocks of cipher output.


Edit: (As correction)
Documentation for the Mode property indicates that Mode infact defaults to CBC (which confusingly IS a feedback mode) but cannot be set to CFB or OFB (Cipher Feedback / Output Feedback)

like image 114
PaulG Avatar answered Oct 01 '22 04:10

PaulG