Lazarus Pascal Requires Chilkat v11.0.0+
Lazarus Pascal
Example: Http.GetServerCert method
Demonstrates how to call the GetServerCert method.Chilkat Lazarus Pascal Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.Cert,
Chilkat.Http;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
http: THttp;
cert: TCert;
begin
success := False;
http := THttp.Create;
cert := TCert.Create;
success := http.GetServerCert('chilkatsoft.com',443,cert);
if (success = False) then
begin
WriteLn(http.LastErrorText);
Exit;
end;
WriteLn(cert.SubjectDN);
WriteLn(cert.ValidToStr);
// Output:
// CN=*.chilkatsoft.com
// Wed, 10 Jun 2026 23:59:59 GMT
http.Free;
cert.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.