C#遍历数字证书
2015-01-22 09:17
155 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography.X509Certificates;
namespace WebApplication3
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//System.Security.Cryptography.X509Certificates.X509Store
//System.Security.Cryptography.X509Certificates.X509Store x = new System.Security.Cryptography.X509Certificates.X509Store();
//string ss = x.Name;
X509Store store = new X509Store(StoreName.My);
store.Open(OpenFlags.ReadWrite);
X509Certificate2 certificate = new X509Certificate2();
X509Certificate2Collection storecollection3 = (X509Certificate2Collection)store.Certificates;
string ss = "";
if (storecollection3.Count == 0)
{
Console.WriteLine("Store contains no certificates.");
}
else
{
foreach (X509Certificate2 x509 in storecollection3)
{
//Console.WriteLine("certificate name: {0}", x509.Subject);
ss = ss + "||" + x509.SerialNumber;
//x509.Issuer 颁发者
}
}
Response.Write(ss);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Security.Cryptography.X509Certificates;
namespace WebApplication3
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//System.Security.Cryptography.X509Certificates.X509Store
//System.Security.Cryptography.X509Certificates.X509Store x = new System.Security.Cryptography.X509Certificates.X509Store();
//string ss = x.Name;
X509Store store = new X509Store(StoreName.My);
store.Open(OpenFlags.ReadWrite);
X509Certificate2 certificate = new X509Certificate2();
X509Certificate2Collection storecollection3 = (X509Certificate2Collection)store.Certificates;
string ss = "";
if (storecollection3.Count == 0)
{
Console.WriteLine("Store contains no certificates.");
}
else
{
foreach (X509Certificate2 x509 in storecollection3)
{
//Console.WriteLine("certificate name: {0}", x509.Subject);
ss = ss + "||" + x509.SerialNumber;
//x509.Issuer 颁发者
}
}
Response.Write(ss);
}
}
}
相关文章推荐
- (转)C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- (转)C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- C#遍历查询文本框是否为空,判断文本框是否为数字,一键清空文本框内容
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- 让c#的exe只要被修改就无法运行,支持混淆和数字证书
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密(转)
- 让c#的exe只要被修改就无法运行,支持混淆和数字证书
- C#中使用X509Certificate2类获取数字证书颁发者和持有者的名称信息
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- 基于visual c++之windows核心编程代码分析(46)遍历数字证书
- Visual Studio 2017中使用正则修改部分内容 如何使用ILAsm与ILDasm修改.Net exe(dll)文件 C#学习-图解教程(1):格式化数字字符串 小程序开发之图片转Base64(C#、.Net) jquery遍历table为每一个单元格取值及赋值 。net加密解密相关方法 .net关于坐标之间一些简单操作
- C#程序自动安装数字证书
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密
- c#开发ActiveX控件及数字证书入门
- C#创建数字证书并导出为pfx,并使用pfx进行非对称加解密