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/P12 from a Base64 Encoded PFX FileDemonstrates how to call LoadPfxEncoded.
#include <CkBinData.h> #include <CkPfx.h> void ChilkatSample(void) { CkString strOut; CkBinData bd; bool success = bd.LoadFile("qa_data/pfx/cert_test123.pfx"); if (success != true) { strOut.append("Failed to load PFX file."); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } // Get the bytes contained in the PFX in base64 format: const char *strBase64 = bd.getEncoded("base64"); // The base64 looks like this: "MIIbEAIBAzCCGswGCSqGSIb3DQEHAaCCGr0Eghq5MIIatTCCBg..." strOut.append(strBase64); strOut.append("\r\n"); CkPfx pfx; // Load the PFX from the base64 string const char *password = "test123"; success = pfx.LoadPfxEncoded(strBase64,"base64",password); if (success != true) { strOut.append(pfx.lastErrorText()); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); return; } strOut.append("success"); strOut.append("\r\n"); SetDlgItemText(IDC_EDIT1,strOut.getUnicode()); } |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.