Sample code for 30+ languages & platforms
Classic ASP

Load PFX (PKCS#12) and List Certificates

See more Certificates Examples

Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.

Chilkat Classic ASP Downloads

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

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

pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"
pfxPassword = "test"
success = certStore.LoadPfxFile(pfxPath,pfxPassword)
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( certStore.LastErrorText) & "</pre>"
    Response.End
End If

numCerts = certStore.NumCertificates

Response.Write "<pre>" & Server.HTMLEncode( "PFX contains " & numCerts & " certificates") & "</pre>"

set cert = Server.CreateObject("Chilkat.Cert")
i = 0
Do While i < numCerts
    success = certStore.GetCert(i,cert)

    Response.Write "<pre>" & Server.HTMLEncode( i & ": (Common Name) " & cert.SubjectCN) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( i & ": (Serial Number) " & cert.SerialNumber) & "</pre>"
    Response.Write "<pre>" & Server.HTMLEncode( i & ": (Distinguished Name) " & cert.SubjectDN) & "</pre>"

    i = i + 1
Loop

%>
</body>
</html>