What encryption does MVC4 use?

为君一笑 提交于 2019-12-05 22:06:06

According to the below link the Default Hashing Algorithm Is Now HMACSHA256:

http://www.asp.net/whitepapers/aspnet4/breaking-changes

Default Hashing Algorithm Is Now HMACSHA256

ASP.NET uses both encryption and hashing algorithms to help secure data such as forms authentication cookies and view state. By default, ASP.NET 4 now uses the HMACSHA256 algorithm for hash operations on cookies and view state. Earlier versions of ASP.NET used the older HMACSHA1 algorithm.

Your applications might be affected if you run mixed ASP.NET 2.0/ASP.NET 4 environments where data such as forms authentication cookies must work across.NET Framework versions. To configure an ASP.NET 4 Web application to use the older HMACSHA1 algorithm, add the following setting in the Web.config file:

<machineKey validation="SHA1" />

the WebSecurity class internally uses the Crypto class and salts the passwords despite you don't see it in the generated tables, more details can be found here . This said you can easily inspect the WebMatrix.WebData with ilSpy to see the internals of the WebSecurity class.

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