(Tcl) Apple Keychain - List Certificates
Iterates over the certificates in the Apple Keychain.
Note: This example requires Chilkat v10.0.0 or greater.
load ./chilkat.dll
set certStore [new_CkCertStore]
# On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
# The argument passed to OpenCurrentUserStore is ignored.
set success [CkCertStore_OpenCurrentUserStore $certStore 0]
if {$success == 0} then {
puts [CkCertStore_lastErrorText $certStore]
delete_CkCertStore $certStore
exit
}
set numCerts [CkCertStore_get_NumCertificates $certStore]
puts "numCerts = $numCerts"
set i 0
while {$i < $numCerts} {
# cert is a CkCert
set cert [CkCertStore_GetCertificate $certStore $i]
puts [CkCert_subjectDN $cert]
delete_CkCert $cert
set i [expr $i + 1]
}
CkCertStore_CloseCertStore $certStore
delete_CkCertStore $certStore
|