Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(MFC) Load PFX (PKCS#12) and List CertificatesLoads a PFX file (.pfx, .p12) and iterates over the certificates found within.
#include <CkCertStore.h> #include <CkCert.h> void ChilkatSample(void) { CkString strOut; CkCertStore certStore; bool success; const char *pfxPath = "/Users/chilkat/testData/pfx/chilkat_ssl.pfx"; const char *pfxPassword = "test"; success = certStore.LoadPfxFile(pfxPath,pfxPassword); if (success != true) { strOut.append(certStore.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } int numCerts = certStore.get_NumCertificates(); strOut.append("PFX contains "); strOut.appendInt(numCerts); strOut.append(" certificates"); strOut.append("\r\n"); int i = 0; while (i < numCerts) { CkCert *cert = certStore.GetCertificate(i); strOut.appendInt(i); strOut.append(": (Common Name) "); strOut.append(cert->subjectCN()); strOut.append("\r\n"); strOut.appendInt(i); strOut.append(": (Serial Number) "); strOut.append(cert->serialNumber()); strOut.append("\r\n"); strOut.appendInt(i); strOut.append(": (Distinguished Name) "); strOut.append(cert->subjectDN()); strOut.append("\r\n"); delete cert; i = i + 1; } SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.