![]() |
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
(Tcl) Find a Certificate by it's SHA-1 ThumbprintSee more Cert Store ExamplesFinds a certificate by it's SHA-1 hex thumbprint.Note: This example requires Chilkat v10.1.2 or later.
load ./chilkat.dll set certStore [new_CkCertStore] set thumbprint "12c1dd8015f3f03f7b1fa619dc24e2493ca8b4b2" # This opens the Current User certificate store on Windows, # On MacOS and iOS it opens the default Keychain. set bReadOnly 1 set success [CkCertStore_OpenCurrentUserStore $certStore $bReadOnly] if {$success == 0} then { puts [CkCertStore_lastErrorText $certStore] delete_CkCertStore $certStore exit } # Find the certificate having a specific SHA1 thumbprint. set json [new_CkJsonObject] CkJsonObject_UpdateString $json "thumbprint" $thumbprint set cert [new_CkCert] set success [CkCertStore_FindCert $certStore $json $cert] if {$success == 0} then { puts "Failed to find the certificate." delete_CkCertStore $certStore delete_CkJsonObject $json delete_CkCert $cert exit } puts "Found: [CkCert_subjectCN $cert]" # ------------------------------------------------------------------------------------- # Alternatively, one could load a certificate store object with certs from a PEM file, # and do the same thing.. set certStorePem [new_CkCertStore] set success [CkCertStore_LoadPemFile $certStorePem "pemFiles/certificates.pem"] if {$success == 0} then { puts [CkCertStore_lastErrorText $certStorePem] delete_CkCertStore $certStore delete_CkJsonObject $json delete_CkCert $cert delete_CkCertStore $certStorePem exit } set success [CkCertStore_FindCert $certStore $json $cert] if {$success == 0} then { puts "Failed to find the certificate." delete_CkCertStore $certStore delete_CkJsonObject $json delete_CkCert $cert delete_CkCertStore $certStorePem exit } puts "Found: [CkCert_subjectCN $cert]" delete_CkCertStore $certStore delete_CkJsonObject $json delete_CkCert $cert delete_CkCertStore $certStorePem |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.