如何解决我如何在C#中编写makecert“ -sky exchange”和“ -sky signature”代码
|| 我需要以编程方式在.NET应用程序中创建等效键...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
输出最终将像这样使用:
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>\");
解决方法
我知道您现在可能已经找到了解决方案,但是代码如下所示(基于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\\\"\");
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。