PowerBuilder
PowerBuilder
Example: Crypt2.SetSigningCert method
Demonstrates how to call the SetSigningCert method.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_CryptA
oleobject loo_CertA
oleobject loo_CryptB
oleobject loo_CertB
oleobject loo_CryptC
oleobject loo_CertC
li_Success = 0
// Signing certificates can be obtained from many different sources..
// Load from a PFX
loo_CryptA = create oleobject
li_rc = loo_CryptA.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_CryptA
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_CertA = create oleobject
li_rc = loo_CertA.ConnectToNewObject("Chilkat.Cert")
li_Success = loo_CertA.LoadPfxFile("c:/someDir/pfx_files/a.pfx","pfx_file_password")
li_Success = loo_CryptA.SetSigningCert(loo_CertA)
// ...
// Load from a smart card or USB token.
loo_CryptB = create oleobject
li_rc = loo_CryptB.ConnectToNewObject("Chilkat.Crypt2")
loo_CertB = create oleobject
li_rc = loo_CertB.ConnectToNewObject("Chilkat.Cert")
loo_CertB.SmartCardPin = "123456"
li_Success = loo_CertB.LoadFromSmartcard("")
li_Success = loo_CryptB.SetSigningCert(loo_CertB)
// ...
// Load from a the Windows certificate store or macOS keychain
loo_CryptC = create oleobject
li_rc = loo_CryptC.ConnectToNewObject("Chilkat.Crypt2")
loo_CertC = create oleobject
li_rc = loo_CertC.ConnectToNewObject("Chilkat.Cert")
li_Success = loo_CertC.LoadByCommonName("Xyz 123")
li_Success = loo_CryptC.SetSigningCert(loo_CertC)
// ...
destroy loo_CryptA
destroy loo_CertA
destroy loo_CryptB
destroy loo_CertB
destroy loo_CryptC
destroy loo_CertC