Sample code for 30+ languages & platforms
Classic ASP

Find Certificate by Email Address

Locate the certificate containing the specified email address in either the RFC822 Name or the Subject.

Note: This example requires Chilkat v10.1.2 or later.

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")

' This opens the Current User certificate store on Windows,
' On MacOS and iOS it opens the default Keychain.
readOnly = 1
success = certStore.OpenCurrentUserStore(readOnly)
If (success = 0) Then
    Response.Write "<pre>" & Server.HTMLEncode( certStore.LastErrorText) & "</pre>"
    Response.End
End If

' Locate the certificate containing the specified email address in either the RFC822 Name or the Subject.
set json = Server.CreateObject("Chilkat.JsonObject")
email_address = "harold@example.com"
success = json.UpdateString("email",email_address)

set cert = Server.CreateObject("Chilkat.Cert")
success = certStore.FindCert(json,cert)
If (success = 1) Then
    ' Show the full distinguished name of the certificate.
    Response.Write "<pre>" & Server.HTMLEncode( "Found: " & cert.SubjectDN) & "</pre>"
Else
    Response.Write "<pre>" & Server.HTMLEncode( "Not found.") & "</pre>"
End If


%>
</body>
</html>