Sample code for 30+ languages & platforms
Tcl

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 Tcl Downloads

Tcl

load ./chilkat.dll

set success 0

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

set certStore [new_CkCertStore]

set readOnly 1
set success [CkCertStore_OpenCurrentUserStore $certStore $readOnly]
if {$success == 0} then {
    puts [CkCertStore_lastErrorText $certStore]
    delete_CkCertStore $certStore
    exit
}

set cert [new_CkCert]

set numCerts [CkCertStore_get_NumCertificates $certStore]
set i 0
while {$i < $numCerts} {
    CkCertStore_GetCert $certStore $i $cert
    puts "DN = [CkCert_subjectDN $cert]"
    puts "Email = [CkCert_subjectE $cert]"
    set i [expr $i + 1]
}

delete_CkCertStore $certStore
delete_CkCert $cert