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) Load .crl, Convert to XML, Get Revoked Serial Numbers and DatesLoad a binary .crl file (Certificate Revocation List), converts to XML, and then gets the revoked certificate serial numbers and revocation dates. Note: This example requires Chilkat v9.5.0.77 or greater.
Use ChilkatAx-win32.pkg Procedure Test Variant vBdCrl Handle hoBdCrl Boolean iSuccess Handle hoAsn Handle hoXml Integer i Integer iCount_i String sTagPath Integer j Integer iCount_j Integer k Integer iCount_k String sRevokedCertSerialHex String sDateRevoked Handle hoDt String sTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // Load a binary .crl file. Get Create (RefClass(cComChilkatBinData)) To hoBdCrl If (Not(IsComObjectCreated(hoBdCrl))) Begin Send CreateComObject of hoBdCrl End Get ComLoadFile Of hoBdCrl "qa_data/crl/ca1.crl" To iSuccess If (iSuccess <> True) Begin Showln "Failed to load CRL file." Procedure_Return End Get Create (RefClass(cComChilkatAsn)) To hoAsn If (Not(IsComObjectCreated(hoAsn))) Begin Send CreateComObject of hoAsn End Get pvComObject of hoBdCrl to vBdCrl Get ComLoadBd Of hoAsn vBdCrl To iSuccess If (iSuccess <> True) Begin Get ComLastErrorText Of hoAsn To sTemp1 Showln sTemp1 Procedure_Return End // Convert ASN.1 to XML and load into xml and re-emit for pretty printing.. Get Create (RefClass(cComChilkatXml)) To hoXml If (Not(IsComObjectCreated(hoXml))) Begin Send CreateComObject of hoXml End Get ComAsnToXml Of hoAsn To sTemp1 Get ComLoadXml Of hoXml sTemp1 To iSuccess Get ComSaveXml Of hoXml "qa_output/crl.xml" To iSuccess // Use this online tool to generate parsing code from CRL XML: // Generate Parsing Code from XML // Here's code to parse the XML. This code was generated by the above tool, // and then we modified it by removing unneeded code and changing some names Get Create (RefClass(cComCkDateTime)) To hoDt If (Not(IsComObjectCreated(hoDt))) Begin Send CreateComObject of hoDt End Move 0 To i Get ComNumChildrenHavingTag Of hoXml "sequence" To iCount_i While (i < iCount_i) Set ComI Of hoXml To i Move 0 To j Get ComNumChildrenHavingTag Of hoXml "sequence[i]|sequence" To iCount_j While (j < iCount_j) Set ComJ Of hoXml To j Move 0 To k Get ComNumChildrenHavingTag Of hoXml "sequence[i]|sequence[j]|sequence" To iCount_k While (k < iCount_k) Set ComK Of hoXml To k // Get the revoked certificate's serial number in uppercase hex. Get ComGetChildContent Of hoXml "sequence[i]|sequence[j]|sequence[k]|int" To sRevokedCertSerialHex Showln "serial number: " sRevokedCertSerialHex // Get the date/time revoked. It will be a string formatted as "YYMMDDhhmmssZ", such as "181023093028Z" Get ComGetChildContent Of hoXml "sequence[i]|sequence[j]|sequence[k]|utctime" To sDateRevoked // Starting in Chilkat v9.5.0.77, date/time strings formatted as YYMMDDhhmmssZ can be parsed as follows: Get ComSetFromTimestamp Of hoDt sDateRevoked To iSuccess Get ComGetAsRfc822 Of hoDt False To sTemp1 Showln "date revoked: " sTemp1 Move (k + 1) To k Loop Move (j + 1) To j Loop Move (i + 1) To i Loop End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.