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
(PHP Extension) Open Smartcard Certificate Store (or from USB Token)Demonstrates how to open the certificate store of the smart card currently in the reader (or the USB token). Iterates over the certs found on the smartcard. Note: This example requires Chilkat v9.5.0.80 or later.
<?php include("chilkat.php"); // Use "chilkat_9_5_0.php" for versions of Chilkat < 10.0.0 $certStore = new CkCertStore(); // Access the certificates on the smart card via the Chilkat certificate store class. // Note: Always pass the empty string to OpenSmartcard. // Also, the Chilkat CertStore class can only use MS CNG or CryptoAPI. // Some smartcard/USB token drivers only support PKCS11 or ScMinidriver. // You may get better results using Chilkat.Cert.LoadFromSmartcard because // Cert.LoadFromSmartcard can automatically detect and utilize PKCS11, ScMinidriver, CNG, and CryptoAPI. $success = $certStore->OpenSmartcard(''); if ($success == false) { print $certStore->lastErrorText() . "\n"; exit; } // Iterate over certificates on the smartcard. $i = 0; $numCerts = $certStore->get_NumCertificates(); print 'numCerts = ' . $numCerts . "\n"; while (($i < $numCerts)) { // cert is a CkCert $cert = $certStore->GetCertificate($i); print $cert->subjectCN() . "\n"; $i = $i + 1; } ?> |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.