Lua Requires Chilkat v10.1.2+
Lua
Find a Certificate in the "Other People" Windows Certificate Store
See more Certificates Examples
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.Chilkat Lua Downloads
local chilkat = require("chilkat")
local certStore = chilkat.CertStore.new()
-- The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
local readOnly = true
local success = certStore:open_windows_store("CurrentUser", "AddressBook", readOnly)
if not success then
print(certStore.last_error_text)
return
end
-- Find the certificate for the email address:
local jsonE = chilkat.JsonObject.new()
jsonE:update_string("email", "joe@example.com")
local cert = chilkat.Cert.new()
success = certStore:find_cert(jsonE, cert)
if not success then
print(certStore.last_error_text)
return
end
print("Found certificate: " .. cert.subject_dn)