Classic ASP
Classic ASP
Find a Certificate in the "Other People" Windows Certificate Store
See more Certificates Examples
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.Chilkat Classic ASP Downloads
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
set certStore = Server.CreateObject("Chilkat.CertStore")
' The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
readOnly = 1
success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly)
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( certStore.LastErrorText) & "</pre>"
Response.End
End If
' Find the certificate for the email address:
set jsonE = Server.CreateObject("Chilkat.JsonObject")
success = jsonE.UpdateString("email","joe@example.com")
set cert = Server.CreateObject("Chilkat.Cert")
success = certStore.FindCert(jsonE,cert)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( certStore.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( "Found certificate: " & cert.SubjectDN) & "</pre>"
%>
</body>
</html>