What encryption does MVC4 use?

Deadly 提交于 2019-12-07 15:31:15

问题


How do we find out what encryption MVC4 uses? I notice there is an option for a SALT but this also seems not to be used in the WebSecurity() module.

I would like to know the standard used and if it is easily possible to upgrade to the latest SHA


回答1:


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" />



回答2:


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.



来源:https://stackoverflow.com/questions/14985003/what-encryption-does-mvc4-use

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