Sample code for 30+ languages & platforms
Unicode C

Transition from Cert.GetCertChain to Cert.BuildCertChain

Provides instructions for replacing deprecated GetCertChain method calls with BuildCertChain.

Chilkat Unicode C Downloads

Unicode C
#include <C_CkCertW.h>
#include <C_CkCertChainW.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkCertW cert;
    HCkCertChainW certchainObj;
    HCkCertChainW certchainOut;

    success = FALSE;

    cert = CkCertW_Create();

    //  ------------------------------------------------------------------------
    //  The GetCertChain method is deprecated:

    certchainObj = CkCertW_GetCertChain(cert);
    if (CkCertW_getLastMethodSuccess(cert) == FALSE) {
        wprintf(L"%s\n",CkCertW_lastErrorText(cert));
        CkCertW_Dispose(cert);
        return;
    }

    //  ...
    //  ...

    CkCertChainW_Dispose(certchainObj);

    //  ------------------------------------------------------------------------
    //  Do the equivalent using BuildCertChain.
    //  Your application creates a new, empty CertChain object which is passed 
    //  in the last argument and filled upon success.

    certchainOut = CkCertChainW_Create();
    success = CkCertW_BuildCertChain(cert,certchainOut);
    if (success == FALSE) {
        wprintf(L"%s\n",CkCertW_lastErrorText(cert));
        CkCertW_Dispose(cert);
        CkCertChainW_Dispose(certchainOut);
        return;
    }



    CkCertW_Dispose(cert);
    CkCertChainW_Dispose(certchainOut);

    }