Sample code for 30+ languages & platforms
Lua Requires Chilkat v10.1.2+

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).

Chilkat Lua Downloads

Lua
local chilkat = require("chilkat")

-- This is a Windows-only example because it lists the certificates
-- stored in the Windows Current User Certificate Store located in the
-- Windows Registry.

local certStore = chilkat.CertStore.new()

local readOnly = true
local success = certStore:open_current_user_store(readOnly)
if not success then
    print(certStore.last_error_text)
    return
end

local cert = chilkat.Cert.new()
local numCerts = certStore.num_certificates
local i = 0
while i < numCerts do
    certStore:get_cert(i, cert)
    print("DN = " .. cert.subject_dn)
    print("Email = " .. cert.subject_e)
    i = i + 1
end