Lua Requires Chilkat v10.1.2+
Lua
Apple Keychain - List Certificates
See more Apple Keychain Examples
Iterates over the certificates in the Apple Keychain.Chilkat Lua Downloads
local chilkat = require("chilkat")
local certStore = chilkat.CertStore.new()
-- On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
-- The argument passed to OpenCurrentUserStore is ignored.
local success = certStore:open_current_user_store(false)
if not success then
print(certStore.last_error_text)
return
end
local numCerts = certStore.num_certificates
print("numCerts = " .. numCerts)
local cert = chilkat.Cert.new()
local i = 0
while i < numCerts do
certStore:get_cert(i, cert)
print(cert.subject_dn)
print(cert.subject_cn)
print(cert.serial_number)
print("----")
i = i + 1
end
certStore:close_cert_store()