views:

263

answers:

1

I'm testing some components i build 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 this algorithms were 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.

Thanks.

Juan Zamudio

A: 

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+++++"); } } }

david