![]() |
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
(C) Load PFX (PKCS#12) and List CertificatesLoads a PFX file (.pfx, .p12) and iterates over the certificates found within. Note: This example requires Chilkat v10.1.2 or greater.
#include <C_CkCertStore.h> #include <C_CkCert.h> void ChilkatSample(void) { HCkCertStore certStore; BOOL success; const char *pfxPath; const char *pfxPassword; int numCerts; HCkCert cert; int i; certStore = CkCertStore_Create(); pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"; pfxPassword = "test"; success = CkCertStore_LoadPfxFile(certStore,pfxPath,pfxPassword); if (success != TRUE) { printf("%s\n",CkCertStore_lastErrorText(certStore)); CkCertStore_Dispose(certStore); return; } numCerts = CkCertStore_getNumCertificates(certStore); printf("PFX contains %d certificates\n",numCerts); cert = CkCert_Create(); i = 0; while (i < numCerts) { CkCertStore_GetCert(certStore,i,cert); printf("%d: (Common Name) %s\n",i,CkCert_subjectCN(cert)); printf("%d: (Serial Number) %s\n",i,CkCert_serialNumber(cert)); printf("%d: (Distinguished Name) %s\n",i,CkCert_subjectDN(cert)); i = i + 1; } CkCertStore_Dispose(certStore); CkCert_Dispose(cert); } |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.