| (Delphi DLL) Load a Certificate from the Windows Certificate StoreDemonstrates how to load a certificate that has been pre-installed in the registry-based  Windows certificate store.  This is generally how one would load a certificate that is stored on a smart card or usb token. 
 uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Cert;
...
procedure TForm1.Button1Click(Sender: TObject);
var
cert: HCkCert;
success: Boolean;
begin
cert := CkCert_Create();
success := CkCert_LoadByCommonName(cert,'PIVKey 7ED53EC611D3F84396212C5842BB563F');
if (success <> True) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Exit;
  end;
Memo1.Lines.Add('Loaded: ' + CkCert__subjectDN(cert));
CkCert_Dispose(cert);
end;
 |