|  | 
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) 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. 
 integer li_rc oleobject loo_Cert integer li_Success oleobject loo_Bd string ls_Oid string ls_StrXml loo_Cert = create oleobject // Use "Chilkat_9_5_0.Cert" for versions of Chilkat < 10.0.0 li_rc = loo_Cert.ConnectToNewObject("Chilkat.Cert") if li_rc < 0 then destroy loo_Cert MessageBox("Error","Connecting to COM object failed") return end if li_Success = loo_Cert.LoadFromFile("qa_data/certs/testCert.cer") if li_Success = 0 then Write-Debug loo_Cert.LastErrorText destroy loo_Cert return end if loo_Bd = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_Bd.ConnectToNewObject("Chilkat.BinData") // The particular certificate in this test contains the following extensions ls_Oid = "1.2.250.1.71.1.2.5" li_Success = loo_Cert.GetExtensionBd(ls_Oid,loo_Bd) if li_Success = 1 then Write-Debug ls_Oid + ": " + loo_Bd.GetEncoded("hex_lower") end if ls_Oid = "1.2.250.1.71.1.2.2" li_Success = loo_Cert.GetExtensionBd(ls_Oid,loo_Bd) if li_Success = 1 then Write-Debug ls_Oid + ": " + loo_Bd.GetEncoded("hex_lower") end if ls_Oid = "1.2.250.1.71.1.2.3" li_Success = loo_Cert.GetExtensionBd(ls_Oid,loo_Bd) if li_Success = 1 then Write-Debug ls_Oid + ": " + loo_Bd.GetEncoded("hex_lower") end if ls_Oid = "1.2.250.1.71.1.2.7" li_Success = loo_Cert.GetExtensionBd(ls_Oid,loo_Bd) if li_Success = 1 then Write-Debug ls_Oid + ": " + loo_Bd.GetEncoded("hex_lower") end if ls_Oid = "1.2.250.1.71.4.2.5" li_Success = loo_Cert.GetExtensionBd(ls_Oid,loo_Bd) if li_Success = 1 then Write-Debug ls_Oid + ": " + loo_Bd.GetEncoded("hex_lower") end if // 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. ls_Oid = "1.2.250.1.71.1.2.5" ls_StrXml = loo_Cert.GetExtensionAsXml(ls_Oid) if loo_Cert.LastMethodSuccess = 1 then Write-Debug ls_Oid + ": " + ls_StrXml end if ls_Oid = "1.2.250.1.71.1.2.2" ls_StrXml = loo_Cert.GetExtensionAsXml(ls_Oid) if loo_Cert.LastMethodSuccess = 1 then Write-Debug ls_Oid + ": " + ls_StrXml end if ls_Oid = "1.2.250.1.71.1.2.3" ls_StrXml = loo_Cert.GetExtensionAsXml(ls_Oid) if loo_Cert.LastMethodSuccess = 1 then Write-Debug ls_Oid + ": " + ls_StrXml end if ls_Oid = "1.2.250.1.71.1.2.7" ls_StrXml = loo_Cert.GetExtensionAsXml(ls_Oid) if loo_Cert.LastMethodSuccess = 1 then Write-Debug ls_Oid + ": " + ls_StrXml end if ls_Oid = "1.2.250.1.71.4.2.5" ls_StrXml = loo_Cert.GetExtensionAsXml(ls_Oid) if loo_Cert.LastMethodSuccess = 1 then Write-Debug ls_Oid + ": " + ls_StrXml end if // 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 destroy loo_Cert destroy loo_Bd | ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.