Swift
Swift
Apple Keychain - List Certificates
See more Apple Keychain Examples
Iterates over the certificates in the Apple Keychain.Chilkat Swift Downloads
func chilkatTest() {
var success: Bool = false
let certStore = CkoCertStore()!
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
success = certStore.openCurrentUserStore(readOnly: false)
if success == false {
print("\(certStore.lastErrorText!)")
return
}
var numCerts: Int = certStore.numCertificates.intValue
print("numCerts = \(numCerts)")
let cert = CkoCert()!
var i: Int = 0
while i < numCerts {
certStore.getCert(index: i, cert: cert)
print("\(cert.subjectDN!)")
print("\(cert.subjectCN!)")
print("\(cert.serialNumber!)")
print("----")
i = i + 1
}
certStore.close()
}