What is the difference between Aes and AesManaged

ぃ、小莉子 提交于 2019-12-08 18:27:47

问题


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

Aes Class

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

AesManaged Class

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


回答1:


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).




回答2:


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.



来源:https://stackoverflow.com/questions/45473884/what-is-the-difference-between-aes-and-aesmanaged

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!