Sample code for 30+ languages & platforms
VBScript

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 VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

success = 0

set certStore = 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
    outFile.WriteLine(certStore.LastErrorText)
    WScript.Quit
End If

' Find the certificate for the email address:
set jsonE = CreateObject("Chilkat.JsonObject")
success = jsonE.UpdateString("email","joe@example.com")

set cert = CreateObject("Chilkat.Cert")
success = certStore.FindCert(jsonE,cert)
If (success = 0) Then
    outFile.WriteLine(certStore.LastErrorText)
    WScript.Quit
End If

outFile.WriteLine("Found certificate: " & cert.SubjectDN)

outFile.Close