Sample code for 30+ languages & platforms
Classic ASP

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).

Chilkat Classic ASP Downloads

Classic ASP
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0

' This is a Windows-only example because it lists the certificates
' stored in the Windows Current User Certificate Store located in the
' Windows Registry.

set certStore = Server.CreateObject("Chilkat.CertStore")

readOnly = 1
success = certStore.OpenCurrentUserStore(readOnly)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( certStore.LastErrorText) & "</pre>"
    Response.End
End If

set cert = Server.CreateObject("Chilkat.Cert")
numCerts = certStore.NumCertificates
i = 0
Do While i < numCerts
    success = certStore.GetCert(i,cert)
    Response.Write "<pre>" & Server.HTMLEncode( "DN = " & cert.SubjectDN) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( "Email = " & cert.SubjectE) & "</pre>"
    i = i + 1
Loop

%>
</body>
</html>