Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(PowerBuilder) Duplicate openssl smime -decrypt -in some_file.dat.enc -binary -inform DER -inkey private.key -out some_file.datDemonstrates how to decrypt binary DER that was encrypted using 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_PrivKey oleobject loo_Crypt // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // Duplicates the following openssl command: // openssl smime -decrypt -in hello.txt.enc -binary -inform DER -inkey private.key -out hello.txt 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/EE.key") // Assuming success.. loo_PrivKey = create oleobject // Use "Chilkat_9_5_0.PrivateKey" for versions of Chilkat < 10.0.0 li_rc = loo_PrivKey.ConnectToNewObject("Chilkat.PrivateKey") li_Success = loo_PrivKey.LoadAnyFormat(loo_Bd,"") if li_Success = 0 then Write-Debug loo_PrivKey.LastErrorText destroy loo_Cert destroy loo_Bd destroy loo_PrivKey return end if 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.SetDecryptCert2(loo_Cert,loo_PrivKey) if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Cert destroy loo_Bd destroy loo_PrivKey destroy loo_Crypt return end if loo_Crypt.CryptAlgorithm = "PKI" li_Success = loo_Crypt.CkDecryptFile("qa_data/openssl/hello.txt.enc","qa_output/hello.txt") if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Cert destroy loo_Bd destroy loo_PrivKey destroy loo_Crypt return end if Write-Debug "Success." destroy loo_Cert destroy loo_Bd destroy loo_PrivKey destroy loo_Crypt |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.