88143

What is the difference between Aes and AesManaged

I found two class in C# related to <strong>AES</strong>, and example code of them MSDN provides are similar, what is the difference between these two classes?

<strong>Aes Class</strong>

https://msdn.microsoft.com/en-us/library/system.security.cryptography.aes(v=vs.110).aspx

<strong>AesManaged Class</strong>

https://msdn.microsoft.com/en-us/library/system.security.cryptography.aesmanaged(v=vs.110).aspx

Answer1:

System.Security.Cryptography.Aes is an abstract class, representing merely the concept of AES-ness. AesManaged, AesCryptoServiceProvider, and AesCng are concrete implementations of AES in managed code, using Windows CAPI, and using Windows CNG (respectively). (On .NET Core that's a lie: AesManaged and AesCryptoServiceProvider both just use a automagic hidden class which uses Windows CNG, macOS Security.framework, or OpenSSL, as available)

If you're unclear on which one you want, you want to create an instance via Aes.Create() and only use the base type. The only real exception is when using AesCng with a named key (which is very rare).

Answer2:

AES is the abstract base class while AESManaged is a managed implementation of AES based upon Rijndael symmetric algorithm with a fixed block size and iteration count.

Recommend

  • Is it possible to encrypt data with AES (256 bit) GCM mode in .net framework 4.7?
  • Padding is invalid and cannot be removed - AES yet another
  • AES-Encrypt-then-MAC a large file with .NET
  • Where to find documentation on BCrypt for .NET? [closed]
  • How to extend the Expiry of a Document DB REST API Resource Token
  • How do I verify Certificate for KeyUsage
  • How can I determine the author of a block of code programmatically in TFS?
  • Why do the numeric format strings in C# round the number when not using decimals (F0)?
  • What is the advantage of the ASP.NET precompilation?
  • Shall the DB ConnectionString within Web.config be encrypted when using Azure Cloud?
  • How to sort a DateTime-column in DataView?
  • Server.Transfer from ASP to ASP.Net
  • How do I add “&Source” to DataNavigateUrlFormatString?
  • Get URL Query String Parameters when there are multiple parameters with the same name using Jquery o
  • how to make popup windows always on top?
  • How do I redirect with a Drop Down List, and not a Button?
  • ASP.NET 2.0 Session Timeout
  • Alternative to XInclude
  • Specify regression line intercept (R & ggplot2)
  • .NET Core 2.0 RSA PlatformNotSupportedException
  • How do I know what reference to include to import a specific .NET namespace?
  • How to customize whisker lines on a geom_box plot differently than the lines of the box itself
  • How do i find all references to a user control
  • How to override __call__ in celery on main?
  • What is the reason that Policy.getPolicy() is considered as it will retain a static reference to the
  • Regex for URL rewrite with optional query string parameters
  • What is corresponding c++ data type to SQL numeric(18,0) data type?
  • Other than Linq to SQL does anything else consume INotifyPropertyChanging?
  • ggplot2: make the points on the line a darker color than the line color
  • HttpListener.IsSupported is false on XP SP3
  • Magento site down due to mysql error General error: 1030 Got error -1 from storage engine
  • Switch to popup in python using selenium
  • Enabling DTD support in Sql Server
  • GAE: Way to get reference to an HttpSession from its ID?
  • Does Mobilefirst provide a provision to access web services directly?
  • Projection media query: browser support and workarounds?
  • Timeout for blocking function call, i.e., how to stop waiting for user input after X seconds?
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Proper folder structure for lots of source files
  • How does Linux kernel interrupt the application?