开发者

CryptDeriveKey (OID) is unknown with SHA256 under Windows 7 64 bits

I'm testing some components I built with VS2008 SP1 targeting .NET Framework 3.5 SP1. I'm getting the exception "(OID) is unknown" in the method PasswordDeriveBytes.CryptDeriveKey passing "SHA256" as the parameter of the hashing algorithm (I also tried with "SHA256Managed" and "SHA256Cng" as mentioned here). This method works OK under XP SP3. As I understand these algorithms wer开发者_开发知识库e added with the SP1 of 3.5 and Windows 7 comes with 3.5 SP1.

So my question is how I can get SHA256 under Windows 7?


to http://www.codeplex.com/clrsecurity/SourceControl/changeset/view/18423 and click "Download". b.      Unzip and build the downloaded Security.Cryptography\src\Security.Cryptography.csproj VS 2008 project. c.       Write a program to call Security.Cryptography.Oid2.RegisterSha2OidInformationForRsa(). d.      Execute that program, which will register SHA-256 OID with the OS. e.      If this is a 64-bit architecture, you must also recompile the program for the x86 platform and execute it. This is because Visual Studio 2008 is a 32-bit application and requires that the same changes be made in the 32-bit registry.

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace RegisterSHA256 { class Program { static void Main(string[] args) { Console.WriteLine("++++Begin to register SHA-256++++"); Security.Cryptography.Oid2.RegisterSha2OidInformationForRsa(); Console.WriteLine("++++ End to register SHA-256+++++"); } } }

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜