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
(DataFlex) Decrypt a .p7m File (using a PFX)DataFlex sample code showing how to decrypt a .p7m using a .p12 / .pfx certificate w/ private key.
Use ChilkatAx-win32.pkg Procedure Test Handle hoCrypt String sPfxPath String sPfxPassword Boolean iSuccess String sInPath String sOutPath String sTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt If (Not(IsComObjectCreated(hoCrypt))) Begin Send CreateComObject of hoCrypt End // Use a digital certificate and private key from a PFX file (.pfx or .p12). Move "myCertAndKey.pfx" To sPfxPath Move "test123" To sPfxPassword Get ComAddPfxSourceFile Of hoCrypt sPfxPath sPfxPassword To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoCrypt To sTemp1 Showln sTemp1 Procedure_Return End // Set the outPath to whatever is appropriate. // If you are decrypting a PDF, your output might be "out.pdf"... Move "smime.p7m" To sInPath Move "original.txt" To sOutPath // Indicate that we're doing public key decryption (i.e. PKCS7) Set ComCryptAlgorithm Of hoCrypt To "pki" Get ComCkDecryptFile Of hoCrypt sInPath sOutPath To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCrypt To sTemp1 Showln sTemp1 Procedure_Return End Showln "Success." End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.