(Go) Apple Keychain - List Certificates
Iterates over the certificates in the Apple Keychain.
Note: This example requires Chilkat v10.0.0 or greater.
certStore := chilkat.NewCertStore()
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
success := certStore.OpenCurrentUserStore(false)
if success == false {
fmt.Println(certStore.LastErrorText())
certStore.DisposeCertStore()
return
}
numCerts := certStore.NumCertificates()
fmt.Println("numCerts = ", numCerts)
i := 0
for i < numCerts {
cert := certStore.GetCertificate(i)
fmt.Println(cert.SubjectDN())
fmt.Println(cert.SubjectCN())
fmt.Println(cert.SerialNumber())
fmt.Println("----")
cert.DisposeCert()
i = i + 1
}
certStore.CloseCertStore()
certStore.DisposeCertStore()
|