Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... 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.
#include <C_CkCertStore.h> #include <C_CkCert.h> void ChilkatSample(void) { HCkCertStore certStore; BOOL success; const char *pfxPath; const char *pfxPassword; int numCerts; int i; HCkCert cert; 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); i = 0; while (i < numCerts) { cert = CkCertStore_GetCertificate(certStore,i); 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)); CkCert_Dispose(cert); i = i + 1; } CkCertStore_Dispose(certStore); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.