PowerBuilder
PowerBuilder
Example: Crypt2.ClearSigningCerts method
Demonstrates how to call the ClearSigningCerts method.Chilkat PowerBuilder Downloads
integer li_rc
integer li_Success
oleobject loo_Crypt
oleobject loo_Cert1
oleobject loo_Cert2
oleobject loo_Cert3
oleobject loo_Bd
oleobject loo_Cert4
oleobject loo_Cert5
li_Success = 0
loo_Crypt = create oleobject
li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2")
if li_rc < 0 then
destroy loo_Crypt
MessageBox("Error","Connecting to COM object failed")
return
end if
li_Success = 0
// Tell the crypt object to use 3 certificates.
// Do this by calling AddSigningCert for each certificate.
loo_Cert1 = create oleobject
li_rc = loo_Cert1.ConnectToNewObject("Chilkat.Cert")
// ...
// Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
// ...
loo_Crypt.AddSigningCert(loo_Cert1)
loo_Cert2 = create oleobject
li_rc = loo_Cert2.ConnectToNewObject("Chilkat.Cert")
// ...
loo_Crypt.AddSigningCert(loo_Cert2)
loo_Cert3 = create oleobject
li_rc = loo_Cert3.ConnectToNewObject("Chilkat.Cert")
// ...
loo_Crypt.AddSigningCert(loo_Cert3)
loo_Bd = create oleobject
li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData")
// ...
li_Success = loo_Crypt.OpaqueSignBd(loo_Bd)
// Let's say we now want to sign something else with different certs..
// First clear the signing certs.
loo_Crypt.ClearSigningCerts()
loo_Cert4 = create oleobject
li_rc = loo_Cert4.ConnectToNewObject("Chilkat.Cert")
// ...
loo_Crypt.AddSigningCert(loo_Cert4)
loo_Cert5 = create oleobject
li_rc = loo_Cert5.ConnectToNewObject("Chilkat.Cert")
// ...
loo_Crypt.AddSigningCert(loo_Cert5)
// ...
// ...
// Sign using cert4 and cert5.
li_Success = loo_Crypt.OpaqueSignBd(loo_Bd)
destroy loo_Crypt
destroy loo_Cert1
destroy loo_Cert2
destroy loo_Cert3
destroy loo_Bd
destroy loo_Cert4
destroy loo_Cert5