Sample code for 30+ languages & platforms
Delphi ActiveX

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.

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;
cryptA: TChilkatCrypt2;
certA: TChilkatCert;
cryptB: TChilkatCrypt2;
certB: TChilkatCert;
cryptC: TChilkatCrypt2;
certC: TChilkatCert;

begin
success := 0;

// Signing certificates can be obtained from many different sources..

// Load from a PFX
cryptA := TChilkatCrypt2.Create(Self);
certA := TChilkatCert.Create(Self);
success := certA.LoadPfxFile('c:/someDir/pfx_files/a.pfx','pfx_file_password');
success := cryptA.SetSigningCert(certA.ControlInterface);
// ...

// Load from a smart card or USB token.
cryptB := TChilkatCrypt2.Create(Self);
certB := TChilkatCert.Create(Self);
certB.SmartCardPin := '123456';
success := certB.LoadFromSmartcard('');
success := cryptB.SetSigningCert(certB.ControlInterface);
// ...

// Load from a the Windows certificate store or macOS keychain
cryptC := TChilkatCrypt2.Create(Self);
certC := TChilkatCert.Create(Self);
success := certC.LoadByCommonName('Xyz 123');
success := cryptC.SetSigningCert(certC.ControlInterface);
// ...
end;