(Go) Apple Keychain - List Certificates
Iterates over the certificates in the Apple Keychain.Note: This example requires Chilkat v10.1.2 or greater.
certStore := CertStore_Ref.html">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)
cert := Cert_Ref.html">chilkat.NewCert()
i := 0
for i < numCerts {
certStore.GetCert(i,cert)
fmt.Println(cert.SubjectDN())
fmt.Println(cert.SubjectCN())
fmt.Println(cert.SerialNumber())
fmt.Println("----")
i = i + 1
}
certStore.CloseCertStore()
certStore.DisposeCertStore()
cert.DisposeCert()
|