![]() |
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 OpensSSL Command that Decrypts Binary DERThis example duplicates the following: openssl smime -decrypt -in INPUT_FILE -inform der -binary -out OUTPUT_FILE -recip PEM_CERT_AND_KEY -passin pass:PRIVKEY_PASSWORD Note: Although "smime" is the OpenSSL command, we're not really dealing with S/MIME. The arguments "-inform der -binary" indicate that the input is simply the binary DER (i.e. the PKCS7 binary encrypted object). The output can be any type of file (whatever was encrypted). Note: This example requires Chilkat v11.0.0 or greater.
integer li_rc integer li_Success oleobject loo_Crypt oleobject loo_Pem oleobject loo_Privkey oleobject loo_Cert li_Success = 0 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. 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 loo_Crypt.CryptAlgorithm = "pki" loo_Pem = create oleobject li_rc = loo_Pem.ConnectToNewObject("Chilkat.Pem") li_Success = loo_Pem.LoadPemFile("qa_data/pem/myPem.pem","password") if li_Success = 0 then Write-Debug loo_Pem.LastErrorText destroy loo_Crypt destroy loo_Pem return end if loo_Privkey = create oleobject li_rc = loo_Privkey.ConnectToNewObject("Chilkat.PrivateKey") li_Success = loo_Pem.PrivateKeyAt(0,loo_Privkey) if li_Success = 0 then Write-Debug loo_Pem.LastErrorText destroy loo_Crypt destroy loo_Pem destroy loo_Privkey return end if loo_Cert = create oleobject li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert") li_Success = loo_Pem.CertAt(0,loo_Cert) if li_Success = 0 then Write-Debug loo_Pem.LastErrorText destroy loo_Crypt destroy loo_Pem destroy loo_Privkey destroy loo_Cert return end if li_Success = loo_Crypt.SetDecryptCert2(loo_Cert,loo_Privkey) if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Crypt destroy loo_Pem destroy loo_Privkey destroy loo_Cert return end if li_Success = loo_Crypt.CkDecryptFile("qa_data/infile.enc","qa_output/outfile.dat") if li_Success = 0 then Write-Debug loo_Crypt.LastErrorText destroy loo_Crypt destroy loo_Pem destroy loo_Privkey destroy loo_Cert return end if Write-Debug "Success." destroy loo_Crypt destroy loo_Pem destroy loo_Privkey destroy loo_Cert |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.