1

I need to programatically create the equivalant keys in a .NET application...

makecert -r -pe -a sha1 -n "CN=MyName" -ss my -sr CurrentUser -sky exchange

makecert -r -pe -a sha1 -n "CN=MyName" -ss my -sr CurrentUser -sky signature

The output will ultimately be used like this:

RSACryptoServiceProvider privateKey = new RSACryptoServiceProvider();         
privateKey.FromXmlString("<RSAKeyValue>
<Modulus>wL8s+C8SnnlaaqR+VsyijmxOJOARNa4o7ZNsqfy3+9J9Ol2JNSjjMfQWoUnFtClzJBlZhU5KtuazQe8ZKXTX9YvKoJdRhlsonZkC04qiTMdO/FZIH00GrCRxeQ7XDnQnvPB9Bdsvs//7zrY3f7eLIkpIyK9cQHU+5jjJd5IT0eE=</Modulus>
<Exponent>AQAB</Exponent>
<P>83xxN7jvpg5z16pxz2tIQIdqd/EfmikR9Q2TjG2tosWkUSvtyx0xHZ9EqdTUbSGZZ+jgrabzkafYc7Mplylwew==</P>
<Q>yqcnYSZEXHwJvRWi2V09PNEENTozQZywcFptUUGar9TciaQvoNv3lpnfzUKNBRdhzq4lImxkamajZlTWE5buUw==</Q>
<DP>37HqilkbwyHwB6mOGhPkM3S1ujAK6qTk3JB2iEOTjMGrru9+7maJYz+Z47Wm3ARMXgyzrpZ9m8nqsJFfmoL11Q==</DP>
<DQ>v285tv8kMs2FkZYfuP/oOkwkkneBNejjj68Md2bmzlThZDCyQV2pvB1tmgPVHUsiPNCrCaKlFRISJzfa5rR8Ow==</DQ>
<InverseQ>fgJE2TRe/SS+YqW0/I+FtHrdfbbao0/R3pHD4r4oceZQUemlBgZ7DxOAetebHKthlOdjGkmfWYB8EU4XoWggqw==</InverseQ>
<D>FMLCwjy3wbAKiCANp6XFAJgz1o7365NFv0k41BpvasViTa4TgFFWH2ROJ7M9g0lPqJy+YrhrHcY9mqV5TVjTheQp0JeckrgO2B39XngPMAMMdne3rWGpf0Pfbj3FLfchMk6XYDXSZzCS2CmSeRA4aBMb+4R3YurixyJLrnGRMH0=</D>
</RSAKeyValue>");         
4

1 回答 1

0

我意识到您现在可能已经找到了解决方案,但代码如下所示:(基于http://blogs.technet.com/b/jhoward/archive/2005/02/02/365323.aspx

Process.Start("makecert.exe", "-pe -n \"CN=MyCert Root Authority\" -ss my -sr LocalMachine -a sha1 -sky signature -r \"MyCert Root Authority.cer\"");

Process.Start("makecert.exe", "-pe -n \"CN=MyCert\" -ss my -sr LocalMachine -a sha1 -sky exchange -eku 1.3.6.1.5.5.7.3.1 -in \"MyCert Root Authority\" -is MY -ir LocalMachine -sp \"Microsoft RSA SChannel Cryptographic Provider\" -sy 12 \"MyCert.cer\"");

于 2013-02-12T16:54:53.473 回答