Sample code for 30+ languages & platforms
Xbase++

Example: Crypt2.SetSigningCert method

Demonstrates how to call the SetSigningCert method.

Chilkat Xbase++ Downloads

Xbase++
LOCAL nSuccess
LOCAL oCryptA
LOCAL oCertA
LOCAL oCryptB
LOCAL oCertB
LOCAL oCryptC
LOCAL oCertC

nSuccess := 0

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

//  Load from a PFX
oCryptA := CreateObject("Chilkat.Crypt2")
oCertA := CreateObject("Chilkat.Cert")
nSuccess := oCertA:LoadPfxFile("c:/someDir/pfx_files/a.pfx", "pfx_file_password")
nSuccess := oCryptA:SetSigningCert(oCertA)
//  ...

//  Load from a smart card or USB token.
oCryptB := CreateObject("Chilkat.Crypt2")
oCertB := CreateObject("Chilkat.Cert")
oCertB:SmartCardPin := "123456"
nSuccess := oCertB:LoadFromSmartcard("")
nSuccess := oCryptB:SetSigningCert(oCertB)
//  ...

//  Load from a the Windows certificate store or macOS keychain
oCryptC := CreateObject("Chilkat.Crypt2")
oCertC := CreateObject("Chilkat.Cert")
nSuccess := oCertC:LoadByCommonName("Xyz 123")
nSuccess := oCryptC:SetSigningCert(oCertC)
//  ...

oCryptA:destroy()
oCertA:destroy()
oCryptB:destroy()
oCertB:destroy()
oCryptC:destroy()
oCertC:destroy()