B4X
B4X
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 B4X Downloads
Dim success As Boolean = False
Dim certStore As ChilkatCertStore
certStore.Initialize
' This opens the Current User certificate store on Windows,
' On MacOS and iOS it opens the default Keychain.
Dim readOnly As Boolean = False
success = certStore.OpenCurrentUserStore(readOnly)
If success = False Then
Log(certStore.LastErrorText)
Return
End If
Dim cert As ChilkatCert
cert.Initialize("cert")
Dim numCerts As Int = certStore.NumCertificates
Dim i As Int = 0
Do While (i < numCerts)
' Load the cert object with the Nth certificate.
certStore.GetCert(i, cert)
Log(i & ": " & cert.SubjectCN)
i = i + 1
Loop