Sample code for 30+ languages & platforms
AutoIt

Iterate over Certificates in a Certificate Store

See more Cert Store Examples

Demonstrates how to iterate over the certificates in a certificate store.

Note: Requires Chilkat v10.1.2 or later.

Chilkat AutoIt Downloads

AutoIt
Local $bSuccess = False

$oCertStore = ObjCreate("Chilkat.CertStore")

; This opens the Current User certificate store on Windows,
; On MacOS and iOS it opens the default Keychain.
Local $bReadOnly = False
$bSuccess = $oCertStore.OpenCurrentUserStore($bReadOnly)
If ($bSuccess = False) Then
    ConsoleWrite($oCertStore.LastErrorText & @CRLF)
    Exit
EndIf

$oCert = ObjCreate("Chilkat.Cert")

Local $iNumCerts = $oCertStore.NumCertificates
Local $i = 0

While ($i < $iNumCerts)
    ; Load the cert object with the Nth certificate.
    $oCertStore.GetCert($i,$oCert)
    ConsoleWrite($i & ": " & $oCert.SubjectCN & @CRLF)
    $i = $i + 1
Wend