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