Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Create PFX from PEM (Certificate and Private Key Files)Create a PFX file from a pair of PEM files (the certificate PEM and private key PEM). Downloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries #include <C_CkCert.h> #include <C_CkPrivateKey.h> void ChilkatSample(void) { BOOL success; HCkCert cert; HCkPrivateKey privkey; BOOL bIncludeCertsInChain; cert = CkCert_Create(); success = CkCert_LoadFromFile(cert,"chilkat_cert.pem"); if (success != TRUE) { printf("%s\n",CkCert_lastErrorText(cert)); return; } privkey = CkPrivateKey_Create(); // If the private key PEM is encrypted, call LoadEncryptedPemFile instead. success = CkPrivateKey_LoadPemFile(privkey,"chilkat_pkey.pem"); if (success != TRUE) { printf("%s\n",CkPrivateKey_lastErrorText(privkey)); return; } success = CkCert_SetPrivateKey(cert,privkey); if (success != TRUE) { printf("%s\n",CkCert_lastErrorText(cert)); return; } // Now export to a PFX: bIncludeCertsInChain = FALSE; success = CkCert_ExportToPfxFile(cert,"chilkat2.pfx","myPassword",bIncludeCertsInChain); if (success != TRUE) { printf("%s\n",CkCert_lastErrorText(cert)); return; } printf("PFX created!\n"); CkCert_Dispose(cert); CkPrivateKey_Dispose(privkey); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.