Sample code for 30+ languages & platforms
Delphi ActiveX

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

Delphi ActiveX
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Chilkat_TLB;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Integer;
certStore: TChilkatCertStore;
readOnly: Integer;
cert: TChilkatCert;
numCerts: Integer;
i: Integer;

begin
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.

certStore := TChilkatCertStore.Create(Self);

readOnly := 1;
success := certStore.OpenCurrentUserStore(readOnly);
if (success = 0) then
  begin
    Memo1.Lines.Add(certStore.LastErrorText);
    Exit;
  end;

cert := TChilkatCert.Create(Self);
numCerts := certStore.NumCertificates;
i := 0;
while i < numCerts do
  begin
    certStore.GetCert(i,cert.ControlInterface);
    Memo1.Lines.Add('DN = ' + cert.SubjectDN);
    Memo1.Lines.Add('Email = ' + cert.SubjectE);
    i := i + 1;
  end;
end;