Sample code for 30+ languages & platforms
Delphi DLL 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 Delphi DLL Downloads

Delphi DLL
var
success: Boolean;
certStore: HCkCertStore;
readOnly: Boolean;
cert: HCkCert;
numCerts: Integer;
i: Integer;

begin
success := False;

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

certStore := CkCertStore_Create();

readOnly := True;
success := CkCertStore_OpenCurrentUserStore(certStore,readOnly);
if (success = False) then
  begin
    Memo1.Lines.Add(CkCertStore__lastErrorText(certStore));
    Exit;
  end;

cert := CkCert_Create();
numCerts := CkCertStore_getNumCertificates(certStore);
i := 0;
while i < numCerts do
  begin
    CkCertStore_GetCert(certStore,i,cert);
    Memo1.Lines.Add('DN = ' + CkCert__subjectDN(cert));
    Memo1.Lines.Add('Email = ' + CkCert__subjectE(cert));
    i := i + 1;
  end;

CkCertStore_Dispose(certStore);
CkCert_Dispose(cert);