C # traverse Digital certificates

Source: Internet
Author: User

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 issued by
}
}
Response.Write (ss);
}
}
}

C # traverse Digital certificates

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.