![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Example: Crypt2.ClearEncryptCerts methodDemonstrates how to call the ClearEncryptCerts method.
integer li_rc oleobject loo_Crypt oleobject loo_Cert1 oleobject loo_Cert2 oleobject loo_Cert3 oleobject loo_Bd integer li_Success oleobject loo_Cert4 oleobject loo_Cert5 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 // Tell the crypt object to use 3 certificates. // Do this by calling AddEncryptCert 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.AddEncryptCert(loo_Cert1) loo_Cert2 = create oleobject li_rc = loo_Cert2.ConnectToNewObject("Chilkat.Cert") // ... loo_Crypt.AddEncryptCert(loo_Cert2) loo_Cert3 = create oleobject li_rc = loo_Cert3.ConnectToNewObject("Chilkat.Cert") // ... loo_Crypt.AddEncryptCert(loo_Cert3) // Params for public-key encryption to create PKCS7 enveloped-data loo_Crypt.CryptAlgorithm = "pki" loo_Crypt.Pkcs7CryptAlg = "aes" loo_Crypt.KeyLength = 256 loo_Crypt.OaepHash = "sha256" loo_Crypt.OaepPadding = 1 loo_Bd = create oleobject li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData") // ... li_Success = loo_Crypt.EncryptBd(loo_Bd) // Let's say we now want to encrypt something else with different certs.. // First clear the encryption certs. loo_Crypt.ClearEncryptCerts() loo_Cert4 = create oleobject li_rc = loo_Cert4.ConnectToNewObject("Chilkat.Cert") // ... loo_Crypt.AddEncryptCert(loo_Cert4) loo_Cert5 = create oleobject li_rc = loo_Cert5.ConnectToNewObject("Chilkat.Cert") // ... loo_Crypt.AddEncryptCert(loo_Cert5) // ... // ... // Encrypt using cert4 and cert5. li_Success = loo_Crypt.EncryptBd(loo_Bd) destroy loo_Crypt destroy loo_Cert1 destroy loo_Cert2 destroy loo_Cert3 destroy loo_Bd destroy loo_Cert4 destroy loo_Cert5 |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.