Sample code for 30+ languages & platforms
Delphi DLL

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
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Cert, CertStore;

...

procedure TForm1.Button1Click(Sender: TObject);
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);

end;