![]() |
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
(PureBasic) Load PFX/P12 File into Certificate Store ObjectDemonstrates how to load a .pfx/.p12 into a certificate store object. Note: This example requires Chilkat v10.1.2 or greater.
IncludeFile "CkCert.pb" IncludeFile "CkCertStore.pb" Procedure ChilkatExample() certStore.i = CkCertStore::ckCreate() If certStore.i = 0 Debug "Failed to create object." ProcedureReturn EndIf ; This only loads the contents of the PFX file into the certStore object. ; It is not importing the PFX into the Windows certificate stores. pfxPassword.s = "badssl.com" success.i = CkCertStore::ckLoadPfxFile(certStore,"qa_data/pfx/badssl.com-client.p12",pfxPassword) If success = 0 Debug CkCertStore::ckLastErrorText(certStore) CkCertStore::ckDispose(certStore) ProcedureReturn EndIf ; Examine each certificate (loaded from the PFX) in this certStore object cert.i = CkCert::ckCreate() If cert.i = 0 Debug "Failed to create object." ProcedureReturn EndIf numCerts.i = CkCertStore::ckNumCertificates(certStore) i.i = 0 While i < numCerts CkCertStore::ckGetCert(certStore,i,cert) Debug "hasPrivateKey=" + Str(CkCert::ckHasPrivateKey(cert)) + ", " + CkCert::ckSubjectCN(cert) i = i + 1 Wend CkCertStore::ckDispose(certStore) CkCert::ckDispose(cert) ProcedureReturn EndProcedure |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.