Sample code for 30+ languages & platforms
C

Transition from Imap.GetSslServerCert to Imap.GetServerCert

Provides instructions for replacing deprecated GetSslServerCert method calls with GetServerCert.

Chilkat C Downloads

C
#include <C_CkImap.h>
#include <C_CkCert.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkImap imap;
    HCkCert certObj;
    HCkCert cert;

    success = FALSE;

    imap = CkImap_Create();

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  The GetSslServerCert method is deprecated:

    certObj = CkImap_GetSslServerCert(imap);
    if (CkImap_getLastMethodSuccess(imap) == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        return;
    }

    //  ...
    //  ...

    CkCert_Dispose(certObj);

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

    cert = CkCert_Create();
    success = CkImap_GetServerCert(imap,cert);
    if (success == FALSE) {
        printf("%s\n",CkImap_lastErrorText(imap));
        CkImap_Dispose(imap);
        CkCert_Dispose(cert);
        return;
    }



    CkImap_Dispose(imap);
    CkCert_Dispose(cert);

    }