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) Extract XML from FatturaPA .p7mDemonstrates how to verify the signature and extract the XML from a FatturaPA .p7m file.
Use ChilkatAx-win32.pkg Procedure Test Variant vBd Handle hoBd Boolean iSuccess Handle hoCrypt Boolean iBVerified Handle hoXml String sTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. Get Create (RefClass(cComChilkatBinData)) To hoBd If (Not(IsComObjectCreated(hoBd))) Begin Send CreateComObject of hoBd End Get ComLoadFile Of hoBd "qa_data/p7m/IT01879020517_abc.xml.p7m" To iSuccess If (iSuccess <> True) Begin Showln "Failed to load the .p7m file" Procedure_Return End Get Create (RefClass(cComChilkatCrypt2)) To hoCrypt If (Not(IsComObjectCreated(hoCrypt))) Begin Send CreateComObject of hoCrypt End // Verify and extrct the payload contained within the .p7m. // In this case, the payload is the FatturaPA XML. // If successful, the resulting bd will contain only the XML. Get pvComObject of hoBd to vBd Get ComOpaqueVerifyBd Of hoCrypt vBd To iBVerified If (iBVerified <> True) Begin Get ComLastErrorText Of hoCrypt To sTemp1 Showln sTemp1 Showln "Failed to extract and verify." Procedure_Return End // Save the XML to a file. Get ComWriteFile Of hoBd "qa_output/zIT01879020517_abc.xml" To iSuccess // Alternatively, load into an XML object and emit. Get Create (RefClass(cComChilkatXml)) To hoXml If (Not(IsComObjectCreated(hoXml))) Begin Send CreateComObject of hoXml End Get ComGetString Of hoBd "utf-8" To sTemp1 Get ComLoadXml Of hoXml sTemp1 To iSuccess Get ComGetXml Of hoXml To sTemp1 Showln sTemp1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.