(AutoIt) Find a Certificate in the "Other People" Windows Certificate Store
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address. Note: This example requires Chilkat v10.1.2 or greater.
$oCertStore = ObjCreate("Chilkat.CertStore")
; The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
Local $bReadOnly = True
Local $bSuccess = $oCertStore.OpenWindowsStore("CurrentUser","AddressBook",$bReadOnly)
If ($bSuccess <> True) Then
ConsoleWrite($oCertStore.LastErrorText & @CRLF)
Exit
EndIf
; Find the certificate for the email address:
$oJsonE = ObjCreate("Chilkat.JsonObject")
$oJsonE.UpdateString("email","joe@example.com")
$oCert = ObjCreate("Chilkat.Cert")
$bSuccess = $oCertStore.FindCert($oJsonE,$oCert)
If ($bSuccess = False) Then
ConsoleWrite($oCertStore.LastErrorText & @CRLF)
Exit
EndIf
ConsoleWrite("Found certificate: " & $oCert.SubjectDN & @CRLF)
|