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) Binary Certificate Extension DataSee more Certificates ExamplesDemonstrates how to binary certificate extension data by OID. The GetExtensionBd method is added in Chilkat v9.5.0.96.
Use ChilkatAx-win32.pkg Procedure Test Handle hoCert Boolean iSuccess Variant vBd Handle hoBd String sOid String sStrXml String sTemp1 Boolean bTemp1 Get Create (RefClass(cComChilkatCert)) To hoCert If (Not(IsComObjectCreated(hoCert))) Begin Send CreateComObject of hoCert End Get ComLoadFromFile Of hoCert "qa_data/certs/testCert.cer" To iSuccess If (iSuccess = False) Begin Get ComLastErrorText Of hoCert To sTemp1 Showln sTemp1 Procedure_Return End Get Create (RefClass(cComChilkatBinData)) To hoBd If (Not(IsComObjectCreated(hoBd))) Begin Send CreateComObject of hoBd End // The particular certificate in this test contains the following extensions Move "1.2.250.1.71.1.2.5" To sOid Get pvComObject of hoBd to vBd Get ComGetExtensionBd Of hoCert sOid vBd To iSuccess If (iSuccess = True) Begin Get ComGetEncoded Of hoBd "hex_lower" To sTemp1 Showln sOid ": " sTemp1 End Move "1.2.250.1.71.1.2.2" To sOid Get pvComObject of hoBd to vBd Get ComGetExtensionBd Of hoCert sOid vBd To iSuccess If (iSuccess = True) Begin Get ComGetEncoded Of hoBd "hex_lower" To sTemp1 Showln sOid ": " sTemp1 End Move "1.2.250.1.71.1.2.3" To sOid Get pvComObject of hoBd to vBd Get ComGetExtensionBd Of hoCert sOid vBd To iSuccess If (iSuccess = True) Begin Get ComGetEncoded Of hoBd "hex_lower" To sTemp1 Showln sOid ": " sTemp1 End Move "1.2.250.1.71.1.2.7" To sOid Get pvComObject of hoBd to vBd Get ComGetExtensionBd Of hoCert sOid vBd To iSuccess If (iSuccess = True) Begin Get ComGetEncoded Of hoBd "hex_lower" To sTemp1 Showln sOid ": " sTemp1 End Move "1.2.250.1.71.4.2.5" To sOid Get pvComObject of hoBd to vBd Get ComGetExtensionBd Of hoCert sOid vBd To iSuccess If (iSuccess = True) Begin Get ComGetEncoded Of hoBd "hex_lower" To sTemp1 Showln sOid ": " sTemp1 End // Sample output: // 1.2.250.1.71.1.2.5: 040180 // 1.2.250.1.71.1.2.2: 020100 // 1.2.250.1.71.1.2.3: 1315383032353030303030312f32393030303539313432 // 1.2.250.1.71.1.2.7: 02010a // 1.2.250.1.71.4.2.5: 30060c04534d3236 // The above binary values are actually ASN.1 // You can get the ASN.1 decoed by calling GetExtensionAsXml to get it in XML format, // and then you extract the values from the XML. Move "1.2.250.1.71.1.2.5" To sOid Get ComGetExtensionAsXml Of hoCert sOid To sStrXml Get ComLastMethodSuccess Of hoCert To bTemp1 If (bTemp1 = True) Begin Showln sOid ": " sStrXml End Move "1.2.250.1.71.1.2.2" To sOid Get ComGetExtensionAsXml Of hoCert sOid To sStrXml Get ComLastMethodSuccess Of hoCert To bTemp1 If (bTemp1 = True) Begin Showln sOid ": " sStrXml End Move "1.2.250.1.71.1.2.3" To sOid Get ComGetExtensionAsXml Of hoCert sOid To sStrXml Get ComLastMethodSuccess Of hoCert To bTemp1 If (bTemp1 = True) Begin Showln sOid ": " sStrXml End Move "1.2.250.1.71.1.2.7" To sOid Get ComGetExtensionAsXml Of hoCert sOid To sStrXml Get ComLastMethodSuccess Of hoCert To bTemp1 If (bTemp1 = True) Begin Showln sOid ": " sStrXml End Move "1.2.250.1.71.4.2.5" To sOid Get ComGetExtensionAsXml Of hoCert sOid To sStrXml Get ComLastMethodSuccess Of hoCert To bTemp1 If (bTemp1 = True) Begin Showln sOid ": " sStrXml End // Sample output: // 1.2.250.1.71.1.2.5: <octets>gA==</octets> // 1.2.250.1.71.1.2.2: <int>00</int> // 1.2.250.1.71.1.2.3: <printable>8025000001/2900059142</printable> // 1.2.250.1.71.1.2.7: <int>0A</int> // 1.2.250.1.71.4.2.5: <sequence><utf8>SM26</utf8></sequence> // "gA==" is the base64 encoded byte values // "0A" is hex for decimal 1 End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.