检索ASP.Net自动生成的machineKey [英] Retrieve ASP.Net AutoGenerated MachineKey
问题描述
我有一个.net 1.1应用程序,必须升级到2.0。该应用程序使用MD5CryptoServiceProvider数据库加密密码。之后我升级到2.0的MD5值不同。在machine.config中,将machineKey设置为自动生成。
I have a .Net 1.1 app that must be upgraded to 2.0. The application encrypts passwords in the database using MD5CryptoServiceProvider. After I upgraded to 2.0, the MD5 value was different. In the machine.config, the machinekey was set to autogenerate.
有没有一种方法来检索此键?
Is there a way to retrieve this key?
推荐答案
的<一个href=\"http://msdn.microsoft.com/en-us/library/system.security.cryptography.md5cryptoserviceprovider.aspx\"相对=nofollow> System.Security.Cryptography.MD5CryptoServiceProvider 不依赖于ASP.NET 的System.Web / machineKey中
设置。这些都是用来控制篡改打样和ViewState的加密,窗体身份验证票和作用饼干(的如何:在ASP.NET 2.0 )配置的machineKey
The System.Security.Cryptography.MD5CryptoServiceProvider doesn't rely on the ASP.NET system.web/machineKey
settings. These are used to control tamper proofing and encryption of ViewState, forms authentication tickets, and role cookies (How To: Configure MachineKey in ASP.NET 2.0).
我刚刚编译下.NET 1.1和2.0执行一个MD5哈希一个简单的控制台应用程序,它们都产生相同的值。我跑了两个不同计算机上这些应用程序(一个自动生成机键,和一个硬codeD键),再次,相同的结果。
I just compiled a simple console application under .NET 1.1 and 2.0 that performs a MD5 hash and they both produce the same value. I ran these applications on two different machines (one with autogenerated machine keys, and one with hard coded keys), again, identical results.
这听起来像使用的编码可能是不同的,即1.1应用程序使用 ASCIIEncoding
和2.0应用程序正在使用的Uni code
。
This sounds like the Encoding used is possibly different, i.e. the 1.1 application is using ASCIIEncoding
and the 2.0 application is using Unicode
.
要检查的另一件事是,如果要生成您使用的是使用你已经忘记了盐,肯定会导致不同的散列的方法。
Another thing to check is if the method you're using a uses salt that you've forgotten about, that would certainly cause different hashes to be generated.
这篇关于检索ASP.Net自动生成的machineKey的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!