Sample code for 30+ languages & platforms
C++

Workaround for the deprecated Crypt2.AddPfxSourceData method

Shows how to replace the deprecated AddPfxSourceData method. (Chilkat is moving away from the use of CkByteData.)

Chilkat C++ Downloads

C++
#include <CkCrypt2.h>
#include <CkByteData.h>
#include <CkBinData.h>

void ChilkatSample(void)
    {
    bool success = false;

    CkCrypt2 crypt;

    const char *path = "c:/data/example.pfx";
    const char *pfxPassword = "secret";

    //  ------------------------------------------------------------------------
    //  The AddPfxSourceData method is deprecated:

    CkByteData inData;
    inData.loadFile(path);

    success = crypt.AddPfxSourceData(inData,pfxPassword);

    //  ------------------------------------------------------------------------
    //  Workaround.
    //  (Chilkat is moving away from using CkByteData)
    CkBinData bdIn;
    bdIn.LoadFile(path);

    success = crypt.AddPfxSourceBd(bdIn,pfxPassword);
    }