Xbase++
Xbase++
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 Xbase++ Downloads
LOCAL nSuccess
LOCAL oCertStore
LOCAL nReadOnly
LOCAL oCert
LOCAL nNumCerts
LOCAL i
nSuccess := 0
oCertStore := CreateObject("Chilkat.CertStore")
// This opens the Current User certificate store on Windows,
// On MacOS and iOS it opens the default Keychain.
nReadOnly := 0
nSuccess := oCertStore:OpenCurrentUserStore(nReadOnly)
IF (nSuccess == 0)
? oCertStore:LastErrorText
oCertStore:destroy()
RETURN
ENDIF
oCert := CreateObject("Chilkat.Cert")
nNumCerts := oCertStore:NumCertificates
i := 0
DO WHILE (i < nNumCerts)
// Load the cert object with the Nth certificate.
oCertStore:GetCert(i, oCert)
? Str(i) + ": " + oCert:SubjectCN
i := i + 1
ENDDO
oCertStore:destroy()
oCert:destroy()