![]() |
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) Duplicate openssl smime -encrypt -binary -aes-256-cbc -in some_file.dat -out some_file.dat.enc -outform DER cert.crtDemonstrates how to encrypt to binary DER using 256-bit AES (CBC mode) as the underlying symmetric encryption algorithm, to produce PKCS7 enveloped data (binary DER). Duplicates the following openssl command: openssl smime -encrypt -binary -aes-256-cbc -in some_file.dat -out some_file.dat.enc -outform DER cert.crt
integer li_rc oleobject loo_Cert integer li_Success oleobject loo_Bd oleobject loo_Crypt // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. loo_Cert = create oleobject // Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0 li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert") if li_rc < 0 then destroy loo_Cert MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Cert.LoadFromFile("qa_data/openssl/EE.cer") if li_Success = 0 then Write-Debug loo_Cert.LastErrorText destroy loo_Cert return end if loo_Bd = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData") li_Success = loo_Bd.LoadFile("qa_data/openssl/hello.txt") // Assuming success.. loo_Crypt = create oleobject // Use "Chilkat_9_5_0.Crypt2" for versions of Chilkat < 10.0.0 li_rc = loo_Crypt.ConnectToNewObject("Chilkat.Crypt2") li_Success = loo_Crypt.SetEncryptCert(loo_Cert) if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Cert destroy loo_Bd destroy loo_Crypt return end if loo_Crypt.CryptAlgorithm = "PKI" // Indicate the underlying symmetric encryption to be used: loo_Crypt.Pkcs7CryptAlg = "aes" loo_Crypt.KeyLength = 256 loo_Crypt.CipherMode = "cbc" li_Success = loo_Crypt.CkEncryptFile("qa_data/openssl/hello.txt","qa_output/hello.txt.enc") if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Cert destroy loo_Bd destroy loo_Crypt return end if Write-Debug "Success." destroy loo_Cert destroy loo_Bd destroy loo_Crypt |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.