Programming Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C Examples

Bounced Mail
Bz2
Certificates/Keys
Charset
CSV
DKIM / DomainKey
Diffie-Hellman
DSA
Email Object
Encryption
FileAccess
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
MIME
NTLM
POP3
RSA
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
Zip
Amazon S3

 

 

 

 

 

 

 

 

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
FreeBSD C++ Libraries
HP-UX C++ Libraries
BlackBerry QNX C++ 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.