(C#) Apple Keychain - List Certificates
Iterates over the certificates in the Apple Keychain.
Note: This example requires Chilkat v10.0.0 or greater.
Chilkat.CertStore certStore = new Chilkat.CertStore();
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
bool success = certStore.OpenCurrentUserStore(false);
if (success == false) {
Debug.WriteLine(certStore.LastErrorText);
return;
}
int numCerts = certStore.NumCertificates;
Debug.WriteLine("numCerts = " + Convert.ToString(numCerts));
int i = 0;
while (i < numCerts) {
Chilkat.Cert cert = certStore.GetCertificate(i);
Debug.WriteLine(cert.SubjectDN);
Debug.WriteLine(cert.SubjectCN);
Debug.WriteLine(cert.SerialNumber);
Debug.WriteLine("----");
i = i + 1;
}
certStore.CloseCertStore();
|