Sample code for 30+ languages & platforms
B4X Requires Chilkat v10.1.2+

Apple Keychain - List Certificates

See more Apple Keychain Examples

Iterates over the certificates in the Apple Keychain.

Chilkat B4X Downloads

B4X
Dim success As Boolean = False

Dim certStore As ChilkatCertStore
certStore.Initialize

'  On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
'  The argument passed to OpenCurrentUserStore is ignored.
success = certStore.OpenCurrentUserStore(False)
If success = False Then
    Log(certStore.LastErrorText)
    Return
End If


Dim numCerts As Int = certStore.NumCertificates
Log("numCerts = " & numCerts)

Dim cert As ChilkatCert
cert.Initialize("cert")
Dim i As Int = 0
Do While i < numCerts
    certStore.GetCert(i, cert)
    Log(cert.SubjectDN)
    Log(cert.SubjectCN)
    Log(cert.SerialNumber)
    Log("----")
    i = i + 1
Loop

certStore.CloseCertStore