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
(Unicode C) Load PFX (PKCS#12) and List CertificatesLoads a PFX file (.pfx, .p12) and iterates over the certificates found within.
#include <C_CkCertStoreW.h> #include <C_CkCertW.h> void ChilkatSample(void) { HCkCertStoreW certStore; BOOL success; const wchar_t *pfxPath; const wchar_t *pfxPassword; int numCerts; int i; HCkCertW cert; certStore = CkCertStoreW_Create(); pfxPath = L"/Users/chilkat/testData/pfx/chilkat_ssl.pfx"; pfxPassword = L"test"; success = CkCertStoreW_LoadPfxFile(certStore,pfxPath,pfxPassword); if (success != TRUE) { wprintf(L"%s\n",CkCertStoreW_lastErrorText(certStore)); CkCertStoreW_Dispose(certStore); return; } numCerts = CkCertStoreW_getNumCertificates(certStore); wprintf(L"PFX contains %d certificates\n",numCerts); i = 0; while (i < numCerts) { cert = CkCertStoreW_GetCertificate(certStore,i); wprintf(L"%d: (Common Name) %s\n",i,CkCertW_subjectCN(cert)); wprintf(L"%d: (Serial Number) %s\n",i,CkCertW_serialNumber(cert)); wprintf(L"%d: (Distinguished Name) %s\n",i,CkCertW_subjectDN(cert)); CkCertW_Dispose(cert); i = i + 1; } CkCertStoreW_Dispose(certStore); } |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.