RSA数字证书管理分为以下几个部分:

1:在存储区内创建数字证书;

2:导出数字证书私钥;

3:导出数字证书公钥;

4:导入数字证书;

5:读取数字证书。

 

1:在.net开发环境中,在证书存储区内创建数字证书

数字证书生成,需要指定证书主题,以及本机makecert.exe程序路径,因为证书制作实际上还是用makecert.exe来生成的。生成数字证书代码 如下:

 1         /// <summary>
 2         /// 根据指定的证书名和makecert全路径生成证书(包含公钥和私钥,并保存在MY存储区)
 3         /// </summary>
 4         /// <param name="subjectName"></param>
 5         /// <param name="makecertPath"></param>
 6         /// <returns></returns>
 7         public static bool CreateCertWithPrivateKey(string subjectName, string makecertPath)
 8         {
 9             subjectName = "CN=" + subjectName;
10             string param = " -pe -ss my -n \"" + subjectName + "\" ";
11             try
12             {
13                 Process p = Process.Start(makecertPath, param);
14                 p.WaitForExit();
15                 p.Close();
16             }
17             catch (Exception e)
18             {
19                 return false;
20             }
21             return true;
22         }    
View Code

相关文章:

猜你喜欢
  • 2021-12-28
  • 2021-11-11
  • 2021-08-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案