|  | 
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) X509Certificate GetCertHash SHA256See more Certificates ExamplesShows how to get the SHA256 hash of a certificate.
 integer li_rc oleobject loo_Cert integer li_Success oleobject loo_BdDer string ls_CertHash 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 // Load a certificate object with a certificate. // The certificate object could have come from any source, // or perhaps was obtained from another Chilkat function. // The source does not matter. What matters is that we have // a cert object loaded with the certificate.. li_Success = loo_Cert.LoadFromFile("qa_data/certs/cert_test123.cer") if li_Success <> 1 then Write-Debug loo_Cert.LastErrorText destroy loo_Cert return end if // Get the binary DER of the certificae, and compute the SHA256 hash: loo_BdDer = create oleobject // Use "Chilkat_9_5_0.BinData" for versions of Chilkat < 10.0.0 li_rc = loo_BdDer.ConnectToNewObject("Chilkat.BinData") loo_Cert.ExportCertDerBd(loo_BdDer) // Get the base64 representation of the SHA256 hash. ls_CertHash = loo_BdDer.GetHash("sha256","base64") Write-Debug "Certificate hash in base64 = " + ls_CertHash destroy loo_Cert destroy loo_BdDer | ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.