(PureBasic) Apple Keychain - List Certificates
Iterates over the certificates in the Apple Keychain.
Note: This example requires Chilkat v10.0.0 or greater.
IncludeFile "CkCert.pb"
IncludeFile "CkCertStore.pb"
Procedure ChilkatExample()
certStore.i = CkCertStore::ckCreate()
If certStore.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
; On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
; The argument passed to OpenCurrentUserStore is ignored.
success.i = CkCertStore::ckOpenCurrentUserStore(certStore,0)
If success = 0
Debug CkCertStore::ckLastErrorText(certStore)
CkCertStore::ckDispose(certStore)
ProcedureReturn
EndIf
numCerts.i = CkCertStore::ckNumCertificates(certStore)
Debug "numCerts = " + Str(numCerts)
i.i = 0
While i < numCerts
cert.i = CkCertStore::ckGetCertificate(certStore,i)
Debug CkCert::ckSubjectDN(cert)
Debug CkCert::ckSubjectCN(cert)
Debug CkCert::ckSerialNumber(cert)
Debug "----"
CkCert::ckDispose(cert)
i = i + 1
Wend
CkCertStore::ckCloseCertStore(certStore)
CkCertStore::ckDispose(certStore)
ProcedureReturn
EndProcedure
|